PdfGrid class

Represents a flexible grid that consists of columns and rows.

//Create a new PDF document
PdfDocument document = PdfDocument();
//Create a PdfGrid class
PdfGrid grid = PdfGrid();
//Add the columns to the grid
grid.columns.add(count: 3);
//Add header to the grid
grid.headers.add(1);
//Add the rows to the grid
PdfGridRow header = grid.headers[0];
header.cells[0].value = 'Employee ID';
header.cells[1].value = 'Employee Name';
header.cells[2].value = 'Salary';
//Add rows to grid
PdfGridRow row = grid.rows.add();
row.cells[0].value = 'E01';
row.cells[1].value = 'Clay';
row.cells[2].value = '\$10,000';
row = grid.rows.add();
row.cells[0].value = 'E02';
row.cells[1].value = 'Simon';
row.cells[2].value = '\$12,000';
//Set the grid style
grid.style = PdfGridStyle(
    cellPadding: PdfPaddings(left: 2, right: 3, top: 4, bottom: 5),
    backgroundBrush: PdfBrushes.blue,
    textBrush: PdfBrushes.white,
    font: PdfStandardFont(PdfFontFamily.timesRoman, 25));
//Draw the grid
grid.draw(
    page: document.pages.add(), bounds: Rect.zero);
//Save the document.
List<int> bytes = await document.save();
//Dispose the document.
document.dispose();
Inheritance

Constructors

PdfGrid()
Initializes a new instance of the PdfGrid class.

Properties

allowRowBreakingAcrossPages bool
Gets or sets a value indicating whether to split or cut rows that overflow a page.
getter/setter pair
beginCellLayout PdfGridBeginCellLayoutCallback?
The event raised on starting cell lay outing.
getter/setter pair
beginPageLayout BeginPageLayoutCallback?
Raises before the element should be printed on the page.
getter/setter pairinherited
columns PdfGridColumnCollection
Gets the column collection of the PdfGrid.
no setter
endCellLayout PdfGridEndCellLayoutCallback?
The event raised on finished cell layout.
getter/setter pair
endPageLayout EndPageLayoutCallback?
Raises after the element was printed on the page.
getter/setter pairinherited
hashCode int
The hash code for this object.
no setterinherited
headers PdfGridHeaderCollection
Gets the headers collection from the PdfGrid.
no setter
repeatHeader bool
Gets or sets a value indicating whether to repeat header.
getter/setter pair
rows PdfGridRowCollection
Gets the row collection from the PdfGrid.
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
style PdfGridStyle
Gets the grid style.
getter/setter pair

Methods

applyBuiltInStyle(PdfGridBuiltInStyle gridStyle, {PdfGridBuiltInStyleSettings? settings}) → void
Apply built-in table style to the table
draw({Rect? bounds, PdfLayoutFormat? format, PdfGraphics? graphics, PdfPage? page}) PdfLayoutResult?
Draws the PdfGrid
override
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited