C# Class iTextSharp.text.Table

A Table is a Rectangle that contains Cells, ordered in some kind of matrix.
Tables that span multiple pages are cut into different parts automatically. If you want a table header to be repeated on every page, you may not forget to mark the end of the header section by using the method EndHeaders().

The matrix of a table is not necessarily an m x n-matrix. It can contain holes or cells that are bigger than the unit. Believe me or not, but it took some serious thinking to make this as userfriendly as possible. I hope you wil find the result quite simple (I love simple solutions, especially for complex problems).

Inheritance: Rectangle, ILargeElement
ファイルを表示 Open project: red-gate/iTextSharp-4.1.6 Class Usage Examples

Protected Properties

Property Type Description
autoFillEmptyCells bool
complete bool
convert2pdfptable bool
notAddedYet bool

Private Properties

Property Type Description
AssumeTableDefaults void
ErrorDimensions void
FillEmptyMatrixCells void
IsValidLocation bool
MergeInsertedTables void
PlaceCell void

Public Methods

Method Description
AddCell ( Cell cell ) : void

Adds a Cell to the Table.

AddCell ( Cell aCell, int row, int column ) : void

Adds a Cell to the Table at a certain row and column.

AddCell ( Cell aCell, object aLocation ) : void

Adds a Cell to the Table at a certain location.

AddCell ( Phrase content ) : void

Adds a Cell to the Table.

This is a shortcut for AddCell(Cell cell). The Phrase will be converted to a Cell.

AddCell ( Phrase content, System location ) : void

Adds a Cell to the Table.

AddCell ( string content ) : void

Adds a Cell to the Table.

This is a shortcut for AddCell(Cell cell). The string will be converted to a Cell.

AddCell ( string content, System location ) : void

Adds a Cell to the Table.

This is a shortcut for AddCell(Cell cell, System.Drawing.Point location). The string will be converted to a Cell.

AddColumns ( int aColumns ) : void

Gives you the posibility to add columns.

Complete ( ) : void

Will fill empty cells with valid blank Cells

CreatePdfPTable ( ) : PdfPTable
DeleteAllRows ( ) : void
DeleteColumn ( int column ) : void

Deletes a column in this table.

DeleteLastRow ( ) : bool

Deletes the last row in this table.

DeleteRow ( int row ) : bool

Deletes a row.

EndHeaders ( ) : int

Marks the last row of the table headers.

FlushContent ( ) : void
GetBottom ( float margin ) : float
GetElement ( int row, int column ) : object

returns the element at the position row, column (Cast to Cell or Table)

GetEnumerator ( ) : IEnumerator

Gets an Iterator of all the Rows.

GetLeft ( float margin ) : float
GetRight ( float margin ) : float
GetTop ( float margin ) : float
GetWidths ( float left, float totalWidth ) : float[]

Gets an array with the positions of the borders between every column.

This method translates the widths expressed in percentages into the x-coordinate of the borders of the columns on a real document.

InsertTable ( Table aTable ) : void

To put a table within the existing table at the current position generateTable will of course re-arrange the widths of the columns.

InsertTable ( Table aTable, System p ) : void

To put a table within the existing table at the given position generateTable will of course re-arrange the widths of the columns.

InsertTable ( Table aTable, int row, int column ) : void

To put a table within the existing table at the given position generateTable will of course re-arrange the widths of the columns.

IsNestable ( ) : bool
Process ( IElementListener listener ) : bool

Processes the element by adding it (or the different parts) to an IElementListener.

SetAlignment ( string alignment ) : void

Sets the alignment of this paragraph.

SetWidths ( int widths ) : void

Sets the widths of the different columns (percentages).

You can give up relative values of borderwidths. The sum of these values will be considered 100%. The values will be recalculated as percentages of this sum.

Table ( int columns ) : System

Constructs a Table with a certain number of columns.

Table ( int columns, int rows ) : System

Constructs a Table with a certain number of columns and a certain number of Rows.

Private Methods

Method Description
AssumeTableDefaults ( Cell aCell ) : void

Sets the unset cell properties to be the table defaults.

ErrorDimensions ( ) : void
FillEmptyMatrixCells ( ) : void

Integrates all added tables and recalculates column widths.

IsValidLocation ( Cell aCell, System aLocation ) : bool

check if Cell 'fits' the table.

  • rowspan/colspan not beyond borders
  • spanned cell don't overlap existing cells
MergeInsertedTables ( ) : void

Integrates all added tables and recalculates column widths.

PlaceCell ( ArrayList someRows, Cell aCell, System aPosition ) : void

Inserts a Cell in a cell-array and reserves cells defined by row-/colspan.

Method Details

AddCell() public method

Adds a Cell to the Table.
public AddCell ( Cell cell ) : void
cell Cell a Cell
return void

AddCell() public method

Adds a Cell to the Table at a certain row and column.
public AddCell ( Cell aCell, int row, int column ) : void
aCell Cell The Cell to add
row int The row where the Cell will be added
column int The column where the Cell will be added
return void

