Menu

#2 Return a table's height

open
nobody
None
5
2005-10-31
2005-10-31
Ade Vickers
No

Append the following code into pdfTables.cs, underneath
the rowsCount property definition:

/// <summary>
/// Height of this table
/// </summary>
/// <returns>Table height</returns>
public int tableHeight
{
get
{
int rowIndex = 0;
int currentHeight = 0;
if (_tableHeader.visible)
{
currentHeight =
tableHeader.rowHeight;
}
for (rowIndex = 0; rowIndex <
_rows.Count; rowIndex++)
{
currentHeight +=
_rows[rowIndex].rowHeight;
}
return currentHeight;
}
}

You can now examine myTable.tableHeight (after adding
a number of rows). This is useful if you need to position
elements below a table (e.g. another table).

Code was unceremoniously lifted from the cropTable
method.

Discussion


Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.