Skip to main content

Cell2

Version: 10.0

cete.dynamicpdf.pageelements.cell2

Cell2​

Represents a cell in the Table

public class Cell2
Public Class Cell2

Inheritance: Object → Cell2

Licensing​

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

  • DynamicPDF Generator for .NET Professional Edition
  • DynamicPDF Generator for .NET Enterprise Edition
  • DynamicPDF Merger for .NET Professional Edition
  • DynamicPDF Merger for .NET Enterprise Edition
  • DynamicPDF ReportWriter for .NET Professional Edition
  • DynamicPDF ReportWriter for .NET Enterprise Edition
  • DynamicPDF Core Suite for .NET Professional Edition
  • DynamicPDF Core Suite for .NET Enterprise Edition

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
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
Row2 row1 = table.Rows.Add(40, Font.HelveticaBold, 16, Grayscale.Black,
Grayscale.Gray);
row1.CellDefault.Align = TextAlign.Center;
row1.CellDefault.VAlign = VAlign.Center;
row1.CellDefault.Border.Color = RgbColor.Blue;
row1.CellDefault.Border.Width = 2.0f;
row1.CellDefault.Border.LineStyle = LineStyle.Dots;
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;
cell1.Border.Color = RgbColor.Green;
cell1.Border.Width = 2.0f;
cell1.Border.Right.LineStyle = LineStyle.Solid;
row2.Cells.Add("Item 1");
row2.Cells.Add("Item 2");
row2.Cells.Add("Item 3");
row2.CellDefault.Border.Top.Width = 3.0f;

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;
cell2.Border.Color = RgbColor.Blue;
cell2.Border.Width = 2.0f;
cell2.Border.LineStyle = LineStyle.None;
row3.Cells.Add("Item 4");
row3.Cells.Add("Item 5");
row3.Cells.Add("Item 6");
row3.CellDefault.Padding.Left = 4.0f;
row3.CellDefault.Padding.Top = 4.0f;
row3.CellDefault.Padding.Right = 2.0f;
row3.CellDefault.Padding.Bottom = 2.0f;

table.CellDefault.Padding.Value = 3.0f;
table.CellSpacing = 5.0f;

// Add the table to the page
page.Elements.Add(table);

// Save the PDF
document.Draw(outputPath);
}
}

Properties​

Align​

Gets or sets the TextAlign enumeration to use for the horizontal alignment of the text in the cell. Justify and FullJustify are applicable only for text.

public Nullable&ltTextAlign> Align { get; set; }
Public Property Align As Nullable(Of TextAlign)

Property Value​

Nullable&ltTextAlign>

AutoLeading​

Gets or sets whether the leading of the cell should be calculated automatically.

public Nullable&ltbool> AutoLeading { get; set; }
Public Property AutoLeading As Nullable(Of Boolean)

Property Value​

Nullable&ltbool>

Remarks​

This property is automatically set to false any time the Leading property is set.

BackgroundColor​

Gets or sets the Color object to use for the background of the cell.

public Color BackgroundColor { get; set; }
Public Property BackgroundColor As Color

Property Value​

Color

Border​

Gets the Border object to use for the cell.

public Border Border { get; }
Public Property Border As Border

Property Value​

Border

ColumnIndex​

Gets the index of the Column2 in which the cell begins.

public int ColumnIndex { get; }
Public Property ColumnIndex As Int32

Property Value​

Int32

ColumnSpan​

Gets or sets the number of columns that the cell spans.

public int ColumnSpan { get; set; }
Public Property ColumnSpan As Int32

Property Value​

Int32

Element​

Gets or sets the page element contained in the cell.

public PageElement Element { get; set; }
Public Property Element As PageElement

Property Value​

PageElement

Font​

Gets or sets the Font object to use for the cell.

public Font Font { get; set; }
Public Property Font As Font

Property Value​

Font

FontSize​

Gets or sets the font size to use for the text in the cell.

public Nullable&ltfloat> FontSize { get; set; }
Public Property FontSize As Nullable(Of Single)

Property Value​

Nullable&ltfloat>

Height​

Gets the height of the cell.

public float Height { get; }
Public Property Height As Single

Property Value​

Single

Leading​

Gets or sets the leading for the text of the cell.

public Nullable&ltfloat> Leading { get; set; }
Public Property Leading As Nullable(Of Single)

Property Value​

Nullable&ltfloat>

Remarks​

Setting this property will automatically set the AutoLeading property to false.

Padding​

Gets the CellPadding object to use for the cell.

public CellPadding Padding { get; set; }
Public Property Padding As CellPadding

Property Value​

CellPadding

ParagraphIndent​

Gets or sets the paragraph indent for the paragraphs of the cell.

public Nullable&ltfloat> ParagraphIndent { get; set; }
Public Property ParagraphIndent As Nullable(Of Single)

Property Value​

Nullable&ltfloat>

ParagraphSpacing​

Gets or sets the paragraph spacing for the paragraphs of the cell.

public Nullable&ltfloat> ParagraphSpacing { get; set; }
Public Property ParagraphSpacing As Nullable(Of Single)

Property Value​

Nullable&ltfloat>

RightToLeft​

Gets or sets a value specifying whether the text in the cell will be displayed right to left.

public Nullable&ltbool> RightToLeft { get; set; }
Public Property RightToLeft As Nullable(Of Boolean)

Property Value​

Nullable&ltbool>

Row​

Gets the Row2 that the cell is contained in.

public Row2 Row { get; }
Public Property Row As Row2

Property Value​

Row2

RowSpan​

Gets or sets the number of rows that the cell spans.

public int RowSpan { get; set; }
Public Property RowSpan As Int32

Property Value​

Int32

Splittable​

Gets or sets a value specifying whether the cell can be splittable.

public bool Splittable { get; set; }
Public Property Splittable As Boolean

Property Value​

Boolean

Tag​

Gets or sets the structure element of the cell.

public Tag Tag { get; set; }
Public Property Tag As Tag

Property Value​

Tag

Licensing​

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

  • DynamicPDF Generator for .NET Enterprise Edition
  • DynamicPDF Merger for .NET Enterprise Edition
  • DynamicPDF ReportWriter for .NET Enterprise Edition
  • DynamicPDF Core Suite for .NET Enterprise Edition

TagOrder​

Gets or sets the structure element order of the cell.

public int TagOrder { get; set; }
Public Property TagOrder As Int32

Property Value​

Int32

Text​

Gets or sets the text to be displayed.

public string Text { get; set; }
Public Property Text As String

Property Value​

String

TextColor​

Gets or sets the Color object to use for the text of the cell.

public Color TextColor { get; set; }
Public Property TextColor As Color

Property Value​

Color

Underline​

Gets or sets a value specifying whether the text in the cell will be underlined.

public Nullable&ltbool> Underline { get; set; }
Public Property Underline As Nullable(Of Boolean)

Property Value​

Nullable&ltbool>

VAlign​

Gets or sets the VAlign enumeration to use for the vertical alignment of the text in the cell.

public Nullable&ltVAlign> VAlign { get; set; }
Public Property VAlign As Nullable(Of VAlign)

Property Value​

Nullable&ltVAlign>

Width​

Gets the width of the cell.

public float Width { get; }
Public Property Width As Single

Property Value​

Single

Methods​

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​

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 .

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.

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 .

See Also​

ceTe.DynamicPDF.PageElements