AddCell() public method

Adds a Cell to the Table at a certain location.
public AddCell ( Cell aCell, object aLocation ) : void
aCell Cell The Cell to add
aLocation object The location where the Cell will be added
return void

AddCell() public method

Adds a Cell to the Table.
This is a shortcut for AddCell(Cell cell). The Phrase will be converted to a Cell.
public AddCell ( Phrase content ) : void
content Phrase a Phrase
return void

AddCell() public method

Adds a Cell to the Table.
public AddCell ( Phrase content, System location ) : void
content Phrase a Phrase
location System a System.Drawing.Point
return void

AddCell() public method

Adds a Cell to the Table.
This is a shortcut for AddCell(Cell cell). The string will be converted to a Cell.
public AddCell ( string content ) : void
content string a string
return void

AddCell() public method

Adds a Cell to the Table.
This is a shortcut for AddCell(Cell cell, System.Drawing.Point location). The string will be converted to a Cell.
public AddCell ( string content, System location ) : void
content string a string
location System a point
return void

AddColumns() public method

Gives you the posibility to add columns.
public AddColumns ( int aColumns ) : void
aColumns int the number of columns to add
return void

Complete() public method

Will fill empty cells with valid blank Cells
public Complete ( ) : void
return void

CreatePdfPTable() public method

public CreatePdfPTable ( ) : PdfPTable
return iTextSharp.text.pdf.PdfPTable

DeleteAllRows() public method

public DeleteAllRows ( ) : void
return void

DeleteColumn() public method

Deletes a column in this table.
public DeleteColumn ( int column ) : void
column int the number of the column that has to be deleted
return void

DeleteLastRow() public method

Deletes the last row in this table.
public DeleteLastRow ( ) : bool
return bool

DeleteRow() public method

Deletes a row.
public DeleteRow ( int row ) : bool
row int the number of the row to delete
return bool

EndHeaders() public method

Marks the last row of the table headers.
public EndHeaders ( ) : int
return int

FlushContent() public method

public FlushContent ( ) : void
return void

GetBottom() public method

public GetBottom ( float margin ) : float
margin float
return float

GetElement() public method

returns the element at the position row, column (Cast to Cell or Table)
public GetElement ( int row, int column ) : object
row int
column int
return object

GetEnumerator() public method

Gets an Iterator of all the Rows.
public GetEnumerator ( ) : IEnumerator
return IEnumerator

GetLeft() public method

public GetLeft ( float margin ) : float
margin float
return float

GetRight() public method

public GetRight ( float margin ) : float
margin float
return float

GetTop() public method

public GetTop ( float margin ) : float
margin float
return float

GetWidths() public method

Gets an array with the positions of the borders between every column.
This method translates the widths expressed in percentages into the x-coordinate of the borders of the columns on a real document.
public GetWidths ( float left, float totalWidth ) : float[]
left float this is the position of the first border at the left (cellpadding not included)
totalWidth float /// this is the space between the first border at the left /// and the last border at the right (cellpadding not included) ///
return float[]

InsertTable() public method

To put a table within the existing table at the current position generateTable will of course re-arrange the widths of the columns.
public InsertTable ( Table aTable ) : void
aTable Table the table you want to insert
return void

InsertTable() public method

To put a table within the existing table at the given position generateTable will of course re-arrange the widths of the columns.
public InsertTable ( Table aTable, System p ) : void
aTable Table the table you want to insert
p System
return void

InsertTable() public method

To put a table within the existing table at the given position generateTable will of course re-arrange the widths of the columns.
public InsertTable ( Table aTable, int row, int column ) : void
aTable Table The Table to add
row int The row where the Cell will be added
column int The column where the Cell will be added
return void

IsNestable() public method

public IsNestable ( ) : bool
return bool

Process() public method

Processes the element by adding it (or the different parts) to an IElementListener.
public Process ( IElementListener listener ) : bool
listener IElementListener an IElementListener
return bool

SetAlignment() public method

Sets the alignment of this paragraph.
public SetAlignment ( string alignment ) : void
alignment string the new alignment as a string
return void

SetWidths() public method

Sets the widths of the different columns (percentages).
You can give up relative values of borderwidths. The sum of these values will be considered 100%. The values will be recalculated as percentages of this sum.
public SetWidths ( int widths ) : void
widths int an array with values
return void

Table() public method

Constructs a Table with a certain number of columns.
public Table ( int columns ) : System
columns int The number of columns in the table
return System

Table() public method

Constructs a Table with a certain number of columns and a certain number of Rows.
public Table ( int columns, int rows ) : System
columns int The number of columns in the table
rows int The number of rows
return System

Property Details

autoFillEmptyCells protected_oe property

Boolean to automatically fill empty cells before a table is rendered (takes CPU so may be set to false in case of certainty)
protected bool autoFillEmptyCells
return bool

complete protected_oe property

protected bool complete
return bool

convert2pdfptable protected_oe property

protected bool convert2pdfptable
return bool

notAddedYet protected_oe property

protected bool notAddedYet
return bool