C# Класс 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).

Наследование: Rectangle, ILargeElement
Показать файл Открыть проект Примеры использования класса

Защищенные свойства (Protected)

Свойство Тип Описание
autoFillEmptyCells bool
complete bool
convert2pdfptable bool
notAddedYet bool

Private Properties

Свойство Тип Описание
AssumeTableDefaults void
ErrorDimensions void
FillEmptyMatrixCells void
IsValidLocation bool
MergeInsertedTables void
PlaceCell void

Открытые методы

Метод Описание
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.

Приватные методы

Метод Описание
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.

Описание методов

AddCell() публичный метод

Adds a Cell to the Table.
public AddCell ( Cell cell ) : void
cell Cell a Cell
Результат void

AddCell() публичный метод

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
Результат void

AddCell() публичный метод

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
Результат void

AddCell() публичный метод

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
Результат void

AddCell() публичный метод

Adds a Cell to the Table.
public AddCell ( Phrase content, System location ) : void
content Phrase a Phrase
location System a System.Drawing.Point
Результат void

AddCell() публичный метод

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
Результат void

AddCell() публичный метод

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
Результат void

AddColumns() публичный метод

Gives you the posibility to add columns.
public AddColumns ( int aColumns ) : void
aColumns int the number of columns to add
Результат void

Complete() публичный метод

Will fill empty cells with valid blank Cells
public Complete ( ) : void
Результат void

CreatePdfPTable() публичный метод

public CreatePdfPTable ( ) : PdfPTable
Результат iTextSharp.text.pdf.PdfPTable

DeleteAllRows() публичный метод

public DeleteAllRows ( ) : void
Результат void

DeleteColumn() публичный метод

Deletes a column in this table.
public DeleteColumn ( int column ) : void
column int the number of the column that has to be deleted
Результат void

DeleteLastRow() публичный метод

Deletes the last row in this table.
public DeleteLastRow ( ) : bool
Результат bool

DeleteRow() публичный метод

Deletes a row.
public DeleteRow ( int row ) : bool
row int the number of the row to delete
Результат bool

EndHeaders() публичный метод

Marks the last row of the table headers.
public EndHeaders ( ) : int
Результат int

FlushContent() публичный метод

public FlushContent ( ) : void
Результат void

GetBottom() публичный метод

public GetBottom ( float margin ) : float
margin float
Результат float

GetElement() публичный метод

returns the element at the position row, column (Cast to Cell or Table)
public GetElement ( int row, int column ) : object
row int
column int
Результат object

GetEnumerator() публичный метод

Gets an Iterator of all the Rows.
public GetEnumerator ( ) : IEnumerator
Результат IEnumerator

GetLeft() публичный метод

public GetLeft ( float margin ) : float
margin float
Результат float

GetRight() публичный метод

public GetRight ( float margin ) : float
margin float
Результат float

GetTop() публичный метод

public GetTop ( float margin ) : float
margin float
Результат float

GetWidths() публичный метод

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) ///
Результат float[]

InsertTable() публичный метод

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
Результат void

InsertTable() публичный метод

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
Результат void

InsertTable() публичный метод

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
Результат void

IsNestable() публичный метод

public IsNestable ( ) : bool
Результат bool

Process() публичный метод

Processes the element by adding it (or the different parts) to an IElementListener.
public Process ( IElementListener listener ) : bool
listener IElementListener an IElementListener
Результат bool

SetAlignment() публичный метод

Sets the alignment of this paragraph.
public SetAlignment ( string alignment ) : void
alignment string the new alignment as a string
Результат void

SetWidths() публичный метод

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
Результат void

Table() публичный метод

Constructs a Table with a certain number of columns.
public Table ( int columns ) : System
columns int The number of columns in the table
Результат System

Table() публичный метод

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
Результат System

Описание свойств

autoFillEmptyCells защищенное свойство

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
Результат bool

complete защищенное свойство

protected bool complete
Результат bool

convert2pdfptable защищенное свойство

protected bool convert2pdfptable
Результат bool

notAddedYet защищенное свойство

protected bool notAddedYet
Результат bool