PdfGridCell class
Represents the schema of a cell in a PdfGrid.
//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();
row1.cells[0].value = 'E01';
row1.cells[1].value = 'Clay';
//Apply the cell style to specific row cells
row1.cells[0].style = PdfGridCellStyle(
backgroundBrush: PdfBrushes.lightYellow,
cellPadding: PdfPaddings(left: 2, right: 3, top: 4, bottom: 5),
font: PdfStandardFont(PdfFontFamily.timesRoman, 17),
textBrush: PdfBrushes.white,
textPen: PdfPens.orange,
);
PdfGridCell gridCell = PdfGridCell(
row: row1,
format: PdfStringFormat(
alignment: PdfTextAlignment.center,
lineAlignment: PdfVerticalAlignment.bottom,
wordSpacing: 10));
gridCell.value = '\$10,000';
row1.cells[2].value = gridCell.value;
row1.cells[2].stringFormat = gridCell.stringFormat;
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();
Constructors
- PdfGridCell({PdfGridCellStyle? style, PdfStringFormat? format, PdfGridRow? row, int? rowSpan, int? columnSpan})
- Initializes a new instance of the PdfGridCell class.
Properties
- columnSpan ↔ int
-
Gets or sets a value that indicates the total number of columns that cell spans
within a PdfGrid.
getter/setter pair
- hashCode → int
-
The hash code for this object.
no setterinherited
- height → double
-
Gets the height of the PdfGrid cell.
no setter
- imagePosition ↔ PdfGridImagePosition
-
Gets or sets the image alignment type of the PdfGridCell image.
getter/setter pair
- rowSpan ↔ int
-
Gets or sets a value that indicates the total number of rows that cell spans
within a PdfGrid.
getter/setter pair
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- stringFormat ↔ PdfStringFormat
-
Gets or sets the string format.
getter/setter pair
- style ↔ PdfGridCellStyle
-
Gets or sets the cell style.
getter/setter pair
- value ↔ dynamic
-
Gets or sets the value of the cell.
getter/setter pair
- width → double
-
Gets the width of the PdfGrid cell.
no setter
Methods
-
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