PdfGridRowCollection class
Provides access to an ordered, strongly typed collection of PdfGridRow objects.
//Create a new PDF document
PdfDocument document = PdfDocument();
//Create a PdfGrid
PdfGrid grid = PdfGrid();
//Add columns to grid
grid.columns.add(count: 3);
//Add headers to grid
grid.headers.add(2);
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
grid.rows.add();
grid.rows.add();
//Gets the row collection
PdfGridRowCollection rowCollection = grid.rows;
PdfGridRow row1 = rowCollection[0];
row1.cells[0].value = 'E01';
row1.cells[1].value = 'Clay';
row1.cells[2].value = '\$10,000';
PdfGridRow row2 = rowCollection[1];
row2.cells[0].value = 'E02';
row2.cells[1].value = 'Simon';
row2.cells[2].value = '\$12,000';
//Set the row span
row1.cells[1].rowSpan = 2;
//Set the row height
row2.height = 20;
//Set the row style
rowCollection[0].style = PdfGridRowStyle(
backgroundBrush: PdfBrushes.dimGray,
textPen: PdfPens.lightGoldenrodYellow,
textBrush: PdfBrushes.darkOrange,
font: PdfStandardFont(PdfFontFamily.timesRoman, 12));
//Draw the grid in PDF document page
grid.draw(
page: document.pages.add(), bounds: Rect.zero);
//Save the document.
List<int> bytes = await document.save();
//Dispose the document.
document.dispose();
Constructors
- PdfGridRowCollection(PdfGrid grid)
- Initializes a new instance of the PdfGridRowCollection class with the parent grid.
Properties
Methods
-
add(
[PdfGridRow? row]) → PdfGridRow - Add a row to the grid.
-
applyStyle(
PdfGridStyleBase style) → void - Applies the style to all the rows in the grid.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
setSpan(
int rowIndex, int cellIndex, int rowSpan, int columnSpan) → void - Sets the row span and column span to a cell.
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
-
operator [](
int index) → PdfGridRow - Gets the PdfGridRow at the specified index.