API Documentation for SimpleTable
NoPoDoFo SimpleTable
The SimpleTable class is a wrapper around PoDoFo PdfSimpleTableModel. The PdfSimpleTableModel is described as: An abstract interface of a model that can provide data and formatting information to a PdfTable. The NoPoDoFo wrapper manages the underlying PdfTable for you. Please see the Table Cookbook for examples.
class SimpleTable {
new(doc:Base, cols:number, rows: number): SimpleTable
borderWidth: number
foregroundColor: Color
backgroundColor: Color
alignment: string
wordWrap: boolean
tableWidth: number
tableHeight: number
autoPageBreak: boolean
getText(col:number, row:number): string
setText(col: number, row: number, text: string): void
getFont(col:number, row:number): Font
setFont(font: Font): void
getVerticalAlignment(col: number, row: number): string
borderEnable(v: boolean): void
hasBorders(): boolean
getImage(col: number, row: number): Buffer
hasImage(col: number, row: number): boolean
hasBackgroundColor(col: number, row: number): boolean
enableBackground(v: boolean): void
getBorderColor(col: number, row: number): Color
draw(point: NPDFPoint, painter: Painter): void
columnCount(): number
rowCount(): number
setColumnWidths(n: number[]): void
setColumnWidth(n: number): void
setRowHeight(n: number): void
setRowHeights(n: number[]): void
}
Constructors
new(doc:Document, cols:number, rows: number): SimpleTable
Create a new table model with n columns(cols) and n rows(row)
Properties
borderWidth
Table border width as double
foregroundColor
Table foreground color
backgroundColor
Table background color
alignment
The horizonal alignment of the contents in all table cells. Valid alignment values are: "LEFT", "CENTER", "RIGHT"
wordWrap
Enable or disable word-wrapping
tableWidth
Table width
tableHeight
Table height
autoPageBreak
Enable or disable automatic page breaking. AutoPageBreak automatically creates a new page and continues drawing the table on the new page, if there is not enough space on the current page. The newly created page will be set as the current page on the painter used to draw and will be created using the same size as the old page.
Methods
getText
getText(col:number, row:number): string
Get the text of the table cell at the column and row provided.
setText
setText(col: number, row: number, text: string): void
Set the text of the table cell at the column and row provided.
getFont
getFont(col:number, row:number): Font
Get the font of the table cell at the column and row provided.
setFont
setFont(font: Font): void
Set the font of the table cell at the column and row provided.
getVerticalAlignment
getVerticalAlignment(col: number, row: number): string
Get the vertical alignment of the table cell at the column and row provided.
borderEnable
borderEnable(v: boolean): void
Enable or disable displaying the table's border
hasBorders
hasBorders(): boolean
Table has or has not a painted border
getImage
getImage(col: number, row: number): Buffer
Get the image of the table cell at the column and row provided
hasImage
hasImage(col: number, row: number): boolean
Boolean value; table has or has not an image at the column and row provided
hasBackgroundColor
hasBackgroundColor(col: number, row: number): boolean
Boolean value; the table cell at the column and row provided has background coloring enabled
enableBackground
enableBackground(v: boolean): void
Enable background coloring for the table cell at the column and row provided
getBorderColor
getBorderColor(col: number, row: number): Color
Get the border color for the table cell at the column and row provided
draw
draw(point: NPDFPoint, painter: Painter): void
Draw the table to the page at the NPDFPoint coordinates provided
columnCount
columnCount(): number
Get the number of columns in the table
rowCount
rowCount(): number
Get the number of rows in the table
setColumnWidths
setColumnWidths(n: number[]): void
Set the width of the columns (n)
setColumnWidth
setColumnWidth(n: number): void
Set the width of column n
setRowHeight
setRowHeight(n: number): void
Set the row hieght of row n
setRowHeights
setRowHeights(n: number[]): void
Set the row hieghts of rows n