Class PdfLightTableStyle
Represents the styles of PdfLightTable.
Inheritance
Namespace: Syncfusion.Pdf.Tables
Assembly: Syncfusion.Pdf.Portable.dll
Syntax
public class PdfLightTableStyle : Object
Examples
//Create PDF document
PdfDocument document = new PdfDocument();
//Create a new page
PdfPage page = document.Pages.Add();
//Set font
PdfFont font = new PdfStandardFont(PdfFontFamily.Helvetica, 8);
//Create Pdf pen for drawing border
PdfPen borderPen = new PdfPen(PdfBrushes.DarkBlue);
borderPen.Width = 0;
//Create brush
PdfColor color = new PdfColor(192, 201, 219);
PdfSolidBrush brush = new PdfSolidBrush(color);
//Create alternative cell styles
PdfCellStyle altStyle = new PdfCellStyle();
altStyle.Font = font;
altStyle.BackgroundBrush = brush;
altStyle.BorderPen = borderPen;
// Create default cell style
PdfCellStyle defStyle = new PdfCellStyle();
defStyle.Font = font;
defStyle.BackgroundBrush = PdfBrushes.White;
defStyle.BorderPen = borderPen;
// Create header cell style
PdfCellStyle headerStyle = new PdfCellStyle(font, PdfBrushes.White, PdfPens.DarkBlue);
brush = new PdfSolidBrush(new PdfColor(33, 67, 126));
headerStyle.BackgroundBrush = brush;
//Create DataTable for source
DataTable dataTable = new DataTable("Table");
dataTable.Columns.Add("ID1");
dataTable.Columns[0].Caption = "id";
dataTable.Columns.Add("ID2");
object[] values = new object[] { "Table Features Demo", "" };
dataTable.Rows.Add(values);
//Create the PdfLightTable
PdfLightTable table = new PdfLightTable();
//Set the data source
table.DataSource = dataTable;
// Set the cell styles
table.Style.AlternateStyle = altStyle;
table.Style.DefaultStyle = defStyle;
table.Style.HeaderStyle = headerStyle;
// Draw the table
table.Draw(page.Graphics, new PointF(0, 0));
//Save the document
document.Save("Output.pdf");
//Close the document
document.Close(true);
'Create PDF document
Dim document As PdfDocument = New PdfDocument()
' Create a page
Dim page As PdfPage = document.Pages.Add()
'Set font
Dim font As PdfFont = New PdfStandardFont(PdfFontFamily.Helvetica, 8)
'Create Pdf pen for drawing border
Dim borderPen As PdfPen = New PdfPen(PdfBrushes.DarkBlue)
borderPen.Width = 0
'Create brush
Dim color As PdfColor = New PdfColor(192, 201, 219)
Dim brush As PdfSolidBrush = New PdfSolidBrush(color)
'Create alternative cell styles
Dim altStyle As PdfCellStyle = New PdfCellStyle()
altStyle.Font = font
altStyle.BackgroundBrush = brush
altStyle.BorderPen = borderPen
' Create default cell style
Dim defStyle As PdfCellStyle = New PdfCellStyle()
defStyle.Font = font
defStyle.BackgroundBrush = PdfBrushes.White
defStyle.BorderPen = borderPen
' Create header cell style
Dim headerStyle As PdfCellStyle = New PdfCellStyle(font, PdfBrushes.White, PdfPens.DarkBlue)
brush = New PdfSolidBrush(New PdfColor(33, 67, 126))
headerStyle.BackgroundBrush = brush
'Create DataTable for source
Dim dataTable As DataTable = New DataTable("Table")
dataTable.Columns.Add("ID1")
dataTable.Columns(0).Caption = "id"
dataTable.Columns.Add("ID2")
Dim values() As Object = New Object() {"Table Features Demo", ""}
dataTable.Rows.Add(values)
'Create the PdfLightTable
Dim table As PdfLightTable = New PdfLightTable()
'Set the data source
table.DataSource = dataTable
'Set the cell styles
table.Style.AlternateStyle = altStyle
table.Style.DefaultStyle = defStyle
table.Style.HeaderStyle = headerStyle
'Draw the table
table.Draw(page.Graphics, New PointF(0, 0))
'Save the document
document.Save("Output.pdf")
'Close the document
document.Close(True)
Constructors
PdfLightTableStyle()
Initializes a new instance of the PdfLightTableStyle class.
Declaration
public PdfLightTableStyle()
Examples
// Create a new document
PdfDocument document = new PdfDocument();
//Create a new page
PdfPage page = document.Pages.Add();
//Create PdfLightTable
PdfLightTable table = new PdfLightTable();
// Set the DataSourceType as Direct
table.DataSourceType = PdfLightTableDataSourceType.TableDirect;
// Create new Columns
table.Columns.Add(new PdfColumn("Roll Number"));
table.Columns.Add(new PdfColumn("Name"));
table.Columns.Add(new PdfColumn("Class"));
//set the border overlap style
PdfLightTableStyle style = new PdfLightTableStyle();
style.BorderOverlapStyle = PdfBorderOverlapStyle.Inside;
table.Style = style;
// Add new Rows
table.Rows.Add(new object[] { "111", "Maxim", "III" });
// Draws the table
table.Draw(page, new PointF(0, 0));
//Save the document
document.Save("Output.pdf");
//Close the document
document.Close(true);
' Create a new document
Dim document As New PdfDocument()
'Create a new page
Dim page As PdfPage = document.Pages.Add()
'Create PdfLightTable
Dim table As New PdfLightTable()
' Set the DataSourceType as Direct
table.DataSourceType = PdfLightTableDataSourceType.TableDirect
' Create new Columns
table.Columns.Add(New PdfColumn("Roll Number"))
table.Columns.Add(New PdfColumn("Name"))
table.Columns.Add(New PdfColumn("Class"))
' set the border overlap style
Dim style As PdfLightTableStyle = New PdfLightTableStyle()
style.BorderOverlapStyle = PdfBorderOverlapStyle.Inside
table.Style = style
' Add new Rows
table.Rows.Add(New Object() { "111", "Maxim", "III" })
' Draws the table
table.Draw(page, New PointF(0, 0))
'Save the document
document.Save("Output.pdf")
'Close the document
document.Close(True)
Properties
AlternateStyle
Gets or sets the alternate style which is the style of the odd rows.
Declaration
public PdfCellStyle AlternateStyle { get; set; }
Property Value
Type |
---|
PdfCellStyle |
Examples
//Create PDF document
PdfDocument document = new PdfDocument();
//Create a new page
PdfPage page = document.Pages.Add();
//Set font
PdfFont font = new PdfStandardFont(PdfFontFamily.Helvetica, 8);
//Create PdfPen for drawing border
PdfPen borderPen = new PdfPen(PdfBrushes.DarkBlue);
borderPen.Width = 0;
//Create brush
PdfColor color = new PdfColor(192, 201, 219);
PdfSolidBrush brush = new PdfSolidBrush(color);
//Create alternative cell style
PdfCellStyle alternateStyle = new PdfCellStyle();
alternateStyle.Font = font;
alternateStyle.BackgroundBrush = brush;
alternateStyle.BorderPen = borderPen;
//Create DataTable for source
DataTable dataTable = new DataTable("Table");
dataTable.Columns.Add("ID1");
dataTable.Columns[0].Caption = "id";
dataTable.Columns.Add("ID2");
object[] values = new object[] { "Table Features Demo", "" };
dataTable.Rows.Add(values);
//Create the PdfLightTable
PdfLightTable table = new PdfLightTable();
//Set the data source
table.DataSource = dataTable;
// Set the cell styles
table.Style.AlternateStyle = alternateStyle;
// Draw the table
table.Draw(page.Graphics, new PointF(0, 0));
//Save the document
document.Save("Output.pdf");
//Close the document
document.Close(true);
'Create PDF document
Dim document As New PdfDocument()
'Create a new page
Dim page As PdfPage = document.Pages.Add()
'Set font
Dim font As PdfFont = New PdfStandardFont(PdfFontFamily.Helvetica, 8)
'Create PdfPen for drawing border
Dim borderPen As New PdfPen(PdfBrushes.DarkBlue)
borderPen.Width = 0
'Create brush
Dim color As New PdfColor(192, 201, 219)
Dim brush As New PdfSolidBrush(color)
'Create alternative cell style
Dim alternateStyle As New PdfCellStyle()
alternateStyle.Font = font
alternateStyle.BackgroundBrush = brush
alternateStyle.BorderPen = borderPen
'Create DataTable for source
Dim dataTable As New DataTable("Table")
dataTable.Columns.Add("ID1")
dataTable.Columns(0).Caption = "id"
dataTable.Columns.Add("ID2")
Dim values() As Object = { "Table Features Demo", "" }
dataTable.Rows.Add(values)
'Create the PdfLightTable
Dim table As New PdfLightTable()
'Set the data source
table.DataSource = dataTable
' Set the cell styles
table.Style.AlternateStyle = alternateStyle
' Draw the table
table.Draw(page.Graphics, New PointF(0, 0))
'Save the document
document.Save("Output.pdf")
'Close the document
document.Close(True)
See Also
BorderOverlapStyle
Gets or sets a value indicating whether the cell borders should overlap its neighbor's borders or be drawn in the cell interior.
Declaration
public PdfBorderOverlapStyle BorderOverlapStyle { get; set; }
Property Value
Type |
---|
PdfBorderOverlapStyle |
Remarks
Please, use this property with caution,because it might cause unexpected results if borders are not the same width and color.
Examples
// Create a new document
PdfDocument document = new PdfDocument();
//Create a new page
PdfPage page = document.Pages.Add();
//Create PdfLightTable
PdfLightTable table = new PdfLightTable();
// Set the DataSourceType as Direct
table.DataSourceType = PdfLightTableDataSourceType.TableDirect;
// Create new Columns
table.Columns.Add(new PdfColumn("Roll Number"));
table.Columns.Add(new PdfColumn("Name"));
table.Columns.Add(new PdfColumn("Class"));
//set the border overlap style
table.Style.BorderOverlapStyle = PdfBorderOverlapStyle.Inside;
// Add new Rows
table.Rows.Add(new object[] { "111", "Maxim", "III" });
// Draws the table
table.Draw(page, new PointF(0, 0));
//Save the document
document.Save("Output.pdf");
//Close the document
document.Close(true);
' Create a new document
Dim document As New PdfDocument()
'Create a new page
Dim page As PdfPage = document.Pages.Add()
'Create PdfLightTable
Dim table As New PdfLightTable()
' Set the DataSourceType as Direct
table.DataSourceType = PdfLightTableDataSourceType.TableDirect
' Create new Columns
table.Columns.Add(New PdfColumn("Roll Number"))
table.Columns.Add(New PdfColumn("Name"))
table.Columns.Add(New PdfColumn("Class"))
' set the border overlap style
table.Style.BorderOverlapStyle = PdfBorderOverlapStyle.Inside
' Add new Rows
table.Rows.Add(New Object() { "111", "Maxim", "III" })
' Draws the table
table.Draw(page, New PointF(0, 0))
'Save the document
document.Save("Output.pdf")
'Close the document
document.Close(True)
See Also
BorderPen
Gets or sets the color of the table border.
Declaration
public PdfPen BorderPen { get; set; }
Property Value
Type |
---|
PdfPen |
Examples
// Create a new document
PdfDocument document = new PdfDocument();
PdfPage page = document.Pages.Add();
PdfLightTable table = new PdfLightTable();
// Set the DataSourceType as Direct
table.DataSourceType = PdfLightTableDataSourceType.TableDirect;
// Create new Columns
table.Columns.Add(new PdfColumn("Roll Number"));
table.Columns.Add(new PdfColumn("Name"));
table.Columns.Add(new PdfColumn("Class"));
//Add the border pen
table.Style.BorderPen = PdfPens.BlueViolet;
// Add new Rows
table.Rows.Add(new object[] { "111", "Maxim", "III" });
// Draw the table
table.Draw(page, new PointF(0, 0));
//Save the document
document.Save("Output.pdf");
//Close the document
document.Close(true);
' Create a new document
Dim document As New PdfDocument()
Dim page As PdfPage = document.Pages.Add()
Dim table As New PdfLightTable()
' Set the DataSourceType as Direct
table.DataSourceType = PdfLightTableDataSourceType.TableDirect
' Create new Columns
table.Columns.Add(New PdfColumn("Roll Number"))
table.Columns.Add(New PdfColumn("Name"))
table.Columns.Add(New PdfColumn("Class"))
'Add the border pen
table.Style.BorderPen = PdfPens.BlueViolet
' Add new Rows
table.Rows.Add(New Object() { "111", "Maxim", "III" })
' Draw the table
table.Draw(page, New PointF(0, 0))
'Save the document
document.Save("Output.pdf")
'Close the document
document.Close(True)
See Also
CellPadding
Gets or sets the space inside the cells.
Declaration
public float CellPadding { get; set; }
Property Value
Type |
---|
System.Single |
Examples
// Create a new document
PdfDocument document = new PdfDocument();
//Add a page
PdfPage page = document.Pages.Add();
//Create the PdfLightTable
PdfLightTable table = new PdfLightTable();
// Set the DataSourceType as Direct
table.DataSourceType = PdfLightTableDataSourceType.TableDirect;
// Create new Columns
table.Columns.Add(new PdfColumn("Roll Number"));
table.Columns.Add(new PdfColumn("Name"));
table.Columns.Add(new PdfColumn("Class"));
table.Style.HeaderSource = PdfHeaderSource.ColumnCaptions;
// Set the cell padding
table.Style.CellPadding = 8;
// Add new Rows
table.Rows.Add(new object[] { "111", "Maxim", "III" });
// Draws the table
table.Draw(page, new PointF(0, 0));
//Save the document
document.Save("Output.pdf");
//Close the document
document.Close(true);
' Create a new document
Dim document As New PdfDocument()
'Add a page
Dim page As PdfPage = document.Pages.Add()
'Create the PdfLightTable
Dim table As New PdfLightTable()
' Set the DataSourceType as Direct
table.DataSourceType = PdfLightTableDataSourceType.TableDirect
' Create new Columns
table.Columns.Add(New PdfColumn("Roll Number"))
table.Columns.Add(New PdfColumn("Name"))
table.Columns.Add(New PdfColumn("Class"))
table.Style.HeaderSource = PdfHeaderSource.ColumnCaptions
' Set the cell padding
table.Style.CellPadding = 8
' Add new Rows
table.Rows.Add(New Object() { "111", "Maxim", "III" })
' Draws the table
table.Draw(page, New PointF(0, 0))
'Save the document
document.Save("Output.pdf")
'Close the document
document.Close(True)
See Also
CellSpacing
Gets or sets the space between cells.
Declaration
public float CellSpacing { get; set; }
Property Value
Type |
---|
System.Single |
Examples
// Create a new document
PdfDocument document = new PdfDocument();
//Add a page
PdfPage page = document.Pages.Add();
//Create the PdfLightTable
PdfLightTable table = new PdfLightTable();
// Set the DataSourceType as Direct
table.DataSourceType = PdfLightTableDataSourceType.TableDirect;
// Create new Columns
table.Columns.Add(new PdfColumn("Roll Number"));
table.Columns.Add(new PdfColumn("Name"));
table.Columns.Add(new PdfColumn("Class"));
table.Style.HeaderSource = PdfHeaderSource.ColumnCaptions;
//Set the cell spacing
table.Style.CellSpacing = 10;
// Add new Rows
table.Rows.Add(new object[] { "111", "Maxim", "III" });
// Draw the table
table.Draw(page, new PointF(0, 0));
//Save the document
document.Save("Output.pdf");
//Close the document
document.Close(true);
' Create a new document
Dim document As New PdfDocument()
'Add a page
Dim page As PdfPage = document.Pages.Add()
'Create the PdfLightTable
Dim table As New PdfLightTable()
' Set the DataSourceType as Direct
table.DataSourceType = PdfLightTableDataSourceType.TableDirect
' Create new Columns
table.Columns.Add(New PdfColumn("Roll Number"))
table.Columns.Add(New PdfColumn("Name"))
table.Columns.Add(New PdfColumn("Class"))
table.Style.HeaderSource = PdfHeaderSource.ColumnCaptions
'Set the cell spacing
table.Style.CellSpacing = 10
' Add new Rows
table.Rows.Add(New Object() { "111", "Maxim", "III" })
' Draw the table
table.Draw(page, New PointF(0, 0))
'Save the document
document.Save("Output.pdf")
'Close the document
document.Close(True)
See Also
DefaultStyle
Gets or sets the default cell style.
Declaration
public PdfCellStyle DefaultStyle { get; set; }
Property Value
Type |
---|
PdfCellStyle |
Examples
//Create PDF document
PdfDocument document = new PdfDocument();
//Create a new page
PdfPage page = document.Pages.Add();
//Set font
PdfFont font = new PdfStandardFont(PdfFontFamily.Helvetica, 8);
//Create PdfPen for drawing border
PdfPen borderPen = new PdfPen(PdfBrushes.DarkBlue);
borderPen.Width = 0;
// Create default cell style
PdfCellStyle defaultStyle = new PdfCellStyle();
defaultStyle.Font = font;
defaultStyle.BackgroundBrush = PdfBrushes.White;
defaultStyle.BorderPen = borderPen;
//Create DataTable for source
DataTable dataTable = new DataTable("Table");
dataTable.Columns.Add("ID1");
dataTable.Columns[0].Caption = "id";
dataTable.Columns.Add("ID2");
object[] values = new object[] { "Table Features Demo", "" };
dataTable.Rows.Add(values);
//Create the PdfLightTable
PdfLightTable table = new PdfLightTable();
table.DataSource = dataTable;
// Set the default cell style
table.Style.DefaultStyle = defaultStyle;
// Draw the table
table.Draw(page.Graphics, new PointF(0, 0));
//Save the document
document.Save("Output.pdf");
//Close the document
document.Close(true);
'Create PDF document
Dim document As New PdfDocument()
'Create a new page
Dim page As PdfPage = document.Pages.Add()
'Set font
Dim font As PdfFont = New PdfStandardFont(PdfFontFamily.Helvetica, 8)
'Create PdfPen for drawing border
Dim borderPen As New PdfPen(PdfBrushes.DarkBlue)
borderPen.Width = 0
' Create default cell style
Dim defaultStyle As New PdfCellStyle()
defaultStyle.Font = font
defaultStyle.BackgroundBrush = PdfBrushes.White
defaultStyle.BorderPen = borderPen
'Create DataTable for source
Dim dataTable As New DataTable("Table")
dataTable.Columns.Add("ID1")
dataTable.Columns(0).Caption = "id"
dataTable.Columns.Add("ID2")
Dim values() As Object = { "Table Features Demo", "" }
dataTable.Rows.Add(values)
'Create PdfLightTable
Dim table As New PdfLightTable()
'Set the data source
table.DataSource = dataTable
' Set the default cell style
table.Style.DefaultStyle = defaultStyle
' Draw the table
table.Draw(page.Graphics, New PointF(0, 0))
'Save the document
document.Save("Output.pdf")
'Close the document
document.Close(True)
See Also
HeaderRowCount
Gets or sets the header rows count.
Declaration
public int HeaderRowCount { get; set; }
Property Value
Type |
---|
System.Int32 |
Examples
// Create a new document
PdfDocument document = new PdfDocument();
//Add a page
PdfPage page = document.Pages.Add();
//Create the PdfLightTable
PdfLightTable table = new PdfLightTable();
// Set the DataSourceType as Direct
table.DataSourceType = PdfLightTableDataSourceType.TableDirect;
// Create new Columns
table.Columns.Add(new PdfColumn("Roll Number"));
table.Columns.Add(new PdfColumn("Name"));
table.Columns.Add(new PdfColumn("Class"));
table.Style.ShowHeader = true;
table.Style.HeaderRowCount = 2;
// Add new Rows
table.Rows.Add(new object[] { "111", "Maxim", "III" });
// Draw the table
table.Draw(page, new PointF(0, 0));
//Save the document
document.Save("Output.pdf");
//close the document
document.Close(true);
' Create a new document
Dim document As New PdfDocument()
'Add a page
Dim page As PdfPage = document.Pages.Add()
'Create the PdfLightTable
Dim table As New PdfLightTable()
' Set the DataSourceType as Direct
table.DataSourceType = PdfLightTableDataSourceType.TableDirect
' Create new Columns
table.Columns.Add(New PdfColumn("Roll Number"))
table.Columns.Add(New PdfColumn("Name"))
table.Columns.Add(New PdfColumn("Class"))
table.Style.ShowHeader = True
table.Style.HeaderRowCount = 2
' Add new Rows
table.Rows.Add(New Object() { "111", "Maxim", "III" })
' Draw the table
table.Draw(page, New PointF(0, 0))
'Save the document
document.Save("Output.pdf")
'close the document
document.Close(True)
See Also
HeaderSource
Gets or sets a value indicating whether to use rows or column captions for forming header.
Declaration
public PdfHeaderSource HeaderSource { get; set; }
Property Value
Type |
---|
PdfHeaderSource |
Examples
// Create a new document
PdfDocument document = new PdfDocument();
//Add a page
PdfPage page = document.Pages.Add();
//Create the PdfLightTable
PdfLightTable table = new PdfLightTable();
// Set the DataSourceType as Direct
table.DataSourceType = PdfLightTableDataSourceType.TableDirect;
// Create new Columns
table.Columns.Add(new PdfColumn("Roll Number"));
table.Columns.Add(new PdfColumn("Name"));
table.Columns.Add(new PdfColumn("Class"));
//Set the header source
table.Style.HeaderSource = PdfHeaderSource.ColumnCaptions;
// Add new Rows
table.Rows.Add(new object[] { "111", "Maxim", "III" });
// Draw the table
table.Draw(page, new PointF(0, 0));
//save the document
document.Save("Output.pdf");
//Close the document
document.Close(true);
' Create a new document
Dim document As New PdfDocument()
'Add a page
Dim page As PdfPage = document.Pages.Add()
'Create the PdfLightTable
Dim table As New PdfLightTable()
' Set the DataSourceType as Direct
table.DataSourceType = PdfLightTableDataSourceType.TableDirect
' Create new Columns
table.Columns.Add(New PdfColumn("Roll Number"))
table.Columns.Add(New PdfColumn("Name"))
table.Columns.Add(New PdfColumn("Class"))
'Set the header source
table.Style.HeaderSource = PdfHeaderSource.ColumnCaptions
' Add new Rows
table.Rows.Add(New Object() { "111", "Maxim", "III" })
' Draw the table
table.Draw(page, New PointF(0, 0))
'save the document
document.Save("Output.pdf")
'Close the document
document.Close(True)
See Also
HeaderStyle
Gets or sets the header cell style.
Declaration
public PdfCellStyle HeaderStyle { get; set; }
Property Value
Type |
---|
PdfCellStyle |
Examples
//Create PDF document
PdfDocument document = new PdfDocument();
//Create a new page
PdfPage page = document.Pages.Add();
//Set font
PdfFont font = new PdfStandardFont(PdfFontFamily.Helvetica, 8);
// Create header cell style
PdfCellStyle headerStyle = new PdfCellStyle();
headerStyle.Font = font;
headerStyle.BackgroundBrush = PdfBrushes.White;
//Create DataTable for source
DataTable dataTable = new DataTable("Table");
dataTable.Columns.Add("ID1");
dataTable.Columns[0].Caption = "id";
dataTable.Columns.Add("ID2");
object[] values = new object[] { "Table Features Demo", "" };
dataTable.Rows.Add(values);
//Create the PdfLightTable
PdfLightTable table = new PdfLightTable();
//Set the data source
table.DataSource = dataTable;
// Set the cell styles
table.Style.HeaderStyle = headerStyle;
// Draw the table
table.Draw(page.Graphics, new PointF(0, 0));
//Save the document
document.Save("Output.pdf");
//Close the document
document.Close(true);
'Create PDF document
Dim document As New PdfDocument()
'Create a new page
Dim page As PdfPage = document.Pages.Add()
'Set font
Dim font As PdfFont = New PdfStandardFont(PdfFontFamily.Helvetica, 8)
' Create header cell style
Dim headerStyle As New PdfCellStyle()
headerStyle.Font = font
headerStyle.BackgroundBrush = PdfBrushes.White
'Create DataTable for source
Dim dataTable As New DataTable("Table")
dataTable.Columns.Add("ID1")
dataTable.Columns(0).Caption = "id"
dataTable.Columns.Add("ID2")
Dim values() As Object = { "Table Features Demo", "" }
dataTable.Rows.Add(values)
'Create the PdfLightTable
Dim table As New PdfLightTable()
'Set the data source
table.DataSource = dataTable
' Set the cell styles
table.Style.HeaderStyle = headerStyle
' Draw the table
table.Draw(page.Graphics, New PointF(0, 0))
'Save the document
document.Save("Output.pdf")
'Close the document
document.Close(True)
See Also
RepeatHeader
Gets or sets a value indicating whether to repeat header on each page.
Declaration
public bool RepeatHeader { get; set; }
Property Value
Type |
---|
System.Boolean |
Examples
// Create a new document
PdfDocument document = new PdfDocument();
//Add a page
PdfPage page = document.Pages.Add();
//Create the PdfLightTable
PdfLightTable table = new PdfLightTable();
// Set the DataSourceType as Direct
table.DataSourceType = PdfLightTableDataSourceType.TableDirect;
// Create new Columns
table.Columns.Add(new PdfColumn("Roll Number"));
table.Columns.Add(new PdfColumn("Name"));
table.Columns.Add(new PdfColumn("Class"));
table.Style.HeaderSource = PdfHeaderSource.ColumnCaptions;
table.Style.RepeatHeader = true;
// Add new Rows
table.Rows.Add(new object[] { "111", "Maxim", "III" });
// Draw the table
table.Draw(page, new PointF(0, 0));
//Save the document
document.Save("Output.pdf");
//Close the document
document.Close(true);
' Create a new document
Dim document As New PdfDocument()
'Add a page
Dim page As PdfPage = document.Pages.Add()
'Create the PdfLightTable
Dim table As New PdfLightTable()
' Set the DataSourceType as Direct
table.DataSourceType = PdfLightTableDataSourceType.TableDirect
' Create new Columns
table.Columns.Add(New PdfColumn("Roll Number"))
table.Columns.Add(New PdfColumn("Name"))
table.Columns.Add(New PdfColumn("Class"))
table.Style.HeaderSource = PdfHeaderSource.ColumnCaptions
table.Style.RepeatHeader = True
' Add new Rows
table.Rows.Add(New Object() { "111", "Maxim", "III" })
' Draw the table
table.Draw(page, New PointF(0, 0))
'Save the document
document.Save("Output.pdf")
'Close the document
document.Close(True)
See Also
ShowHeader
Gets or sets a value indicating whether the header is visible.
Declaration
public bool ShowHeader { get; set; }
Property Value
Type |
---|
System.Boolean |
Examples
// Create a new document
PdfDocument document = new PdfDocument();
//Add a page
PdfPage page = document.Pages.Add();
//Create the PdfLightTable
PdfLightTable table = new PdfLightTable();
// Set the DataSourceType as Direct
table.DataSourceType = PdfLightTableDataSourceType.TableDirect;
table.Columns.Add(new PdfColumn("Roll Number"));
table.Columns.Add(new PdfColumn("Name"));
table.Columns.Add(new PdfColumn("Class"));
//Set the properties
table.Style.HeaderSource = PdfHeaderSource.ColumnCaptions;
table.Style.ShowHeader = true;
table.Style.HeaderRowCount = 2;
// Add new Rows
table.Rows.Add(new object[] { "111", "Maxim", "III" });
// Draw the table
table.Draw(page, new PointF(0, 0));
//Save the document
document.Save("Output.pdf");
//Close the document
document.Close(true);
' Create a new document
Dim document As New PdfDocument()
'Add a page
Dim page As PdfPage = document.Pages.Add()
'Create the PdfLightTable
Dim table As New PdfLightTable()
' Set the DataSourceType as Direct
table.DataSourceType = PdfLightTableDataSourceType.TableDirect
' Create new Columns
table.Columns.Add(New PdfColumn("Roll Number"))
table.Columns.Add(New PdfColumn("Name"))
table.Columns.Add(New PdfColumn("Class"))
'Set the properties
table.Style.HeaderSource = PdfHeaderSource.ColumnCaptions
table.Style.ShowHeader = True
table.Style.HeaderRowCount = 2
' Add new Rows
table.Rows.Add(New Object() { "111", "Maxim", "III" })
' Draw the table
table.Draw(page, New PointF(0, 0))
'Save the document
document.Save("Output.pdf")
'Close the document
document.Close(True)