PdfGridColumnCollection class

Provides access to an ordered, strongly typed collection of PdfGridColumn objects.

//Create a new PDF document
PdfDocument document = PdfDocument();
//Create a PdfGrid
PdfGrid grid = PdfGrid();
//Create column to the PDF grid
PdfGridColumn column = PdfGridColumn(grid);
//Gets column form the PDF grid
PdfGridColumnCollection columns = grid.columns;
//Add columns to grid
columns.add(column: column);
columns.add(count: 2);
//Add headers to grid
grid.headers.add(1);
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 row1 = grid.rows.add();
row1.cells[0].value = 'E01';
row1.cells[1].value = 'Clay';
row1.cells[2].value = '\$10,000';
PdfGridRow row2 = grid.rows.add();
row2.cells[0].value = 'E02';
row2.cells[1].value = 'Simon';
row2.cells[2].value = '\$12,000';
//Set the width
grid.columns[1].width = 50;
//Set the column text format
grid.columns[0].format = PdfStringFormat(
    alignment: PdfTextAlignment.center,
    lineAlignment: PdfVerticalAlignment.bottom);
//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

PdfGridColumnCollection(PdfGrid grid)
Initializes a new instance of the PdfGridColumnCollection class with the parent grid.

Properties

count int
Gets the number of columns in the PdfGrid.
no setter
hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

add({int? count, PdfGridColumn? column}) → void
Adds the column into 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) PdfGridColumn
Gets the PdfGridColumn at the specified index.