See Also

Table Members  | ceTe.DynamicPDF.PageElements Namespace

Requirements

Namespace: ceTe.DynamicPDF.PageElements

Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family

Assembly: ceTe.DynamicPDF (in ceTe.DynamicPDF.dll)

Language

Visual Basic

C#

Show All

Represents a table with rows, columns and cells.

For a list of all members of this type, see Table members.

Object Model







Inheritance Hierarchy

System.Object
   ceTe.DynamicPDF.PageElement
      ceTe.DynamicPDF.PageElements.RotatingPageElement
         ceTe.DynamicPDF.PageElements.Table

Syntax

[Visual Basic]
Public Class Table    Inherits RotatingPageElement    Implements IAreaICoordinate 
[C#]
public class Table : RotatingPageElement, IAreaICoordinate 

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 Table's formatting . The column object contains no formatting information. Using the Tables GetOverflowColumns and GetOverflowRows methods you can allow your table to easily flow onto other pages. See the Tables topic for more on tables.

Example

The following example will display a simple table on the page.

[Visual Basic] 

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

[C#] 

using System; 
using ceTe.DynamicPDF; 
using ceTe.DynamicPDF.PageElements; 
 
class MyClass 

    static void Main() 
    { 
        // 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  
        Table table = new Table(0, 0, 600, 600); 
                          
        //Add columns to the table 
        table.Columns.Add( 150 ); 
        table.Columns.Add( 90 ); 
        table.Columns.Add( 90 ); 
        table.Columns.Add( 90 ); 
                          
        // Add rows to the table and add cells to the rows 
        Row row1 = table.Rows.Add( 40, Font.HelveticaBold, 16, Grayscale.Black,  
            Grayscale.Gray ); 
        row1.Align = CellAlign.Center; 
        row1.VAlign = CellVAlign.Center; 
        row1.Cells.Add( "Header 1" ); 
        row1.Cells.Add( "Header 2" ); 
        row1.Cells.Add( "Header 3" ); 
        row1.Cells.Add( "Header 4" ); 
                          
        Row row2 = table.Rows.Add( 30 ); 
        Cell cell1 = 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" ); 
                                  
        Row row3 = table.Rows.Add( 30 ); 
        Cell cell2 = 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 
        page.Elements.Add( table );     
                          
        // Save the PDF 
        document.Draw( @"C:\MyDocument.pdf" ); 
    } 
}

Licensing

This class is a DynamicPDF Generator Professional Edition feature. One of the following licenses is required for non-evaluation usage:

Requirements

Namespace: ceTe.DynamicPDF.PageElements

Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family

Assembly: ceTe.DynamicPDF (in ceTe.DynamicPDF.dll)

See Also

Table Members  | ceTe.DynamicPDF.PageElements Namespace

 

 


© Copyright 2007, ceTe Software