Cell2List.Add
Overloads
Add(PageElement) | Adds a Cell2 to the end of the Cell2List with the specified page element. |
Add(PageElement, Int32) | Adds a Cell2 to the end of the Cell2List with the specified page element. |
Add(PageElement, Int32, Int32) | Adds a Cell2 to the end of the Cell2List with the specified page element. |
Add(String) | Adds a Cell2 to the end of the Cell2List . |
Add(String, Font, Single?) | Adds a Cell2 to the end of the Cell2List . |
Add(String, Font, Single?, Color, Color, Int32) | Adds a Cell2 to the end of the Cell2List . |
Add(String, Font, Single?, Color, Color, Int32, Int32) | Adds a Cell2 to the end of the Cell2List . |
Add(String, Font, Single?, Int32) | Adds a Cell2 to the end of the Cell2List . |
Add(String, Font, Single?, Int32, Int32) | Adds a Cell2 to the end of the Cell2List . |
Add(String, Int32) | Adds a Cell2 to the end of the Cell2List . |
Add(String, Int32, Int32) | Adds a Cell2 to the end of the Cell2List . |
Add(PageElement)
Adds a Cell2 to the end of the Cell2List with the specified page element.
public Cell2 Add(PageElement element)
Function Add(element As PageElement) As Cell2
Parameters
- element
- PageElement
Page element to be displayed in the cell.
Returns
Licensing Info
This method is a full DynamicPDF Core Suite feature. One of the following is required for non-evaluation usage:
- An active DynamicPDF Ultimate Subscription
- An active DynamicPDF Professional or Professional Plus Subscription with DynamicPDF Core Suite selected.
- A DynamicPDF Core Suite for .NET v12.X Developer License.
Examples
The following example shows you how to build a simple table where some cells contain page elements.Imports System
Imports ceTe.DynamicPDF
Imports ceTe.DynamicPDF.PageElements
Module MyModule
Sub Main()
' Create a PDF Document
Dim MyDocument As Document = New Document
Dim MyPage As Page = New Page
MyDocument.Pages.Add(MyPage)
Dim MyTable As Table2 = New Table2(0, 0, 600, 600)
MyTable.CellDefault.Align = TextAlign.Center
MyTable.CellDefault.VAlign = VAlign.Center
MyTable.Border.LineStyle = LineStyle.Solid
MyTable.CellSpacing = 5.0f
' Add columns to the table
MyTable.Columns.Add(150)
MyTable.Columns.Add(150)
MyTable.Columns.Add(150)
' Add rows to the table and add cells to the rows
Dim MyRow1 As Row2 = MyTable.Rows.Add(0, Font.HelveticaBold, 16, _
Grayscale.Black, Grayscale.LightGrey)
MyRow1.Cells.Add("Header 1")
MyRow1.Cells.Add("Header 2")
MyRow1.Cells.Add("Header 3")
Dim MyRow2 As Row2 = MyTable.Rows.Add()
MyRow2.Cells.Add("Formatted Text", Font.HelveticaBold, 16, Grayscale.Black, _
Grayscale.LightGrey, 1)
Dim formattedText As String = "<font face='Times'>Font Face, </font>" + _
"<font color='FF0000'>Color, </font><b>Bold.</b>"
MyRow2.Cells.Add(New FormattedTextArea(formattedText, 0, 0, 140, 15, _
FontFamily.Helvetica, 14, False))
MyRow2.Cells.Add("Item 1")
Dim MyRow3 As Row2 = MyTable.Rows.Add()
MyRow3.Cells.Add("Rowheader 1", Font.HelveticaBold, 16, Grayscale.Black, _
Grayscale.LightGrey, 1)
MyRow3.Cells.Add("Item 2")
MyRow3.Cells.Add("Item 3")
Dim MyRow4 As Row2 = MyTable.Rows.Add()
MyRow4.Cells.Add("Rowheader 2", Font.HelveticaBold, 16, Grayscale.Black, _
Grayscale.LightGrey, 1)
MyRow4.Cells.Add("Item 4")
MyRow4.Cells.Add("Item 5")
' 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();
Page page = new Page();
document.Pages.Add( page );
Table2 table = new Table2(0, 0, 600, 600);
table.CellDefault.Align = TextAlign.Center;
table.CellDefault.VAlign = VAlign.Center;
table.Border.LineStyle = LineStyle.Solid;
table.CellSpacing = 5.0f;
// Add columns to the table
table.Columns.Add( 150 );
table.Columns.Add( 150 );
table.Columns.Add( 150 );
// Add rows to the table and add cells to the rows
Row2 row1 = table.Rows.Add( 0, Font.HelveticaBold, 16, Grayscale.Black,
Grayscale.LightGrey );
row1.Cells.Add( "Header 1" );
row1.Cells.Add( "Header 2" );
row1.Cells.Add( "Header 3" );
Row2 row2 = table.Rows.Add( 30 );
row2.Cells.Add( "Formatted Text", Font.HelveticaBold, 16, Grayscale.Black,
Grayscale.LightGrey, 1 );
string formattedText = "<font face='Times'>Font Face, </font>" +
"<font color='FF0000'>Color, </font><b>Bold.</b>";
row2.Cells.Add( new FormattedTextArea( formattedText, 0, 0, 140, 15,
FontFamily.Helvetica, 14, false ) );
row2.Cells.Add( "Item 1" );
Row2 row3 = table.Rows.Add();
row3.Cells.Add( "Rowheader 1", Font.HelveticaBold, 16, Grayscale.Black,
Grayscale.LightGrey, 1 );
row3.Cells.Add( "Item 2" );
row3.Cells.Add( "Item 3" );
Row2 row4 = table.Rows.Add();
row4.Cells.Add( "Rowheader 2", Font.HelveticaBold, 16, Grayscale.Black,
Grayscale.LightGrey, 1 );
row4.Cells.Add( "Item 4" );
row4.Cells.Add( "Item 5" );
// Add the table to the page
page.Elements.Add( table );
// Save the PDF
document.Draw( outputPath );
}
}
Remarks
This method is used to add any page element to the table. Note that a page element should only be added to the cell directly if that page element impliments IArea . If the page element does not impliment IArea then it is recommended you place your page element(s) in an AreaGroup . This will assuree that the row will adjust to the height of the page element as needed.
Add(PageElement, Int32)
Adds a Cell2 to the end of the Cell2List with the specified page element.
public Cell2 Add(PageElement element, int colSpan)
Function Add(element As PageElement, colSpan As Integer) As Cell2
Parameters
- element
- PageElement
Page element to be displayed in the cell.
- colSpan
- Int32
Number of columns that the cell will span.
Returns
Licensing Info
This method is a full DynamicPDF Core Suite feature. One of the following is required for non-evaluation usage:
- An active DynamicPDF Ultimate Subscription
- An active DynamicPDF Professional or Professional Plus Subscription with DynamicPDF Core Suite selected.
- A DynamicPDF Core Suite for .NET v12.X Developer License.
Examples
The following example shows you how to build a simple table.Imports System
Imports ceTe.DynamicPDF
Imports ceTe.DynamicPDF.PageElements
Module MyModule
Sub Main()
' Create a PDF Document
Dim MyDocument As Document = New Document
Dim MyPage As Page = New Page
MyDocument.Pages.Add(MyPage)
Dim MyTable As Table2 = New Table2(0, 0, 600, 600)
MyTable.CellDefault.Align = TextAlign.Center
MyTable.CellDefault.VAlign = VAlign.Center
MyTable.Border.LineStyle = LineStyle.Solid
MyTable.CellSpacing = 5.0f
' Add columns to the table
MyTable.Columns.Add(150)
MyTable.Columns.Add(150)
MyTable.Columns.Add(150)
' Add rows to the table and add cells to the rows
Dim MyRow1 As Row2 = MyTable.Rows.Add(0, Font.HelveticaBold, 16, _
Grayscale.Black, Grayscale.LightGrey)
MyRow1.Cells.Add("Header 1")
MyRow1.Cells.Add("Header 2")
MyRow1.Cells.Add("Header 3")
Dim MyRow8 As Row2 = MyTable.Rows.Add()
MyRow8.Cells.Add("Lines", Font.HelveticaBold, 16, Grayscale.Black, _
Grayscale.LightGrey, 1)
Dim lineGroup As AreaGroup = New AreaGroup(150, 150)
lineGroup.Add(New Line(25, 25, 125, 125, 5))
lineGroup.Add(New Line(25, 125, 125, 25, 5))
MyRow8.Cells.Add(lineGroup, 2)
Dim MyRow3 As Row2 = MyTable.Rows.Add()
MyRow3.Cells.Add("Rowheader 1", Font.HelveticaBold, 16, Grayscale.Black, _
Grayscale.LightGrey, 1)
MyRow3.Cells.Add("Item 1")
MyRow3.Cells.Add("Item 2")
Dim MyRow4 As Row2 = MyTable.Rows.Add()
MyRow4.Cells.Add("Rowheader 2", Font.HelveticaBold, 16, Grayscale.Black, _
Grayscale.LightGrey, 1)
MyRow4.Cells.Add("Item 3")
MyRow4.Cells.Add("Item 4")
' 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();
Page page = new Page();
document.Pages.Add(page);
Table2 table = new Table2(0, 0, 600, 600);
table.CellDefault.Align = TextAlign.Center;
table.CellDefault.VAlign = VAlign.Center;
table.Border.LineStyle = LineStyle.Solid;
table.CellSpacing = 5.0f;
// Add columns to the table
table.Columns.Add(150);
table.Columns.Add(150);
table.Columns.Add(150);
// Add rows to the table and add cells to the rows
Row2 row1 = table.Rows.Add(0, Font.HelveticaBold, 16, Grayscale.Black,
Grayscale.LightGrey);
row1.Cells.Add("Header 1");
row1.Cells.Add("Header 2");
row1.Cells.Add("Header 3");
Row2 row2 = table.Rows.Add(30);
row2.Cells.Add("Lines", Font.HelveticaBold, 16, Grayscale.Black,
Grayscale.LightGrey, 1);
AreaGroup lineGroup = new AreaGroup(150, 150);
lineGroup.Add(new Line(25, 25, 125, 125, 5));
lineGroup.Add(new Line(25, 125, 125, 25, 5));
row2.Cells.Add(lineGroup, 2);
Row2 row3 = table.Rows.Add();
row3.Cells.Add("Rowheader 1", Font.HelveticaBold, 16, Grayscale.Black,
Grayscale.LightGrey, 1);
row3.Cells.Add("Item 1");
row3.Cells.Add("Item 2");
Row2 row4 = table.Rows.Add();
row4.Cells.Add("Rowheader 2", Font.HelveticaBold, 16, Grayscale.Black,
Grayscale.LightGrey, 1);
row4.Cells.Add("Item 3");
row4.Cells.Add("Item 4");
// Add the table to the page
page.Elements.Add(table);
// Save the PDF
document.Draw(outputPath);
}
}
Remarks
This method is used to add any page element to the table. Note that a page element should only be added to the cell directly if that page element impliments IArea . If the page element does not impliment IArea then it is recommended you place your page element(s) in an AreaGroup . This will assuree that the row will adjust to the height of the page element as needed.
Add(PageElement, Int32, Int32)
Adds a Cell2 to the end of the Cell2List with the specified page element.
public Cell2 Add(PageElement element, int colSpan, int rowSpan)
Function Add(element As PageElement, colSpan As Integer, rowSpan As Integer) As Cell2
Parameters
- element
- PageElement
Page element to be displayed in the cell.
- colSpan
- Int32
Number of columns that the cell will span.
- rowSpan
- Int32
Number of rows that the cell will span.
Returns
Licensing Info
This method is a full DynamicPDF Core Suite feature. One of the following is required for non-evaluation usage:
- An active DynamicPDF Ultimate Subscription
- An active DynamicPDF Professional or Professional Plus Subscription with DynamicPDF Core Suite selected.
- A DynamicPDF Core Suite for .NET v12.X Developer License.
Examples
The following example shows you how to build a simple table.Imports System
Imports ceTe.DynamicPDF
Imports ceTe.DynamicPDF.PageElements
Module MyModule
Sub Main()
' Create a PDF Document
Dim MyDocument As Document = New Document
Dim MyPage As Page = New Page
MyDocument.Pages.Add(MyPage)
Dim MyTable As Table2 = New Table2(0, 0, 600, 600)
MyTable.CellDefault.Align = TextAlign.Center
MyTable.CellDefault.VAlign = VAlign.Center
MyTable.Border.LineStyle = LineStyle.Solid
MyTable.CellSpacing = 5.0f
' Add columns to the table
MyTable.Columns.Add(150)
MyTable.Columns.Add(150)
MyTable.Columns.Add(150)
' Add rows to the table and add cells to the rows
Dim MyRow1 As Row2 = MyTable.Rows.Add(0, Font.HelveticaBold, 16, _
Grayscale.Black, Grayscale.LightGrey)
MyRow1.Cells.Add("Header 1")
MyRow1.Cells.Add("Header 2")
MyRow1.Cells.Add("Header 3")
Dim MyRow2 As Row2 = MyTable.Rows.Add()
MyRow2.Cells.Add("Rectangle", Font.HelveticaBold, 16, Grayscale.Black, _
Grayscale.LightGrey, 1)
Dim rect As Rectangle = New Rectangle(0, 0, 90, 90, RgbColor.YellowGreen, _
RgbColor.Blue, 2)
MyRow2.Cells.Add(rect, 2, 2)
Dim MyRow3 As Row2 = MyTable.Rows.Add()
MyRow3.Cells.Add("Rectangle", Font.HelveticaBold, 16, Grayscale.Black, _
Grayscale.LightGrey, 1)
Dim MyRow4 As Row2 = MyTable.Rows.Add()
MyRow4.Cells.Add("Rowheader 1", Font.HelveticaBold, 16, Grayscale.Black, _
Grayscale.LightGrey, 1)
MyRow4.Cells.Add("Item 1")
MyRow4.Cells.Add("Item 2")
' 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();
Page page = new Page();
document.Pages.Add(page);
Table2 table = new Table2(0, 0, 600, 600);
table.CellDefault.Align = TextAlign.Center;
table.CellDefault.VAlign = VAlign.Center;
table.Border.LineStyle = LineStyle.Solid;
table.CellSpacing = 5.0f;
// Add columns to the table
table.Columns.Add(150);
table.Columns.Add(150);
table.Columns.Add(150);
// Add rows to the table and add cells to the rows
Row2 row1 = table.Rows.Add(0, Font.HelveticaBold, 16, Grayscale.Black,
Grayscale.LightGrey);
row1.Cells.Add("Header 1");
row1.Cells.Add("Header 2");
row1.Cells.Add("Header 3");
Row2 row2 = table.Rows.Add();
row2.Cells.Add("Rectangle", Font.HelveticaBold, 16, Grayscale.Black,
Grayscale.LightGrey, 1);
Rectangle rect = new Rectangle(0, 0, 90, 90, RgbColor.YellowGreen,
RgbColor.Blue, 2);
row2.Cells.Add(rect, 2, 2);
Row2 row3 = table.Rows.Add();
row3.Cells.Add("Rectangle", Font.HelveticaBold, 16, Grayscale.Black,
Grayscale.LightGrey, 1);
Row2 row4 = table.Rows.Add();
row4.Cells.Add("Rowheader 1", Font.HelveticaBold, 16, Grayscale.Black,
Grayscale.LightGrey, 1);
row4.Cells.Add("Item 1");
row4.Cells.Add("Item 2");
// Add the table to the page
page.Elements.Add(table);
// Save the PDF
document.Draw(outputPath);
}
}
Remarks
This method is used to add any page element to the table. Note that a page element should only be added to the cell directly if that page element impliments IArea . If the page element does not impliment IArea then it is recommended you place your page element(s) in an AreaGroup . This will assuree that the row will adjust to the height of the page element as needed.
Add(String)
Adds a Cell2 to the end of the Cell2List .
public Cell2 Add(string text)
Function Add(text As String) As Cell2
Parameters
- text
- String
Text to be displayed in the cell.
Returns
Licensing Info
This method is a full DynamicPDF Core Suite feature. One of the following is required for non-evaluation usage:
- An active DynamicPDF Ultimate Subscription
- An active DynamicPDF Professional or Professional Plus Subscription with DynamicPDF Core Suite selected.
- A DynamicPDF Core Suite for .NET v12.X Developer License.
Examples
The following example shows you how to build a simple table.Imports System
Imports ceTe.DynamicPDF
Imports ceTe.DynamicPDF.PageElements
Module MyModule
Sub Main()
' Create a PDF Document
Dim MyDocument As Document = New Document
Dim MyPage As Page = New Page
MyDocument.Pages.Add(MyPage)
Dim MyTable As Table2 = New Table2(0, 0, 600, 600)
MyTable.CellDefault.Align = TextAlign.Center
MyTable.CellDefault.VAlign = VAlign.Center
MyTable.Border.LineStyle = LineStyle.Solid
MyTable.CellSpacing = 5.0f
' Add columns to the table
MyTable.Columns.Add(150)
MyTable.Columns.Add(150)
MyTable.Columns.Add(150)
' Add rows to the table and add cells to the rows
Dim MyRow1 As Row2 = MyTable.Rows.Add(0, Font.HelveticaBold, 16, Grayscale.Black, _
Grayscale.LightGrey)
MyRow1.Cells.Add("Header 1")
MyRow1.Cells.Add("Header 2")
MyRow1.Cells.Add("Header 3")
Dim MyRow2 As Row2 = MyTable.Rows.Add()
MyRow2.Cells.Add("Rowheader 1", Font.HelveticaBold, 16, Grayscale.Black, _
Grayscale.LightGrey, 1)
MyRow2.Cells.Add("Item 1")
MyRow2.Cells.Add("Item 2")
Dim MyRow3 As Row2 = MyTable.Rows.Add()
MyRow3.Cells.Add("Rowheader 2", Font.HelveticaBold, 16, Grayscale.Black, _
Grayscale.LightGrey, 1)
MyRow3.Cells.Add("Item 3")
MyRow3.Cells.Add("Item 4")
Dim MyRow4 As Row2 = MyTable.Rows.Add()
MyRow4.Cells.Add("Rowheader 3", Font.HelveticaBold, 16, Grayscale.Black, _
Grayscale.LightGrey, 1)
MyRow4.Cells.Add("Item 5")
MyRow4.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();
Page page = new Page();
document.Pages.Add(page);
Table2 table = new Table2(0, 0, 600, 800);
table.CellDefault.Align = TextAlign.Center;
table.CellDefault.VAlign = VAlign.Center;
table.Border.LineStyle = LineStyle.Solid;
table.CellSpacing = 5.0f;
// Add columns to the table
table.Columns.Add(150);
table.Columns.Add(150);
table.Columns.Add(150);
// Add rows to the table and add cells to the rows
Row2 row1 = table.Rows.Add(0, Font.HelveticaBold, 16, Grayscale.Black,
Grayscale.LightGrey);
row1.Cells.Add("Header 1");
row1.Cells.Add("Header 2");
row1.Cells.Add("Header 3");
Row2 row2 = table.Rows.Add();
row2.Cells.Add("Rowheader 1", Font.HelveticaBold, 16, Grayscale.Black,
Grayscale.LightGrey, 1);
row2.Cells.Add("Item 1");
row2.Cells.Add("Item 2");
Row2 row3 = table.Rows.Add();
row3.Cells.Add("Rowheader 2", Font.HelveticaBold, 16, Grayscale.Black,
Grayscale.LightGrey, 1);
row3.Cells.Add("Item 3");
row3.Cells.Add("Item 4");
Row2 row4 = table.Rows.Add();
row4.Cells.Add("Rowheader 3", Font.HelveticaBold, 16, Grayscale.Black,
Grayscale.LightGrey, 1);
row4.Cells.Add("Item 5");
row4.Cells.Add("Item 6");
// Add the table to the page
page.Elements.Add(table);
// Save the PDF
document.Draw(outputPath);
}
}
Remarks
This method is used to add any text to a cell in a table.
Add(String, Font, Single?)
Adds a Cell2 to the end of the Cell2List .
public Cell2 Add(string text, Font font, float? fontSize)
Function Add(text As String, font As Font, fontSize As Single?) As Cell2
Parameters
- text
- String
Text to be displayed in the cell.
- font
- Font
Font for the text in the cell.
- fontSize
- Single?
Font size for the text in the cell.
Returns
Licensing Info
This method is a full DynamicPDF Core Suite feature. One of the following is required for non-evaluation usage:
- An active DynamicPDF Ultimate Subscription
- An active DynamicPDF Professional or Professional Plus Subscription with DynamicPDF Core Suite selected.
- A DynamicPDF Core Suite for .NET v12.X Developer License.
Examples
The following example shows you how to build a simple table.Imports System
Imports ceTe.DynamicPDF
Imports ceTe.DynamicPDF.PageElements
Module MyModule
Sub Main()
' Create a PDF Document
Dim MyDocument As Document = New Document
Dim MyPage As Page = New Page
MyDocument.Pages.Add(MyPage)
Dim MyTable As Table2 = New Table2(0, 0, 600, 600)
MyTable.CellDefault.Align = TextAlign.Center
MyTable.CellDefault.VAlign = VAlign.Center
MyTable.Border.LineStyle = LineStyle.Solid
MyTable.CellSpacing = 5.0f
' Add columns to the table
MyTable.Columns.Add(150)
MyTable.Columns.Add(150)
MyTable.Columns.Add(150)
' Add rows to the table and add cells to the rows
Dim MyRow1 As Row2 = MyTable.Rows.Add(0, Font.HelveticaBold, 16, Grayscale.Black, _
Grayscale.LightGrey)
MyRow1.Cells.Add("Header 1")
MyRow1.Cells.Add("Header 2")
MyRow1.Cells.Add("Header 3")
Dim MyRow2 As Row2 = MyTable.Rows.Add()
MyRow2.Cells.Add("Rowheader 1", Font.HelveticaBold, 16, Grayscale.Black, _
Grayscale.LightGrey, 1)
MyRow2.Cells.Add("Item 1")
MyRow2.Cells.Add("Item 2")
Dim MyRow3 As Row2 = MyTable.Rows.Add()
MyRow3.Cells.Add("Rowheader 2", Font.HelveticaBold, 16, Grayscale.Black, _
Grayscale.LightGrey, 1)
MyRow3.Cells.Add("Item 3")
MyRow3.Cells.Add("Item 4")
Dim MyRow4 As Row2 = MyTable.Rows.Add()
MyRow4.Cells.Add("Rowheader 3", Font.HelveticaBold, 16, Grayscale.Black, _
Grayscale.LightGrey, 1)
MyRow4.Cells.Add("Item 5", Font.Courier, 10)
MyRow4.Cells.Add("Item 6", Font.Courier, 10)
' 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();
Page page = new Page();
document.Pages.Add( page );
Table2 table = new Table2(0, 0, 600, 600);
table.CellDefault.Align = TextAlign.Center;
table.CellDefault.VAlign = VAlign.Center;
table.Border.LineStyle = LineStyle.Solid;
table.CellSpacing = 5.0f;
// Add columns to the table
table.Columns.Add( 150 );
table.Columns.Add( 150 );
table.Columns.Add( 150 );
// Add rows to the table and add cells to the rows
Row2 row1 = table.Rows.Add( 0, Font.HelveticaBold, 16, Grayscale.Black,
Grayscale.LightGrey );
row1.Cells.Add( "Header 1" );
row1.Cells.Add( "Header 2" );
row1.Cells.Add( "Header 3" );
Row2 row2 = table.Rows.Add();
row2.Cells.Add( "Rowheader 1", Font.HelveticaBold, 16, Grayscale.Black,
Grayscale.LightGrey, 1 );
row2.Cells.Add( "Item 1" );
row2.Cells.Add( "Item 2" );
Row2 row3 = table.Rows.Add();
row3.Cells.Add( "Rowheader 2", Font.HelveticaBold, 16, Grayscale.Black,
Grayscale.LightGrey, 1 );
row3.Cells.Add( "Item 3" );
row3.Cells.Add( "Item 4" );
Row2 row4 = table.Rows.Add();
row4.Cells.Add( "Rowheader 3", Font.HelveticaBold, 16, Grayscale.Black,
Grayscale.LightGrey, 1 );
row4.Cells.Add( "Item 5", Font.Courier, 10 );
row4.Cells.Add( "Item 6", Font.Courier, 10 );
// Add the table to the page
page.Elements.Add( table );
// Save the PDF
document.Draw(outputPath);
}
}
Remarks
This method is used to add any text to a cell in a table.
Add(String, Font, Single?, Color, Color, Int32)
Adds a Cell2 to the end of the Cell2List .
public Cell2 Add(string text, Font font, float? fontSize, Color textColor, Color backColor, int colSpan)
Function Add(text As String, font As Font, fontSize As Single?, textColor As Color, backColor As Color, colSpan As Integer) As Cell2
Parameters
- text
- String
Text to be displayed in the cell.
- font
- Font
Font for the text in the cell.
- fontSize
- Single?
Font size for the text in the cell.
- textColor
- Color
Color for the text in the cell.
- backColor
- Color
Background color for the cell.
- colSpan
- Int32
Number of columns that the cell will span.
Returns
Licensing Info
This method is a full DynamicPDF Core Suite feature. One of the following is required for non-evaluation usage:
- An active DynamicPDF Ultimate Subscription
- An active DynamicPDF Professional or Professional Plus Subscription with DynamicPDF Core Suite selected.
- A DynamicPDF Core Suite for .NET v12.X Developer License.
Examples
The following example shows you how to build a simple table.Imports System
Imports ceTe.DynamicPDF
Imports ceTe.DynamicPDF.PageElements
Module MyModule
Sub Main()
' Create a PDF Document
Dim MyDocument As Document = New Document
Dim MyPage As Page = New Page
MyDocument.Pages.Add(MyPage)
Dim MyTable As Table2 = New Table2(0, 0, 600, 600)
MyTable.CellDefault.Align = TextAlign.Center
MyTable.CellDefault.VAlign = VAlign.Center
MyTable.Border.LineStyle = LineStyle.Solid
MyTable.CellSpacing = 5.0f
' Add columns to the table
MyTable.Columns.Add(150)
MyTable.Columns.Add(150)
MyTable.Columns.Add(150)
' Add rows to the table and add cells to the rows
Dim MyRow1 As Row2 = MyTable.Rows.Add(0, Font.HelveticaBold, 16, _
Grayscale.Black, Grayscale.LightGrey)
MyRow1.Cells.Add("Header 1")
MyRow1.Cells.Add("Header 2")
MyRow1.Cells.Add("Header 3")
Dim MyRow2 As Row2 = MyTable.Rows.Add()
MyRow2.Cells.Add("Rowheader 1", Font.HelveticaBold, 16, Grayscale.Black, _
Grayscale.LightGrey, 1)
MyRow2.Cells.Add("Item 1", Font.HelveticaOblique, 14, RgbColor.Blue, _
RgbColor.Yellow, 2)
Dim MyRow3 As Row2 = MyTable.Rows.Add()
MyRow3.Cells.Add("Rowheader 2", Font.HelveticaBold, 16, Grayscale.Black, _
Grayscale.LightGrey, 1)
MyRow3.Cells.Add("Item 2")
MyRow3.Cells.Add("Item 3")
Dim MyRow4 As Row2 = MyTable.Rows.Add()
MyRow4.Cells.Add("Rowheader 3", Font.HelveticaBold, 16, Grayscale.Black, _
Grayscale.LightGrey, 1)
MyRow4.Cells.Add("Item 4")
MyRow4.Cells.Add("Item 5")
' 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();
Page page = new Page();
document.Pages.Add(page);
Table2 table = new Table2(0, 0, 600, 600);
table.CellDefault.Align = TextAlign.Center;
table.CellDefault.VAlign = VAlign.Center;
table.Border.LineStyle = LineStyle.Solid;
table.CellSpacing = 5.0f;
// Add columns to the table
table.Columns.Add(150);
table.Columns.Add(150);
table.Columns.Add(150);
// Add rows to the table and add cells to the rows
Row2 row1 = table.Rows.Add(0, Font.HelveticaBold, 16, Grayscale.Black,
Grayscale.LightGrey);
row1.Cells.Add("Header 1");
row1.Cells.Add("Header 2");
row1.Cells.Add("Header 3");
Row2 row2 = table.Rows.Add();
row2.Cells.Add("Rowheader 1", Font.HelveticaBold, 16, Grayscale.Black,
Grayscale.LightGrey, 1);
row2.Cells.Add("Item 1", Font.HelveticaOblique, 14, RgbColor.Blue,
RgbColor.Yellow, 2);
Row2 row3 = table.Rows.Add();
row3.Cells.Add("Rowheader 2", Font.HelveticaBold, 16, Grayscale.Black,
Grayscale.LightGrey, 1);
row3.Cells.Add("Item 2");
row3.Cells.Add("Item 3");
Row2 row4 = table.Rows.Add();
row4.Cells.Add("Rowheader 3", Font.HelveticaBold, 16, Grayscale.Black,
Grayscale.LightGrey, 1);
row4.Cells.Add("Item 4");
row4.Cells.Add("Item 5");
// Add the table to the page
page.Elements.Add(table);
// Save the PDF
document.Draw(outputPath);
}
}
Remarks
This method is used to add any text to a cell in a table.
Add(String, Font, Single?, Color, Color, Int32, Int32)
Adds a Cell2 to the end of the Cell2List .
public Cell2 Add(string text, Font font, float? fontSize, Color textColor, Color backColor, int colSpan, int rowSpan)
Function Add(text As String, font As Font, fontSize As Single?, textColor As Color, backColor As Color, colSpan As Integer, rowSpan As Integer) As Cell2
Parameters
- text
- String
Text to be displayed in the cell.
- font
- Font
Font for the text in the cell.
- fontSize
- Single?
Font size for the text in the cell.
- textColor
- Color
Color for the text in the cell.
- backColor
- Color
Background color for the cell.
- colSpan
- Int32
Number of columns that the cell will span.
- rowSpan
- Int32
Number of rows that the cell will span.
Returns
Licensing Info
This method is a full DynamicPDF Core Suite feature. One of the following is required for non-evaluation usage:
- An active DynamicPDF Ultimate Subscription
- An active DynamicPDF Professional or Professional Plus Subscription with DynamicPDF Core Suite selected.
- A DynamicPDF Core Suite for .NET v12.X Developer License.
Examples
The following example shows you how to build a simple table.Imports System
Imports ceTe.DynamicPDF
Imports ceTe.DynamicPDF.PageElements
Module MyModule
Sub Main()
' Create a PDF Document
Dim MyDocument As Document = New Document
Dim MyPage As Page = New Page
MyDocument.Pages.Add(MyPage)
Dim MyTable As Table2 = New Table2(0, 0, 600, 600)
MyTable.CellDefault.Align = TextAlign.Center
MyTable.CellDefault.VAlign = VAlign.Center
MyTable.Border.LineStyle = LineStyle.Solid
MyTable.CellSpacing = 5.0f
' Add columns to the table
MyTable.Columns.Add(150)
MyTable.Columns.Add(150)
MyTable.Columns.Add(150)
' Add rows to the table and add cells to the rows
Dim MyRow1 As Row2 = MyTable.Rows.Add(0, Font.HelveticaBold, 16, _
Grayscale.Black, Grayscale.LightGrey)
MyRow1.Cells.Add("Header 1")
MyRow1.Cells.Add("Header 2")
MyRow1.Cells.Add("Header 3")
Dim MyRow2 As Row2 = MyTable.Rows.Add()
MyRow2.Cells.Add("Rowheader 1", Font.HelveticaBold, 16, Grayscale.Black, _
Grayscale.LightGrey, 1)
MyRow2.Cells.Add("Item 1", Font.HelveticaOblique, 16, RgbColor.Red, _
RgbColor.LightSkyBlue, 2, 2)
Dim MyRow3 As Row2 = MyTable.Rows.Add()
MyRow3.Cells.Add("Rowheader 2", Font.HelveticaBold, 16, Grayscale.Black, _
Grayscale.LightGrey, 1)
Dim MyRow4 As Row2 = MyTable.Rows.Add()
MyRow4.Cells.Add("Rowheader 3", Font.HelveticaBold, 16, Grayscale.Black, _
Grayscale.LightGrey, 1)
MyRow4.Cells.Add("Item 2")
MyRow4.Cells.Add("Item 3")
' 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();
Page page = new Page();
document.Pages.Add(page);
Table2 table = new Table2(0, 0, 600, 600);
table.CellDefault.Align = TextAlign.Center;
table.CellDefault.VAlign = VAlign.Center;
table.Border.LineStyle = LineStyle.Solid;
table.CellSpacing = 5.0f;
// Add columns to the table
table.Columns.Add(150);
table.Columns.Add(150);
table.Columns.Add(150);
// Add rows to the table and add cells to the rows
Row2 row1 = table.Rows.Add(0, Font.HelveticaBold, 16, Grayscale.Black,
Grayscale.LightGrey);
row1.Cells.Add("Header 1");
row1.Cells.Add("Header 2");
row1.Cells.Add("Header 3");
Row2 row2 = table.Rows.Add();
row2.Cells.Add("Rowheader 1", Font.HelveticaBold, 16, Grayscale.Black,
Grayscale.LightGrey, 1);
row2.Cells.Add("Item 1", Font.HelveticaOblique, 14, RgbColor.Red,
RgbColor.LightSkyBlue, 2, 2);
Row2 row3 = table.Rows.Add();
row3.Cells.Add("Rowheader 2", Font.HelveticaBold, 16, Grayscale.Black,
Grayscale.LightGrey, 1);
Row2 row4 = table.Rows.Add();
row4.Cells.Add("Rowheader 3", Font.HelveticaBold, 16, Grayscale.Black,
Grayscale.LightGrey, 1);
row4.Cells.Add("Item 2");
row4.Cells.Add("Item 3");
// Add the table to the page
page.Elements.Add(table);
// Save the PDF
document.Draw(outputPath);
}
}
Remarks
This method is used to add any text to a cell in a table.
Add(String, Font, Single?, Int32)
Adds a Cell2 to the end of the Cell2List .
public Cell2 Add(string text, Font font, float? fontSize, int colSpan)
Function Add(text As String, font As Font, fontSize As Single?, colSpan As Integer) As Cell2
Parameters
- text
- String
Text to be displayed in the cell.
- font
- Font
Font for the text in the cell.
- fontSize
- Single?
Font size for the text in the cell.
- colSpan
- Int32
Number of columns that the cell will span.
Returns
Licensing Info
This method is a full DynamicPDF Core Suite feature. One of the following is required for non-evaluation usage:
- An active DynamicPDF Ultimate Subscription
- An active DynamicPDF Professional or Professional Plus Subscription with DynamicPDF Core Suite selected.
- A DynamicPDF Core Suite for .NET v12.X Developer License.
Examples
The following example shows you how to build a simple table.Imports System
Imports ceTe.DynamicPDF
Imports ceTe.DynamicPDF.PageElements
Module MyModule
Sub Main()
' Create a PDF Document
Dim MyDocument As Document = New Document
Dim MyPage As Page = New Page
MyDocument.Pages.Add(MyPage)
Dim MyTable As Table2 = New Table2(0, 0, 600, 600)
MyTable.CellDefault.Align = TextAlign.Center
MyTable.CellDefault.VAlign = VAlign.Center
MyTable.Border.LineStyle = LineStyle.Solid
MyTable.CellSpacing = 5.0f
' Add columns to the table
MyTable.Columns.Add(150)
MyTable.Columns.Add(150)
MyTable.Columns.Add(150)
' Add rows to the table and add cells to the rows
Dim MyRow1 As Row2 = MyTable.Rows.Add(0, Font.HelveticaBold, 16, _
Grayscale.Black, Grayscale.LightGrey)
MyRow1.Cells.Add("Header 1")
MyRow1.Cells.Add("Header 2")
MyRow1.Cells.Add("Header 3")
Dim MyRow2 As Row2 = MyTable.Rows.Add()
MyRow2.Cells.Add("Rowheader 1", Font.HelveticaBold, 16, Grayscale.Black, _
Grayscale.LightGrey, 1)
MyRow2.Cells.Add("Item 1", Font.HelveticaOblique, 14, 2)
Dim MyRow3 As Row2 = MyTable.Rows.Add()
MyRow3.Cells.Add("Rowheader 2", Font.HelveticaBold, 16, Grayscale.Black, _
Grayscale.LightGrey, 1)
MyRow3.Cells.Add("Item 2")
MyRow3.Cells.Add("Item 3")
Dim MyRow4 As Row2 = MyTable.Rows.Add()
MyRow4.Cells.Add("Rowheader 3", Font.HelveticaBold, 16, Grayscale.Black, _
Grayscale.LightGrey, 1)
MyRow4.Cells.Add("Item 4")
MyRow4.Cells.Add("Item 5")
' 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();
Page page = new Page();
document.Pages.Add(page);
Table2 table = new Table2(0, 0, 600, 600);
table.CellDefault.Align = TextAlign.Center;
table.CellDefault.VAlign = VAlign.Center;
table.Border.LineStyle = LineStyle.Solid;
table.CellSpacing = 5.0f;
// Add columns to the table
table.Columns.Add(150);
table.Columns.Add(150);
table.Columns.Add(150);
// Add rows to the table and add cells to the rows
Row2 row1 = table.Rows.Add(0, Font.HelveticaBold, 16, Grayscale.Black,
Grayscale.LightGrey);
row1.Cells.Add("Header 1");
row1.Cells.Add("Header 2");
row1.Cells.Add("Header 3");
Row2 row2 = table.Rows.Add();
row2.Cells.Add("Rowheader 1", Font.HelveticaBold, 16, Grayscale.Black,
Grayscale.LightGrey, 1);
row2.Cells.Add("Item 1", Font.HelveticaOblique, 14, 2);
Row2 row3 = table.Rows.Add();
row3.Cells.Add("Rowheader 2", Font.HelveticaBold, 16, Grayscale.Black,
Grayscale.LightGrey, 1);
row3.Cells.Add("Item 2");
row3.Cells.Add("Item 3");
Row2 row4 = table.Rows.Add();
row4.Cells.Add("Rowheader 3", Font.HelveticaBold, 16, Grayscale.Black,
Grayscale.LightGrey, 1);
row4.Cells.Add("Item 4");
row4.Cells.Add("Item 5");
// Add the table to the page
page.Elements.Add(table);
// Save the PDF
document.Draw(outputPath);
}
}
Remarks
This method is used to add any text to a cell in a table.
Add(String, Font, Single?, Int32, Int32)
Adds a Cell2 to the end of the Cell2List .
public Cell2 Add(string text, Font font, float? fontSize, int colSpan, int rowSpan)
Function Add(text As String, font As Font, fontSize As Single?, colSpan As Integer, rowSpan As Integer) As Cell2
Parameters
- text
- String
Text to be displayed in the cell.
- font
- Font
Font for the text in the cell.
- fontSize
- Single?
Font size for the text in the cell.
- colSpan
- Int32
Number of columns that the cell will span.
- rowSpan
- Int32
Number of rows that the cell will span.
Returns
Licensing Info
This method is a full DynamicPDF Core Suite feature. One of the following is required for non-evaluation usage:
- An active DynamicPDF Ultimate Subscription
- An active DynamicPDF Professional or Professional Plus Subscription with DynamicPDF Core Suite selected.
- A DynamicPDF Core Suite for .NET v12.X Developer License.
Examples
The following example shows you how to build a simple table.Imports System
Imports ceTe.DynamicPDF
Imports ceTe.DynamicPDF.PageElements
Module MyModule
Sub Main()
' Create a PDF Document
Dim MyDocument As Document = New Document
Dim MyPage As Page = New Page
MyDocument.Pages.Add(MyPage)
Dim MyTable As Table2 = New Table2(0, 0, 600, 600)
MyTable.CellDefault.Align = TextAlign.Center
MyTable.CellDefault.VAlign = VAlign.Center
MyTable.Border.LineStyle = LineStyle.Solid
MyTable.CellSpacing = 5.0f
' Add columns to the table
MyTable.Columns.Add(150)
MyTable.Columns.Add(150)
MyTable.Columns.Add(150)
' Add rows to the table and add cells to the rows
Dim MyRow1 As Row2 = MyTable.Rows.Add(0, Font.HelveticaBold, 16, _
Grayscale.Black, Grayscale.LightGrey)
MyRow1.Cells.Add("Header 1")
MyRow1.Cells.Add("Header 2")
MyRow1.Cells.Add("Header 3")
Dim MyRow2 As Row2 = MyTable.Rows.Add()
MyRow2.Cells.Add("Rowheader 1", Font.HelveticaBold, 16, Grayscale.Black, _
Grayscale.LightGrey, 1)
MyRow2.Cells.Add("Item 1", Font.Symbol, 20, 2, 2)
Dim MyRow3 As Row2 = MyTable.Rows.Add()
MyRow3.Cells.Add("Rowheader 2", Font.HelveticaBold, 16, Grayscale.Black, _
Grayscale.LightGrey, 1)
Dim MyRow4 As Row2 = MyTable.Rows.Add()
MyRow4.Cells.Add("Rowheader 3", Font.HelveticaBold, 16, Grayscale.Black, _
Grayscale.LightGrey, 1)
MyRow4.Cells.Add("Item 2")
MyRow4.Cells.Add("Item 3")
' 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();
Page page = new Page();
document.Pages.Add(page);
Table2 table = new Table2(0, 0, 600, 600);
table.CellDefault.Align = TextAlign.Center;
table.CellDefault.VAlign = VAlign.Center;
table.Border.LineStyle = LineStyle.Solid;
table.CellSpacing = 5.0f;
// Add columns to the table
table.Columns.Add(150);
table.Columns.Add(150);
table.Columns.Add(150);
// Add rows to the table and add cells to the rows
Row2 row1 = table.Rows.Add(0, Font.HelveticaBold, 16, Grayscale.Black,
Grayscale.LightGrey);
row1.Cells.Add("Header 1");
row1.Cells.Add("Header 2");
row1.Cells.Add("Header 3");
Row2 row2 = table.Rows.Add();
row2.Cells.Add("Rowheader 1", Font.HelveticaBold, 16, Grayscale.Black,
Grayscale.LightGrey, 1);
row2.Cells.Add("Item 1", Font.HelveticaOblique, 14, 2);
Row2 row3 = table.Rows.Add();
row3.Cells.Add("Rowheader 2", Font.HelveticaBold, 16, Grayscale.Black,
Grayscale.LightGrey, 1);
row3.Cells.Add("Item 2");
row3.Cells.Add("Item 3");
Row2 row4 = table.Rows.Add();
row4.Cells.Add("Rowheader 3", Font.HelveticaBold, 16, Grayscale.Black,
Grayscale.LightGrey, 1);
row4.Cells.Add("Item 4");
row4.Cells.Add("Item 5");
// Add the table to the page
page.Elements.Add(table);
// Save the PDF
document.Draw(outputPath);
}
}
Remarks
This method is used to add any text to a cell in a table.
Add(String, Int32)
Adds a Cell2 to the end of the Cell2List .
public Cell2 Add(string text, int colSpan)
Function Add(text As String, colSpan As Integer) As Cell2
Parameters
- text
- String
Text to be displayed in the cell.
- colSpan
- Int32
Number of columns that the cell will span.
Returns
Licensing Info
This method is a full DynamicPDF Core Suite feature. One of the following is required for non-evaluation usage:
- An active DynamicPDF Ultimate Subscription
- An active DynamicPDF Professional or Professional Plus Subscription with DynamicPDF Core Suite selected.
- A DynamicPDF Core Suite for .NET v12.X Developer License.
Examples
The following example shows you how to build a simple table.Imports System
Imports ceTe.DynamicPDF
Imports ceTe.DynamicPDF.PageElements
Module MyModule
Sub Main()
' Create a PDF Document
Dim MyDocument As Document = New Document
Dim MyPage As Page = New Page
MyDocument.Pages.Add(MyPage)
Dim MyTable As Table2 = New Table2(0, 0, 600, 600)
MyTable.CellDefault.Align = TextAlign.Center
MyTable.CellDefault.VAlign = VAlign.Center
MyTable.Border.LineStyle = LineStyle.Solid
MyTable.CellSpacing = 5.0f
' Add columns to the table
MyTable.Columns.Add(150)
MyTable.Columns.Add(150)
MyTable.Columns.Add(150)
' Add rows to the table and add cells to the rows
Dim MyRow1 As Row2 = MyTable.Rows.Add(0, Font.HelveticaBold, 16, Grayscale.Black, _
Grayscale.LightGrey)
MyRow1.Cells.Add("Header 1")
MyRow1.Cells.Add("Header 2")
MyRow1.Cells.Add("Header 3")
Dim MyRow2 As Row2 = MyTable.Rows.Add()
MyRow2.Cells.Add("Rowheader 1", Font.HelveticaBold, 16, Grayscale.Black, _
Grayscale.LightGrey, 1)
MyRow2.Cells.Add("Item 1")
MyRow2.Cells.Add("Item 2")
Dim MyRow3 As Row2 = MyTable.Rows.Add()
MyRow3.Cells.Add("Rowheader 2", Font.HelveticaBold, 16, Grayscale.Black, _
Grayscale.LightGrey, 1)
MyRow3.Cells.Add("Item 3")
MyRow3.Cells.Add("Item 4")
Dim MyRow4 As Row2 = MyTable.Rows.Add()
MyRow4.Cells.Add("Rowheader 3", Font.HelveticaBold, 16, Grayscale.Black, _
Grayscale.LightGrey, 1)
MyRow4.Cells.Add("Item 5", 2)
' 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();
Page page = new Page();
document.Pages.Add(page);
Table2 table = new Table2(0, 0, 600, 600);
table.CellDefault.Align = TextAlign.Center;
table.CellDefault.VAlign = VAlign.Center;
table.Border.LineStyle = LineStyle.Solid;
table.CellSpacing = 5.0f;
// Add columns to the table
table.Columns.Add(150);
table.Columns.Add(150);
table.Columns.Add(150);
// Add rows to the table and add cells to the rows
Row2 row1 = table.Rows.Add(0, Font.HelveticaBold, 16, Grayscale.Black,
Grayscale.LightGrey);
row1.Cells.Add("Header 1");
row1.Cells.Add("Header 2");
row1.Cells.Add("Header 3");
Row2 row2 = table.Rows.Add();
row2.Cells.Add("Rowheader 1", Font.HelveticaBold, 16, Grayscale.Black,
Grayscale.LightGrey, 1);
row2.Cells.Add("Item 1");
row2.Cells.Add("Item 2");
Row2 row3 = table.Rows.Add();
row3.Cells.Add("Rowheader 2", Font.HelveticaBold, 16, Grayscale.Black,
Grayscale.LightGrey, 1);
row3.Cells.Add("Item 3");
row3.Cells.Add("Item 4");
Row2 row4 = table.Rows.Add();
row4.Cells.Add("Rowheader 3", Font.HelveticaBold, 16, Grayscale.Black,
Grayscale.LightGrey, 1);
row4.Cells.Add("Item 5", 2);
// Add the table to the page
page.Elements.Add(table);
// Save the PDF
document.Draw(outputPath);
}
}
Remarks
This method is used to add any text to a cell in a table.
Add(String, Int32, Int32)
Adds a Cell2 to the end of the Cell2List .
public Cell2 Add(string text, int colSpan, int rowSpan)
Function Add(text As String, colSpan As Integer, rowSpan As Integer) As Cell2
Parameters
- text
- String
Text to be displayed in the cell.
- colSpan
- Int32
Number of columns that the cell will span.
- rowSpan
- Int32
Number of rows that the cell will span.
Returns
Licensing Info
This method is a full DynamicPDF Core Suite feature. One of the following is required for non-evaluation usage:
- An active DynamicPDF Ultimate Subscription
- An active DynamicPDF Professional or Professional Plus Subscription with DynamicPDF Core Suite selected.
- A DynamicPDF Core Suite for .NET v12.X Developer License.
Examples
The following example shows you how to build a simple table.Imports System
Imports ceTe.DynamicPDF
Imports ceTe.DynamicPDF.PageElements
Module MyModule
Sub Main()
' Create a PDF Document
Dim MyDocument As Document = New Document
Dim MyPage As Page = New Page
MyDocument.Pages.Add(MyPage)
Dim MyTable As Table2 = New Table2(0, 0, 600, 600)
MyTable.CellDefault.Align = TextAlign.Center
MyTable.CellDefault.VAlign = VAlign.Center
MyTable.Border.LineStyle = LineStyle.Solid
MyTable.CellSpacing = 5.0f
' Add columns to the table
MyTable.Columns.Add(150)
MyTable.Columns.Add(150)
MyTable.Columns.Add(150)
' Add rows to the table and add cells to the rows
Dim MyRow1 As Row2 = MyTable.Rows.Add(0, Font.HelveticaBold, 16, _
Grayscale.Black, Grayscale.LightGrey)
MyRow1.Cells.Add("Header 1")
MyRow1.Cells.Add("Header 2")
MyRow1.Cells.Add("Header 3")
Dim MyRow2 As Row2 = MyTable.Rows.Add()
MyRow2.Cells.Add("Rowheader 1", Font.HelveticaBold, 16, Grayscale.Black, _
Grayscale.LightGrey, 1)
MyRow2.Cells.Add("Item 1", 2, 2)
Dim MyRow3 As Row2 = MyTable.Rows.Add()
MyRow3.Cells.Add("Rowheader 2", Font.HelveticaBold, 16, Grayscale.Black, _
Grayscale.LightGrey, 1)
Dim MyRow4 As Row2 = MyTable.Rows.Add()
MyRow4.Cells.Add("Rowheader 3", Font.HelveticaBold, 16, Grayscale.Black, _
Grayscale.LightGrey, 1)
MyRow4.Cells.Add("Item 2")
MyRow4.Cells.Add("Item 3")
' 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();
Page page = new Page();
document.Pages.Add( page );
Table2 table = new Table2(0, 0, 600, 600);
table.CellDefault.Align = TextAlign.Center;
table.CellDefault.VAlign = VAlign.Center;
table.Border.LineStyle = LineStyle.Solid;
table.CellSpacing = 5.0f;
// Add columns to the table
table.Columns.Add( 150 );
table.Columns.Add( 150 );
table.Columns.Add( 150 );
// Add rows to the table and add cells to the rows
Row2 row1 = table.Rows.Add( 0, Font.HelveticaBold, 16, Grayscale.Black,
Grayscale.LightGrey );
row1.Cells.Add( "Header 1" );
row1.Cells.Add( "Header 2" );
row1.Cells.Add( "Header 3" );
Row2 row2 = table.Rows.Add();
row2.Cells.Add( "Rowheader 1", Font.HelveticaBold, 16, Grayscale.Black,
Grayscale.LightGrey, 1 );
row2.Cells.Add( "Item 1", 2, 2 );
Row2 row3 = table.Rows.Add();
row3.Cells.Add( "Rowheader 2", Font.HelveticaBold, 16, Grayscale.Black,
Grayscale.LightGrey, 1 );
Row2 row4 = table.Rows.Add();
row4.Cells.Add( "Rowheader 3", Font.HelveticaBold, 16, Grayscale.Black,
Grayscale.LightGrey, 1 );
row4.Cells.Add( "Item 2" );
row4.Cells.Add( "Item 3" );
// Add the table to the page
page.Elements.Add( table );
// Save the PDF
document.Draw(outputPath);
}
}
Remarks
This method is used to add any text to a cell in a table.