cete.dynamicpdf.pageelements.table2
Table2
- Namespace: ceTe.DynamicPDF.PageElements
- Assemblies: DynamicPDF.CoreSuite.dll
Represents a table with rows, columns and cells.
public class Table2 : RotatingPageElement, IArea, ICoordinate, ISerializable
Public Class Table2
Inherits RotatingPageElement
Implements IArea, ICoordinate, ISerializable
Inheritance: Object → PageElement → TaggablePageElement → RotatingPageElement → Table2
Implements: IArea, ICoordinate, ISerializable
Examples
The following example will display a simple table on the page.
Imports System
Imports ceTe.DynamicPDF
Imports ceTe.DynamicPDF.PageElements
Module MyModule
Sub Main()
' Create a PDF Document
Dim MyDocument As Document = New Document
' Create a Page and add it to the document
Dim MyPage As Page = New Page
MyDocument.Pages.Add(MyPage)
' Create a table
Dim MyTable As Table = New Table(0, 0, 600, 600)
' Add columns to the table
MyTable.Columns.Add(150)
MyTable.Columns.Add(90)
MyTable.Columns.Add(90)
MyTable.Columns.Add(90)
' Add rows to the table and add cells to the rows
Dim row1 As Row = MyTable.Rows.Add(40, ceTe.DynamicPDF.Font.HelveticaBold, _
16, Grayscale.Black, Grayscale.Gray)
row1.Align = TextAlign.Center
row1.VAlign = VAlign.Center
row1.Cells.Add("Header 1")
row1.Cells.Add("Header 2")
row1.Cells.Add("Header 3")
row1.Cells.Add("Header 4")
Dim row2 As Row = MyTable.Rows.Add(30)
Dim cell1 As Cell = row2.Cells.Add("Rowheader 1", Font.HelveticaBold, 16, _
Grayscale.Black, Grayscale.Gray, 1)
cell1.Align = CellAlign.Center
cell1.VAlign = CellVAlign.Center
row2.Cells.Add("Item 1")
row2.Cells.Add("Item 2")
row2.Cells.Add("Item 3")
Dim row3 As Row = MyTable.Rows.Add(30)
Dim cell2 As Cell = row3.Cells.Add("Rowheader 2", Font.HelveticaBold, 16, _
Grayscale.Black, Grayscale.Gray, 1)
cell2.Align = CellAlign.Center
cell2.VAlign = CellVAlign.Center
row3.Cells.Add("Item 4")
row3.Cells.Add("Item 5")
row3.Cells.Add("Item 6")
' Add the table to the page
MyPage.Elements.Add(MyTable)
' Save the PDF
MyDocument.Draw("C:\MyDocument.pdf")
End Sub
End Module
using System;
using ceTe.DynamicPDF;
using ceTe.DynamicPDF.PageElements;
public class Example
{
public static void CreatePDF(string outputPath)
{
// Create a PDF Document
Document document = new Document();
// Create a Page and add it to the document
Page page = new Page();
document.Pages.Add(page);
// Create a table
Table2 table = new Table2(0, 0, 600, 600);
//Add columns to the table
Column2 column1 = table.Columns.Add(150);
column1.CellDefault.Align = TextAlign.Center;
table.Columns.Add(90);
table.Columns.Add(90);
table.Columns.Add(90);
// Add rows to the table and add cells to the rows
Row2 row1 = table.Rows.Add(40, Font.HelveticaBold, 16, Grayscale.Black,
Grayscale.Gray);
row1.CellDefault.Align = TextAlign.Center;
row1.CellDefault.VAlign = VAlign.Center;
row1.Cells.Add("Header 1");
row1.Cells.Add("Header 2");
row1.Cells.Add("Header 3");
row1.Cells.Add("Header 4");
Row2 row2 = table.Rows.Add(30);
Cell2 cell1 = row2.Cells.Add("Rowheader 1", Font.HelveticaBold, 16,
Grayscale.Black, Grayscale.Gray, 1);
cell1.Align = TextAlign.Center;
cell1.VAlign = VAlign.Center;
row2.Cells.Add("Item 1");
row2.Cells.Add("Item 2");
row2.Cells.Add("Item 3");
Row2 row3 = table.Rows.Add(30);
Cell2 cell2 = row3.Cells.Add("Rowheader 2", Font.HelveticaBold, 16,
Grayscale.Black, Grayscale.Gray, 1);
cell2.Align = TextAlign.Center;
cell2.VAlign = VAlign.Center;
row3.Cells.Add("Item 4");
row3.Cells.Add("Item 5");
row3.Cells.Add("Item 6");
table.CellDefault.Padding.Value = 5.0f;
table.CellSpacing = 5.0f;
table.Border.Top.Color = RgbColor.Blue;
table.Border.Bottom.Color = RgbColor.Blue;
table.Border.Top.Width = 2;
table.Border.Bottom.Width = 2;
table.Border.Left.LineStyle = LineStyle.None;
table.Border.Right.LineStyle = LineStyle.None;
// Add the table to the page
page.Elements.Add(table);
// Save the PDF
document.Draw(outputPath);
}
}
Remarks
This class can be used to create tables. A table must contain at least one Column and one Row with at least one Cell in that Row. Formatting of each cell in the table is done in a hierarchical manner in that a Cell's formatting take precedent over a Row's formatting which in term takes precedent over a Column's formatting which in term takes precedent over a Table's formatting . Using the AdvancedTables GetOverflowColumns and GetOverflowRows methods you can allow your table to easily flow onto other pages. See the Tables topic for more on tables.
Constructors
Table2(Single, Single, Single, Single)
Initializes a new instance of the Table2 class.
public Table2(float x, float y, float width, float height)
Public Sub New (x As Single, y As Single, width As Single, height As Single)
Parameters
- x: Single
X coordinate of the table.
- y: Single
Y coordinate of the table.
- width: Single
Width of the table.
- height: Single
Height of the table.
Table2(Single, Single, Single, Single, Font, Single?)
Initializes a new instance of the Table2 class.
public Table2(float x, float y, float width, float height, Font font, float? fontSize)
Public Sub New (x As Single, y As Single, width As Single, height As Single, font As Font, fontSize As Single?)
Parameters
- x: Single
X coordinate of the table.
- y: Single
Y coordinate of the table.
- width: Single
Width of the table.
- height: Single
Height of the table.
- font: Font
Font for the text in the table.
- fontSize: Single?
Font size for the text in the table.
Table2(Single, Single, Single, Single, Font, Single?, Color, Color)
Initializes a new instance of the Table2 class.
public Table2(float x, float y, float width, float height, Font font, float? fontSize, Color textColor, Color backColor)
Public Sub New (x As Single, y As Single, width As Single, height As Single, font As Font, fontSize As Single?, textColor As Color, backColor As Color)
Parameters
- x: Single
X coordinate of the table.
- y: Single
Y coordinate of the table.
- width: Single
Width of the table.
- height: Single
Height of the table.
- font: Font
Font for the text in the table.
- fontSize: Single?
Font size for the text in the table.
- textColor: Color
Color of the text in the table.
- backColor: Color
Background color of the table.
Properties
Angle
Gets or sets the heights of the angle element. (Inherited from RotatingPageElement)
public float Angle { get; set; }
Public Property Angle As Single
Property Value
BackgroundColor
Gets the Color object to use for the background of the table.
public Color BackgroundColor { get; set; }
Public Property BackgroundColor As Color
Property Value
Border
Gets the Border object to use for the border of the table.
public Border Border { get; }
Public Property Border As Border
Property Value
CellDefault
Gets the CellDefault object of the cells in the table.
public CellDefault CellDefault { get; }
Public Property CellDefault As CellDefault
Property Value
CellSpacing
Gets or sets the cellSpacing for the cells in the table.
public float CellSpacing { get; set; }
Public Property CellSpacing As Single
Property Value
Columns
Gets the Column2List object contained in the table.
public Column2List Columns { get; }
Public Property Columns As Column2List
Property Value
Height
Gets or sets the height of the table.
public float Height { get; set; }
Public Property Height As Single
Property Value
ID
Gets or sets the ID of the page element. (Inherited from PageElement)
public string ID { get; set; }
Public Property ID As String
Property Value
IgnoreMargins
Gets or sets ignore margin property. Setting false will consider the margin while placing the page element based on the RelativeTo property. (Inherited from PageElement)
public bool IgnoreMargins { get; set; }
Public Property IgnoreMargins As Boolean
Property Value
Examples
The following example will place the Label in the top-left of the page with IgnoreMargin
using ceTe.DynamicPDF;
using ceTe.DynamicPDF.PageElements;
public class Example
{
public static void CreatePDF(string outputPath)
{
// Create a PDF Document
Document document = new Document();
// Create a Page and add it to the document
Page page = new Page();
document.Pages.Add(page); // Create an Label and place it in page top left with margin ignored
Label label = new Label("I am placed in Page top left with margin ignored", 0, 0, 160, 30);
label.RelativeTo = RelativeTo.TopLeft;
label.IgnoreMargin=true; page.Elements.Add(label);
// Save the PDF
document.Draw(outputPath);
}
}
RelativeTo
Gets and sets placement of the page element on the page. (Inherited from PageElement)
public RelativeTo RelativeTo { get; set; }
Public Property RelativeTo As RelativeTo
Property Value
Examples
The following example will place the Label in the top-left of the page.
using ceTe.DynamicPDF;
using ceTe.DynamicPDF.PageElements;
public class Example
{
public static void CreatePDF(string outputPath)
{
// Create a PDF Document
Document document = new Document();
// Create a Page and add it to the document
Page page = new Page();
document.Pages.Add(page); // Create an Label and place it in page top left with margin
Label label = new Label("I am placed in Page top left with margin.", 0, 0, 160, 30);
label.RelativeTo = RelativeTo.TopLeft;
page.Elements.Add(label);
// Save the PDF
document.Draw(outputPath);
}
}
RepeatColumnHeaderCount
Gets or sets the number of initial rows in the table that should also be drawn as the first rows on all subsequent row overflow tables. This is set to 0 by default.
public int RepeatColumnHeaderCount { get; set; }
Public Property RepeatColumnHeaderCount As Int32
Property Value
RepeatRowHeaderCount
Gets or sets the number of columns that will be repeated as the row header. This number is only considered if RepeatColumnHeader is set to true. This is set to 1 by default.
public int RepeatRowHeaderCount { get; set; }
Public Property RepeatRowHeaderCount As Int32
Property Value
Rows
Gets the Row2List object contained in the table.
public Row2List Rows { get; }
Public Property Rows As Row2List
Property Value
Tag
Gets or sets the tag of the taggable element. (Inherited from TaggablePageElement)
public Tag Tag { get; set; }
Public Property Tag As Tag
Property Value
TagOrder
Gets or sets the tag order of the taggable element. (Inherited from TaggablePageElement)
public int TagOrder { get; set; }
Public Property TagOrder As Int32
Property Value
VisibleStartColumn
Returns the table starting column number.
public int VisibleStartColumn { get; }
Public Property VisibleStartColumn As Int32
Property Value
VisibleStartRow
Returns the table starting row number.
public int VisibleStartRow { get; }
Public Property VisibleStartRow As Int32
Property Value
Width
Gets or sets the width of the table.
public float Width { get; set; }
Public Property Width As Single
Property Value
X
Gets or sets the X coordinate of the page element. (Inherited from RotatingPageElement)
public float X { get; set; }
Public Property X As Single
Property Value
Y
Gets or sets the Y coordinate of the page element. (Inherited from RotatingPageElement)
public float Y { get; set; }
Public Property Y As Single
Property Value
Methods
Draw(PageWriter)
Draws the page element to the given PageWriter object. (Inherited from RotatingPageElement)
public void Draw(PageWriter writer)
Sub Draw(writer As PageWriter)
Parameters
- writer: PageWriter
PageWriter object to receive the page element's output.
Equals(Object)
Determines whether the specified Object is equal to the current Object . (Inherited from Object)
public bool Equals(Object obj)
Function Equals(obj As Object) As Boolean
Parameters
- obj: Object
The Object to compare with the current Object .
Returns
true if the specified Object is equal to the current Object ; otherwise, false.
GetHashCode()
Serves as a hash function for a particular type. (Inherited from Object)
public int GetHashCode()
Function GetHashCode() As Integer
Returns
A hash code for the current Object .
GetOverflowColumns()
Returns a Table2 object containing the overflow columns.
public Table2 GetOverflowColumns()
Function GetOverflowColumns() As Table2
Returns
Returns a Table2 object.
Examples
The following example shows you how to use the GetOverflowColumns method to allow tables of variable length to flow onto new pages as needed.
Imports System
Imports ceTe.DynamicPDF
Imports ceTe.DynamicPDF.PageElements
Module MyModule
Sub Main()
' Create a PDF Document
Dim MyDocument As Document = New Document
Dim MyTable As Table = New Table(0, 0, 500, 50)
' Create some number of columns
Dim Cols As Integer = 50
Dim Int As Integer
For Int = 0 To Cols
MyTable.Columns.Add(100)
Next
' Create your rows to fill in
Dim MyRow1 As Row = MyTable.Rows.Add(20)
Dim MyRow2 As Row = MyTable.Rows.Add(20)
Dim J As Integer
For J = 1 To Cols
MyRow1.Cells.Add("Column #" & J)
MyRow2.Cells.Add("Item")
Next
Do
Dim MyPage As Page = New Page
MyDocument.Pages.Add(MyPage)
MyPage.Elements.Add(MyTable)
MyTable = MyTable.GetOverflowColumns()
Loop While Not (MyTable Is Nothing)
' Save the PDF
MyDocument.Draw("C:\MyDocument.pdf")
End Sub
End Module
using System;
using ceTe.DynamicPDF;
using ceTe.DynamicPDF.PageElements;
public class Example
{
public static void CreatePDF(string outputPath)
{
// Create a PDF Document
Document document = new Document();
Table2 table = new Table2( 0, 0, 500, 50 );
// Create some number of columns
int columnCount = 50;
for( int i = 0; i <= columnCount; i++ )
table.Columns.Add( 100 );
// Create your rows to fill in
Row2 row1 = table.Rows.Add( 20 );
Row2 row2 = table.Rows.Add( 20 );
for( int j = 0; j <= columnCount; j++ )
{
row1.Cells.Add( "Column #" + j );
row2.Cells.Add( "Item" );
}
do
{
Page page = new Page();
document.Pages.Add( page );
page.Elements.Add( table );
table = table.GetOverflowColumns();
} while ( table != null );
// Save the PDF
document.Draw( outputPath );
}
}
Remarks
This method returns a new Table2 object that contains the remaining columns that did not fit.
GetOverflowColumns(Single, Single)
Returns a Table2 object containing the overflow columns.
public Table2 GetOverflowColumns(float x, float y)
Function GetOverflowColumns(x As Single, y As Single) As Table2
Parameters
- x: Single
X coordinate of the new table.
- y: Single
Y coordinate of the new table.
Returns
Returns a Table2 object.
Examples
The following example shows you how to use the GetOverflowColumns method to allow tables of variable length to flow onto new pages as needed.
Imports System
Imports ceTe.DynamicPDF
Imports ceTe.DynamicPDF.PageElements
Module MyModule
Sub Main()
' Create a PDF Document
Dim MyDocument As Document = New Document
Dim MyTable As Table = New Table(0, 0, 500, 50)
' Create some number of columns
Dim Cols As Integer = 50
Dim Int As Integer
For Int = 0 To Cols
MyTable.Columns.Add(100)
Next
' Create your rows to fill in
Dim MyRow1 As Row = MyTable.Rows.Add(20)
Dim MyRow2 As Row = MyTable.Rows.Add(20)
Dim J As Integer
For J = 1 To Cols
MyRow1.Cells.Add("Column #" & J)
MyRow2.Cells.Add("Item")
Next
Do
Dim MyPage As Page = New Page
MyDocument.Pages.Add(MyPage)
MyPage.Elements.Add(MyTable)
MyTable = MyTable.GetOverflowColumns(50, 50)
Loop While Not (MyTable Is Nothing)
' Save the PDF
MyDocument.Draw("C:\MyDocument.pdf")
End Sub
End Module
using System;
using ceTe.DynamicPDF;
using ceTe.DynamicPDF.PageElements;
public class Example
{
public static void CreatePDF(string outputPath)
{
// Create a PDF Document
Document document = new Document();
Table2 table = new Table2( 0, 0, 500, 50 );
// Create some number of columns
int columnCount = 50;
for( int i = 0; i <= columnCount; i++ )
table.Columns.Add( 100 );
// Create your rows to fill in
Row2 row1 = table.Rows.Add( 20 );
Row2 row2 = table.Rows.Add( 20 );
for( int j = 0; j <= columnCount; j++ )
{
row1.Cells.Add( "Column #" + j );
row2.Cells.Add( "Item" );
}
do
{
Page page = new Page();
document.Pages.Add( page );
page.Elements.Add( table );
table = table.GetOverflowColumns( 50, 50 );
} while ( table != null );
// Save the PDF
document.Draw( outputPath );
}
}
Remarks
This method returns a new Table2 object that contains the remaining columns that did not fit. This new table will be assigned the specified values for x and y.
GetOverflowColumns(Single, Single, Single, Single)
Returns a Table2 object containing the overflow columns.
public Table2 GetOverflowColumns(float x, float y, float width, float height)
Function GetOverflowColumns(x As Single, y As Single, width As Single, height As Single) As Table2
Parameters
- x: Single
X coordinate of the new table.
- y: Single
Y coordinate of the new table.
- width: Single
Width of the new table.
- height: Single
Height of the new table.
Returns
Returns a Table2 object.
Examples
The following example shows you how to use the GetOverflowColumns method to allow tables of variable length to flow onto new pages as needed.
Imports System
Imports ceTe.DynamicPDF
Imports ceTe.DynamicPDF.PageElements
Module MyModule
Sub Main()
' Create a PDF Document
Dim MyDocument As Document = New Document
Dim MyTable As Table = New Table(0, 0, 500, 50)
' Create some number of columns
Dim Cols As Integer = 50
Dim Int As Integer
For Int = 0 To Cols
MyTable.Columns.Add(100)
Next
' Create your rows to fill in
Dim MyRow1 As Row = MyTable.Rows.Add(20)
Dim MyRow2 As Row = MyTable.Rows.Add(20)
Dim J As Integer
For J = 1 To Cols
MyRow1.Cells.Add("Column #" & J)
MyRow2.Cells.Add("Item")
Next
Do
Dim MyPage As Page = New Page
MyDocument.Pages.Add(MyPage)
MyPage.Elements.Add(MyTable)
MyTable = MyTable.GetOverflowColumns(50, 50, 250, 50)
Loop While Not (MyTable Is Nothing)
' Save the PDF
MyDocument.Draw("C:\MyDocument.pdf")
End Sub
End Module
using System;
using ceTe.DynamicPDF;
using ceTe.DynamicPDF.PageElements;
public class Example
{
public static void CreatePDF(string outputPath)
{
// Create a PDF Document
Document document = new Document();
Table2 table = new Table2( 0, 0, 500, 50 );
// Create some number of columns
int columnCount = 50;
for( int i = 0; i <= columnCount; i++ )
table.Columns.Add( 100 );
// Create your rows to fill in
Row2 row1 = table.Rows.Add( 20 );
Row2 row2 = table.Rows.Add( 20 );
for( int j = 0; j <= columnCount; j++ )
{
row1.Cells.Add( "Column #" + j );
row2.Cells.Add( "Item" );
}
do
{
Page page = new Page();
document.Pages.Add( page );
page.Elements.Add( table );
table = table.GetOverflowColumns( 50, 50, 250, 50 );
} while ( table != null );
// Save the PDF
document.Draw( outputPath );
}
}
Remarks
This method returns a new Table2 object that contains the remaining columns that did not fit. This new table will be assigned the specified values for x, y, height and width.
GetOverflowRows()
Returns a Table2 object containing the overflow rows.
public Table2 GetOverflowRows()
Function GetOverflowRows() As Table2
Returns
Returns a Table2 object.
Examples
The following example shows you how to use the GetOverflowRows method to allow tables of variable length to flow onto new pages as needed.
Imports System
Imports ceTe.DynamicPDF
Imports ceTe.DynamicPDF.PageElements
Module MyModule
Sub Main()
' Create a PDF Document
Dim MyDocument As Document = New Document
Dim MyTable As Table = New Table(0, 0, 200, 700)
MyTable.Columns.Add(100)
MyTable.Columns.Add(100)
' This loop populates the table
Dim I As Integer
For I = 1 To 400
Dim MyRow As Row = MyTable.Rows.Add(20)
MyRow.Cells.Add("Row #" & I)
MyRow.Cells.Add("Item")
Next
Do
Dim MyPage As Page = New Page
MyDocument.Pages.Add(MyPage)
MyPage.Elements.Add(MyTable)
MyTable = MyTable.GetOverflowRows()
Loop While Not (MyTable Is Nothing)
' Save the PDF
MyDocument.Draw("C:\MyDocument.pdf")
End Sub
End Module
using System;
using ceTe.DynamicPDF;
using ceTe.DynamicPDF.PageElements;
public class Example
{
public static void CreatePDF(string outputPath)
{
// Create a PDF Document
Document document = new Document();
Table2 table = new Table2( 0, 0, 200, 700 );
table.Columns.Add( 100 );
table.Columns.Add( 100 );
// This loop populates the table
for ( int i = 1; i <= 400; i++ )
{
Row2 row = table.Rows.Add( 20 );
row.Cells.Add( "Row #" + i );
row.Cells.Add( "Item" );
}
do
{
Page page = new Page();
document.Pages.Add( page );
page.Elements.Add( table );
table = table.GetOverflowRows();
} while ( table != null );
// Save the PDF
document.Draw( outputPath );
}
}
Remarks
This method returns a new Table2 object that contains the remaining rows that did not fit.
GetOverflowRows(Single, Single)
Returns a Table2 object containing the overflow rows.
public Table2 GetOverflowRows(float x, float y)
Function GetOverflowRows(x As Single, y As Single) As Table2
Parameters
- x: Single
X coordinate of the new table.
- y: Single
Y coordinate of the new table.
Returns
Returns a Table2 object.
Examples
The following example shows you how to use the GetOverflowRows method to allow tables of variable length to flow onto new pages as needed.
Imports System
Imports ceTe.DynamicPDF
Imports ceTe.DynamicPDF.PageElements
Module MyModule
Sub Main()
' Create a PDF Document
Dim MyDocument As Document = New Document
Dim MyTable As Table = New Table(0, 0, 200, 700)
MyTable.Columns.Add(100)
MyTable.Columns.Add(100)
' This loop populates the table
Dim I As Integer
For I = 1 To 400
Dim MyRow As Row = MyTable.Rows.Add(20)
MyRow.Cells.Add("Row #" & I)
MyRow.Cells.Add("Item")
Next
Do
Dim MyPage As Page = New Page
MyDocument.Pages.Add(MyPage)
MyPage.Elements.Add(MyTable)
MyTable = MyTable.GetOverflowRows(50, 50)
Loop While Not (MyTable Is Nothing)
' Save the PDF
MyDocument.Draw("C:\MyDocument.pdf")
End Sub
End Module
using System;
using ceTe.DynamicPDF;
using ceTe.DynamicPDF.PageElements;
public class Example
{
public static void CreatePDF(string outputPath)
{
// Create a PDF Document
Document document = new Document();
Table2 table = new Table2( 0, 0, 200, 700 );
table.Columns.Add( 100 );
table.Columns.Add( 100 );
// This loop populates the table
for ( int i = 1; i <= 400; i++ )
{
Row2 row = table.Rows.Add( 20 );
row.Cells.Add( "Row #" + i );
row.Cells.Add( "Item" );
}
do
{
Page page = new Page();
document.Pages.Add( page );
page.Elements.Add( table );
table = table.GetOverflowRows( 30, 30 );
} while ( table != null );
// Save the PDF
document.Draw( outputPath );
}
}
Remarks
This method returns a new Table2 object that contains the remaining rows that did not fit. This new table will be assigned the specified values for x and y.
GetOverflowRows(Single, Single, Single, Single)
Returns a Table2 object containing the overflow rows.
public Table2 GetOverflowRows(float x, float y, float width, float height)
Function GetOverflowRows(x As Single, y As Single, width As Single, height As Single) As Table2
Parameters
- x: Single
X coordinate of the new table.
- y: Single
Y coordinate of the new table.
- width: Single
Width of the new table.
- height: Single
Height of the new table.
Returns
Returns a Table2 object.
Examples
The following example shows you how to use the GetOverflowRows method to allow tables of variable length to flow onto new pages as needed.
Imports System
Imports ceTe.DynamicPDF
Imports ceTe.DynamicPDF.PageElements
Module MyModule
Sub Main()
' Create a PDF Document
Dim MyDocument As Document = New Document
Dim MyTable As Table = New Table(0, 0, 200, 700)
MyTable.Columns.Add(100)
MyTable.Columns.Add(100)
' This loop populates the table
Dim I As Integer
For I = 1 To 400
Dim MyRow As Row = MyTable.Rows.Add(20)
MyRow.Cells.Add("Row #" & I)
MyRow.Cells.Add("Item")
Next
Do
Dim MyPage As Page = New Page
MyDocument.Pages.Add(MyPage)
MyPage.Elements.Add(MyTable)
MyTable = MyTable.GetOverflowRows(50, 50, 200, 350)
Loop While Not (MyTable Is Nothing)
' Save the PDF
MyDocument.Draw("C:\MyDocument.pdf")
End Sub
End Module
using System;
using ceTe.DynamicPDF;
using ceTe.DynamicPDF.PageElements;
public class Example
{
public static void CreatePDF(string outputPath)
{
// Create a PDF Document
Document document = new Document();
Table2 table = new Table2( 0, 0, 200, 700 );
table.Columns.Add( 100 );
table.Columns.Add( 100 );
// This loop populates the table
for ( int i = 1; i <= 400; i++ )
{
Row2 row = table.Rows.Add( 20 );
row.Cells.Add( "Row #" + i );
row.Cells.Add( "Item" );
}
do
{
Page page = new Page();
document.Pages.Add( page );
page.Elements.Add( table );
table = table.GetOverflowRows( 50, 50, 200, 350 );
} while ( table != null );
// Save the PDF
document.Draw( outputPath );
}
}
Remarks
This method returns a new Table2 object that contains the remaining rows that did not fit. This new table will be assigned the specified values for x, y, height and width.
GetRequiredHeight()
Returns the height required to vertically fit the entire table on the page.
public float GetRequiredHeight()
Function GetRequiredHeight() As Single
Returns
The height to fit the entire table on the page vertically.
GetRequiredWidth()
Returns the width required to horizontally fit the entire table (all the columns) on the page.
public float GetRequiredWidth()
Function GetRequiredWidth() As Single
Returns
The width to fit the entire table on the page horizontally.
GetType()
Gets the Type of the current instance. (Inherited from Object)
public Type GetType()
Function GetType() As Type
Returns
The Type instance that represents the exact runtime type of the current instance.
GetVisibleColumnCount()
Returns the number of columns that will be displayed in the current table.
public int GetVisibleColumnCount()
Function GetVisibleColumnCount() As Integer
Returns
The number are columns that will display.
GetVisibleHeight()
Returns the height of the table that will be seen on the page.
public float GetVisibleHeight()
Function GetVisibleHeight() As Single
Returns
The height of all visible text of the table.
GetVisibleRowCount()
Returns the number of rows that will be displayed in the current table.
public int GetVisibleRowCount()
Function GetVisibleRowCount() As Integer
Returns
The number are rows that will display.
GetVisibleWidth()
Returns the width of the table that will be seen on the page.
public float GetVisibleWidth()
Function GetVisibleWidth() As Single
Returns
The width of all visible text of the table.
HasOverflowColumns()
Returns a value indicating if there are columns remaining that will not be drawn to the table.
public bool HasOverflowColumns()
Function HasOverflowColumns() As Boolean
Returns
Value indication whether or not overflow columns exists.
HasOverflowRows()
Returns a value indicating if there are rows remaining that will not be drawn to the table.
public bool HasOverflowRows()
Function HasOverflowRows() As Boolean
Returns
Value indication whether or not overflow rows exists.
SetOverflowTableHeaderColumnCellsTags(Tag[])
Sets the tags for the overflow table header columns each cell.
public void SetOverflowTableHeaderColumnCellsTags(Tag[] overflowTableHeaderColumnCellsTags)
Sub SetOverflowTableHeaderColumnCellsTags(overflowTableHeaderColumnCellsTags As Tag[])
Parameters
- overflowTableHeaderColumnCellsTags: Tag[]
Structure element array of the overflow table header column cells.
SetOverflowTableHeaderRowCellsTags(Tag[])
Sets the tags for the overflow table header rows each cell.
public void SetOverflowTableHeaderRowCellsTags(Tag[] overflowTableHeaderRowCellsTags)
Sub SetOverflowTableHeaderRowCellsTags(overflowTableHeaderRowCellsTags As Tag[])
Parameters
- overflowTableHeaderRowCellsTags: Tag[]
Structure element array of the overflow table header row cells.
SetOverflowTableHeaderRowTags(Tag[])
Sets the tags for the overflow table header rows.
public void SetOverflowTableHeaderRowTags(Tag[] overflowTableHeaderRowTags)
Sub SetOverflowTableHeaderRowTags(overflowTableHeaderRowTags As Tag[])
Parameters
- overflowTableHeaderRowTags: Tag[]
Structure element array of the overflow table header rows.
ToString()
Returns a String that represents the current Object . (Inherited from Object)
public string ToString()
Function ToString() As String
Returns
A String that represents the current Object .