PdfGridCellCollection class
Provides access to an ordered, strongly typed collection of PdfGridCell 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
PdfGridRow header = grid.headers.add(1)[0];
header.cells[0].value = 'Employee ID';
header.cells[1].value = 'Employee Name';
header.cells[2].value = 'Salary';
//Add rows to grid
PdfGridRow row1 = grid.rows.add();
//Gets the cell collection from the row
PdfGridCellCollection cellCollection = row1.cells;
//Gets the specific cell from the row collection
PdfGridCell cell1 = cellCollection[0];
cell1.value = 'E01';
cell1.style.cellPadding = PdfPaddings(left: 0, right: 0, top: 10, bottom: 10);
cellCollection[1].value = 'Clay';
cellCollection[2].value = '\$10000';
PdfGridRow row2 = grid.rows.add();
row2.cells[0].value = 'E02';
row2.cells[1].value = 'Simon';
row2.cells[2].value = '\$12,000';
//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();
Properties
Methods
-
indexOf(
PdfGridCell cell) → int - Returns the index of a particular cell in the collection.
-
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
-
operator [](
int index) → PdfGridCell - Gets the PdfGridCell at the specified index.