Table
Overview
Table is a class in Aspose.PDF FOSS for .NET.
Inherits from: BaseParagraph.
Represents a table that can be added to a PDF page.
This class declares 14 methods for Table objects in .NET programs.
Available methods include: BaseParagraph, Build, BuildMultiPage, Clone, GetHeight, GetWidth, ImportArray, ImportDataTable, ImportDataView, SetColumnTextState, Table.
Public members are accessible to any .NET application after installing the Aspose.PDF FOSS for .NET package.
Properties: Alignment, BackgroundColor, Border, BoxWidth, BreakText, Broken, and 40 more.
Properties
| Name | Type | Access | Description |
|---|---|---|---|
ColumnWidths | string? | Read/Write | Space-separated column widths (e.g. |
Border | BorderInfo? | Read/Write | Table border. |
DefaultCellBorder | BorderInfo? | Read/Write | Default cell border applied to all cells unless overridden. |
DefaultCellPadding | MarginInfo? | Read/Write | Default cell padding. |
DefaultCellTextState | TextState? | Read/Write | Default text state for cells. |
BackgroundColor | Color? | Read/Write | Table background color. |
Left | float | Read/Write | Left position of the table on the page. |
Top | float | Read/Write | Top position of the table on the page (distance from page top). |
Margin | MarginInfo | Read/Write | Table margin. |
RepeatingRowsCount | int | Read/Write | Number of rows to repeat at the top of each page when the table spans pages. |
RepeatingColumnsCount | int | Read/Write | Maximum columns count for the table. |
Broken | TableBroken | Read/Write | How the table breaks across pages. |
IsBroken | bool | Read/Write | Whether the table is allowed to break across pages. |
ColumnAdjustment | ColumnAdjustment | Read/Write | How columns are sized when the table is rendered (API compatibility). |
Rows | Rows | Read | The collection of rows in this table. |
DefaultColumnWidth | string? | Read/Write | Default column-width used when ColumnWidths is empty. |
CornerStyle | BorderCornerStyle | Read/Write | Corner-rounding style applied to the table’s border box. |
IsBordersIncluded | bool | Read/Write | When true, cell-border widths count against cell padding and row-height calculations. |
BreakText | TextFragment? | Read/Write | Optional indicator drawn at the page break when a row is split across pages. |
RepeatingRowsStyle | TextState? | Read/Write | Default text state for the rows repeated on continuation pages (see RepeatingRowsCount). |
Alignment | HorizontalAlignment | Read/Write | Gets or sets how the table is placed across the page’s content width: Center or Right offsets a table narrower than that width; the default Left keeps it at the left margin. |
IsBordersCollapsed | bool | Read/Write | Adjacent cells SHARE one stroke on the boundary between them, the way a collapsed HTML table draws: the boundary carries a single rule centred on it, half of it lying in each of the two cells. |
CellPictureBoxesAreExact | bool | Read/Write | Whether a picture in a cell takes EXACTLY its box – its drawn height plus its own top and bottom margins, seated its left margin in, stacked with the cell’s lines at their own heights – instead of the whole lines of the row’s pitch it reserves by default (a 26.67 pt picture then costs three 12 pt lines). |
SizesColumnsToContent | bool | Read/Write | Sizes the columns from what they HOLD – an automatic table layout. |
StretchesToBand | bool | Read/Write | Stretches a content-sized grid (SizesColumnsToContent) across the whole band. |
FixedLayout | bool | Read/Write | Lays a content-sized grid (SizesColumnsToContent) by its DECLARATIONS alone once it has a width to fill – a fixed table layout, the CSS table-layout: fixed model – and leaves it to the content-sized rules until then. |
BoxWidth | double | Read/Write | The width of the grid’s own box when the caller declared one, in points: the grid is laid in that box instead of the band it stands in, and fills it the way StretchesToBand fills the band. |
RepeatingFooterRowsCount | int | Read/Write | Number of rows at the END of the table that form its FOOTER band. |
RepeatingFooterSkipsLastPage | bool | Read/Write | Makes the footer band a CARRIED-FORWARD band: it closes every page the table runs onto except the one the table ENDS on, and that last page keeps the room the band would have taken. |
RepeatingRowsSkipFirstPage | bool | Read/Write | Makes the repeating rows a CONTINUED-FROM band: the table opens with its body and RepeatingRowsCount rows stand only at the top of the pages it runs ONTO, so the first page gains the room the band would have taken. |
CornerRadii | CornerRadii? | Read/Write | Rounds the grid’s corners (see CornerRadii). |
RowsCloseUnderTheirGlyphs | bool | Read/Write | In a collapsed grid (IsBordersCollapsed), a row the page cannot hold whole stays on it when its lines fit down to the glyphs of its last line – the half leading a declared line box keeps under them left out – with its bottom padding and the grid’s closing rule under them; its box then closes at the page’s bottom and what of it would have fallen past is cut. |
RulesInsideColumnWidth | bool | Read/Write | A column’s declared width is its cells’ WHOLE box, rules included: a cell’s rules stand inside the width its column declares, and its text box is what they and the padding leave – the CSS separated-border model, where a 100 pt column with 0.5 pt rules is 100 wide, its rules on 0..0.5 and 99.5..100 and its text 2.5 in. |
HorizontalCellSpacing | double | Read/Write | The gap between neighbouring cell boxes across the grid, and between the outermost boxes and the grid’s edge – its own border, when it has one – in points: CSS border-spacing, HTML cellspacing. |
VerticalCellSpacing | double | Read/Write | The gap between one row’s cell boxes and the next’s, and between the first and last rows and the grid’s edge, in points – the vertical half of CSS border-spacing. |
SpanHeightFallsOnLastRow | bool | Read/Write | Puts a row-spanning cell’s SURPLUS height on the last row it covers. |
SpanBlockSplitsAtPageBreak | bool | Read/Write | Lets a row-spanning cell be CUT by a page break instead of moving whole to the next page. |
HorizontalAlignment | HorizontalAlignment | Read/Write | Horizontal alignment applied to this paragraph. |
VerticalAlignment | VerticalAlignment | Read/Write | Vertical alignment applied to this paragraph. |
IsFirstParagraphInColumn | bool | Read/Write | Force the paragraph to start a new column. |
IsKeptWithNext | bool | Read/Write | Keep this paragraph on the same page as the next one. |
IsInNewPage | bool | Read/Write | Force the paragraph to start on a new page. |
IsInLineParagraph | bool | Read/Write | Inline paragraph flag (does not start a new line). |
HyperlinkText | string? | Read/Write | Legacy string-typed hyperlink target. |
Hyperlink | Hyperlink? | Read/Write | Typed hyperlink decoration applied to the paragraph. |
ZIndex | int | Read/Write | Z-order index used by the DOM renderer. |
Methods
| Signature | Description |
|---|---|
Table() | Creates an empty table with no rows or columns. |
GetWidth() | Sum of column widths from ColumnWidths. |
GetHeight() | Approximate rendered height of the table, independent of any hosting page. |
GetHeight(parentPage: Page?) | Rendered height of the table on parentPage (or on a default content band when none is given). |
SetColumnTextState(colNumber: int, textState: Aspose.Pdf.Text.TextState) | Apply textState to every cell in the given (0-based) column number. |
Clone() | Shallow clone of the table. |
Build(page: Page) | Build the table content stream bytes for the given page. |
BuildMultiPage(page: Page, startY: double, bottomMargin: double, topMargin: double, measureOnly: bool, contentFlow: bool) | Build the table across multiple pages. |
ImportArray(importedArray: object?[], firstFilledRow: int, firstFilledColumn: int, isLeftColumnsFilled: bool) | Import a one-dimensional object array into the table, wrapping the values into rows by the table’s column count. |
ImportDataTable(importedDataTable: System.Data.DataTable, isColumnNamesImported: bool, firstFilledRow: int, firstFilledColumn: int) | Import all rows of a DataTable. |
ImportDataTable(importedDataTable: System.Data.DataTable, isColumnNamesShown: bool, firstFilledRow: int, firstFilledColumn: byte, maxRows: int, maxColumns: int, isHtmlSupported: bool) | Import with explicit max-rows / max-columns and HTML support flag. |
ImportDataTable(importedDataTable: System.Data.DataTable, sourceRowList: int[], sourceColumnList: int[], firstFilledRow: int, firstFilledColumn: int, showColumnNamesAsFirstRow: bool, isHtmlSupported: bool) | Import a subset of rows / columns selected by index lists. |
ImportDataView(sourceDataView: System.Data.DataView, isColumnNamesImported: bool, firstFilledRow: int, firstFilledColumn: int, maxRows: int, maxColumns: int) | Import a DataView. |
BaseParagraph() | Creates a paragraph with default alignment, an empty margin and no hyperlink. |