Class PdfLightTable
Create table by entering the data manually or from an external data source.
Inherited Members
Namespace: Syncfusion.Pdf.Tables
Assembly: Syncfusion.Pdf.NET.dll
Syntax
public class PdfLightTable : PdfLayoutElement
Examples
//Create a new PDF document.
PdfDocument document = new PdfDocument();
// Add a page.
PdfPage page = document.Pages.Add();
//Create a PdfLightTable.
PdfLightTable pdfLightTable = new PdfLightTable();
//Initialize DataTable to assign as DataSource to the light table.
DataTable table = new DataTable();
//Include columns to the DataTable.
table.Columns.Add("Name");
table.Columns.Add("Age");
table.Columns.Add("Sex");
//Include rows to the DataTable.
table.Rows.Add(new string[] { "abc", "21", "Male" });
// Assign data source.
pdfLightTable.DataSource = table;
// Draw PdfLightTable.
pdfLightTable.Draw(page, new PointF(0, 0));
// Save the document.
document.Save("output.pdf");
//Close the document
document.Close(true);
'Create a new PDF document.
Dim document As New PdfDocument()
'Add a page.
Dim page As PdfPage = document.Pages.Add()
' Create a PdfLightTable.
Dim pdfLightTable As New PdfLightTable()
' Initialize DataTable to assign as DataSource to the light table.
Dim table As New DataTable()
'Include columns to the DataTable.
table.Columns.Add("Name")
table.Columns.Add("Age")
table.Columns.Add("Sex")
'Include rows to the DataTable.
table.Rows.Add(New String() {"abc", "21", "Male"})
'Assign data source.
pdfLightTable.DataSource = table
'Draw PdfLightTable.
pdfLightTable.Draw(page, New PointF(0, 0))
'Save the document.
document.Save("output.pdf")
'Close the document
document.Close(True)
Constructors
PdfLightTable()
Declaration
public PdfLightTable()
Properties
AllowRowBreakAcrossPages
Gets a value indicating the row break is to be made or not.
Declaration
public bool AllowRowBreakAcrossPages { get; set; }
Property Value
Type |
---|
System.Boolean |
Examples
//Create a new PDF document.
PdfDocument doc = new PdfDocument();
//Add a page.
PdfPage page = doc.Pages.Add();
//Create a new PDF light table instance.
PdfLightTable table = new PdfLightTable();
//Create a DataTable.
DataTable dataTable = new DataTable();
//Add columns to the DataTable
dataTable.Columns.Add("ID");
dataTable.Columns.Add("Name");
//Add rows to the DataTable.
dataTable.Rows.Add(new object[] { "E01", "Clay" });
dataTable.Rows.Add(new object[] { "E02", "Thomas" });
dataTable.Rows.Add(new object[] { "E03", "George" });
dataTable.Rows.Add(new object[] { "E04", "Stefan" });
dataTable.Rows.Add(new object[] { "E05", "Mathew" });
//Assign data source.
table.DataSource = dataTable;
//Set row break.
table.AllowRowBreakAcrossPages = true;
//Apply built-in table style
table.ApplyBuiltinStyle(PdfLightTableBuiltinStyle.GridTable1Light);
//Draw light table to the page of PDF document.
table.Draw(page, new PointF(10, 10));
//Save the document.
doc.Save("Output.pdf");
//close the document
doc.Close(true);
'Create a new PDF document.
Dim doc As New PdfDocument()
'Add a page.
Dim page As PdfPage = doc.Pages.Add()
'Create a new PDF light table instance.
Dim table As New PdfLightTable()
'Create a DataTable.
Dim dataTable As New DataTable()
'Add columns to the DataTable
dataTable.Columns.Add("ID")
dataTable.Columns.Add("Name")
'Add rows to the DataTable.
dataTable.Rows.Add(New Object() { "E01", "Clay"})
dataTable.Rows.Add(New Object() { "E02", "Thomas"})
dataTable.Rows.Add(New Object() { "E03", "George"})
dataTable.Rows.Add(New Object() { "E04", "Stefan"})
dataTable.Rows.Add(New Object() { "E05", "Mathew"})
'Assign data source.
table.DataSource = dataTable
'Set row break.
table.AllowRowBreakAcrossPages = True
'Apply built-in table style
table.ApplyBuiltinStyle(PdfLightTableBuiltinStyle.GridTable1Light)
'Draw light table to the page of PDF document.
table.Draw(page, New PointF(10, 10))
'Save the document.
doc.Save("Output.pdf")
'close the document
doc.Close(True)
ColumnProportionalSizing
Gets or sets the value to distribute the available table width by weighted proportions of table columns.
Declaration
public bool ColumnProportionalSizing { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean | Boolean |
Columns
Gets the collection of columns contained in the table.Read-Only.
Declaration
public PdfColumnCollection Columns { get; }
Property Value
Type |
---|
PdfColumnCollection |
Examples
// Create a PDF document
PdfDocument document = new PdfDocument();
//Create a new page
PdfPage page = document.Pages.Add();
//Create the PdfLightTable
PdfLightTable table = new PdfLightTable();
// Set the DataSourceType as Direct
table.DataSourceType = PdfLightTableDataSourceType.TableDirect;
// Get the columns collection
PdfColumnCollection tableColumns = table.Columns;
// Creating Columns
tableColumns.Add(new PdfColumn("Roll Number"));
tableColumns.Add(new PdfColumn("Name"));
tableColumns.Add(new PdfColumn("Class"));
// Get the row collection
PdfRowCollection rows = table.Rows;
// Adding Rows
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 PDF document
Dim document As PdfDocument = New PdfDocument()
'Create a page
Dim page As PdfPage = document.Pages.Add()
'Create the PdfLightTable
Dim table As PdfLightTable = New PdfLightTable()
'Set the DataSourceType as Direct
table.DataSourceType = PdfLightTableDataSourceType.TableDirect
'Get the columns collection
Dim tableColumns As PdfColumnCollection = table.Columns
'Creating Columns
tableColumns.Add(New PdfColumn("Roll Number"))
tableColumns.Add(New PdfColumn("Name"))
tableColumns.Add(New PdfColumn("Class"))
'Adding 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
DataSource
Gets or sets the data source to bind into PdfLightTable.
Declaration
public object DataSource { get; set; }
Property Value
Type |
---|
System.Object |
Examples
//Create a new document.
PdfDocument document = new PdfDocument();
//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 a new page
PdfPage page = document.Pages.Add();
//Create the PdfLightTable
PdfLightTable table = new PdfLightTable();
//set the data source
table.DataSource = dataTable;
//Draw the table
table.Draw(page.Graphics);
//save the document
document.Save("Output.pdf");
//Close the document.
document.Close(true);
// Create a new document
PdfDocument document = new PdfDocument();
//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 a new page
PdfPage page = document.Pages.Add();
//Create the PdfLightTable
PdfLightTable table = new PdfLightTable();
//set the data source
table.DataSource = dataTable;
//Draw the table
table.Draw(page.Graphics);
//save the document
document.Save("Output.pdf");
//Close the document.
document.Close(true);
See Also
DataSourceType
Gets or sets the data source type of the PdfLightTable.
Declaration
public PdfLightTableDataSourceType DataSourceType { get; set; }
Property Value
Type |
---|
PdfLightTableDataSourceType |
Examples
// Create a new document
PdfDocument document = new PdfDocument();
//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 a new page
PdfPage page = document.Pages.Add();
//Create the PdfLightTable
PdfLightTable table = new PdfLightTable();
//Set the data source type
table.DataSourceType = PdfLightTableDataSourceType.TableDirect;
//Set the data table
table.DataSource = dataTable;
Draw the table
table.Draw(page.Graphics);
//Save the document
document.Save("Output.pdf");
//Close the document
document.Close(true);
'Create a new document
Dim document As PdfDocument = New PdfDocument()
'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 a page
Dim page As PdfPage = document.Pages.Add()
'Create the PdfLightTable
Dim table As PdfLightTable = New PdfLightTable()
'Set the data source type
table.DataSourceType = PdfLightTableDataSourceType.TableDirect
'Set the data source
table.DataSource = dataTable
' Draw the table
table.Draw(page.Graphics)
'Save the document
document.Save("Output.pdf")
'Close the document
document.Close(True)
See Also
Rows
Gets the collection of rows contained in the table.Read-Only.
Declaration
public PdfRowCollection Rows { get; }
Property Value
Type |
---|
PdfRowCollection |
Examples
// Create a PDF document
PdfDocument document = new PdfDocument();
//Create a new page
PdfPage page = document.Pages.Add();
PdfLightTable table = new PdfLightTable();
// Set the DataSourceType as Direct
table.DataSourceType = PdfLightTableDataSourceType.TableDirect;
// Get the columns collection
PdfColumnCollection tableColumns = table.Columns;
// Creating Columns
tableColumns.Add(new PdfColumn("Roll Number"));
tableColumns.Add(new PdfColumn("Name"));
tableColumns.Add(new PdfColumn("Class"));
// Get the row collection
PdfRowCollection rows = table.Rows;
// Adding Rows
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 PDF document
Dim document As PdfDocument = New PdfDocument()
' Create a page
Dim page As PdfPage = document.Pages.Add()
Dim table As PdfLightTable = New PdfLightTable()
' Set the DataSourceType as Direct
table.DataSourceType = PdfLightTableDataSourceType.TableDirect
' Get the columns collection
Dim tableColumns As PdfColumnCollection = table.Columns
' Creating Columns
tableColumns.Add(New PdfColumn("Roll Number"))
tableColumns.Add(New PdfColumn("Name"))
tableColumns.Add(New PdfColumn("Class"))
' Get the row collection
Dim rows As PdfRowCollection = table.Rows
' Adding Rows
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
Style
Gets or sets the style properties in PdfLightTable.
Declaration
public PdfLightTableStyle Style { get; set; }
Property Value
Type |
---|
PdfLightTableStyle |
Examples
//Create a new document
PdfDocument document = new PdfDocument();
//Create DataTable for source
DataTable dataTable = new DataTable("myTable");
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 page
PdfPage page = document.Pages.Add();
//Create the PdfLightTable
PdfLightTable table = new PdfLightTable();
//Create the font
PdfFont font = new PdfStandardFont(PdfFontFamily.TimesRoman, 12);
// Alternative cell style
PdfCellStyle altStyle = new PdfCellStyle(font, PdfBrushes.White, PdfPens.Green);
altStyle.BackgroundBrush = PdfBrushes.DarkGray;
// Table header cell style
PdfCellStyle headerStyle = new PdfCellStyle(font, PdfBrushes.White, PdfPens.Brown);
headerStyle.BackgroundBrush = PdfBrushes.Red;
//Set the table style
table.Style.AlternateStyle = altStyle;
table.Style.HeaderStyle = headerStyle;
//set the data source
table.DataSource = dataTable;
// Draw the table
table.Draw(page.Graphics);
//save the document
document.Save("output.pdf");
//Close the document
document.Close(true);
'Create a new document
Dim document As PdfDocument = New PdfDocument()
'Create DataTable for source
Dim dataTable As DataTable = New DataTable("myTable")
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 page
Dim page As PdfPage = document.Pages.Add()
'Create the PdfLightTable
Dim table As PdfLightTable = New PdfLightTable()
'Create the font
Dim font As PdfFont = New PdfStandardFont(PdfFontFamily.TimesRoman, 12)
'Alternative cell style
Dim altStyle As PdfCellStyle = New PdfCellStyle(font, PdfBrushes.White, PdfPens.Green)
altStyle.BackgroundBrush = PdfBrushes.DarkGray
'Table header cell style
Dim headerStyle As PdfCellStyle = New PdfCellStyle(font, PdfBrushes.White, PdfPens.Brown)
headerStyle.BackgroundBrush = PdfBrushes.Red
'Set the table style
table.Style.AlternateStyle = altStyle
table.Style.HeaderStyle = headerStyle
'set the data source
table.DataSource = dataTable
'Draw the table
table.Draw(page.Graphics)
'save the document
document.Save("Output.pdf")
'Close the document
document.Close(True)
See Also
Methods
add_BeginCellLayout(BeginCellLayoutEventHandler)
Declaration
public void add_BeginCellLayout(BeginCellLayoutEventHandler value)
Parameters
Type | Name | Description |
---|---|---|
BeginCellLayoutEventHandler | value |
add_BeginRowLayout(BeginRowLayoutEventHandler)
Declaration
public void add_BeginRowLayout(BeginRowLayoutEventHandler value)
Parameters
Type | Name | Description |
---|---|---|
BeginRowLayoutEventHandler | value |
add_EndCellLayout(EndCellLayoutEventHandler)
Declaration
public void add_EndCellLayout(EndCellLayoutEventHandler value)
Parameters
Type | Name | Description |
---|---|---|
EndCellLayoutEventHandler | value |
add_EndRowLayout(EndRowLayoutEventHandler)
Declaration
public void add_EndRowLayout(EndRowLayoutEventHandler value)
Parameters
Type | Name | Description |
---|---|---|
EndRowLayoutEventHandler | value |
add_QueryColumnCount(QueryColumnCountEventHandler)
Declaration
public void add_QueryColumnCount(QueryColumnCountEventHandler value)
Parameters
Type | Name | Description |
---|---|---|
QueryColumnCountEventHandler | value |
add_QueryNextRow(QueryNextRowEventHandler)
Declaration
public void add_QueryNextRow(QueryNextRowEventHandler value)
Parameters
Type | Name | Description |
---|---|---|
QueryNextRowEventHandler | value |
add_QueryRowCount(QueryRowCountEventHandler)
Declaration
public void add_QueryRowCount(QueryRowCountEventHandler value)
Parameters
Type | Name | Description |
---|---|---|
QueryRowCountEventHandler | value |
ApplyBuiltinStyle(PdfLightTableBuiltinStyle)
Apply built-in table style to the table
Declaration
public void ApplyBuiltinStyle(PdfLightTableBuiltinStyle tableStyle)
Parameters
Type | Name | Description |
---|---|---|
PdfLightTableBuiltinStyle | tableStyle | enum of PdfLightTableBuiltinStyle |
Examples
//Create a new PDF document.
PdfDocument doc = new PdfDocument();
//Add a page.
PdfPage page = doc.Pages.Add();
//Create a new PDF light table instance.
PdfLightTable table = new PdfLightTable();
//Create a DataTable.
DataTable dataTable = new DataTable();
//Add columns to the DataTable
dataTable.Columns.Add("ID");
dataTable.Columns.Add("Name");
//Add rows to the DataTable.
dataTable.Rows.Add(new object[] { "E01", "Clay" });
dataTable.Rows.Add(new object[] { "E02", "Thomas" });
dataTable.Rows.Add(new object[] { "E03", "George" });
dataTable.Rows.Add(new object[] { "E04", "Stefan" });
dataTable.Rows.Add(new object[] { "E05", "Mathew" });
//Assign data source.
table.DataSource = dataTable;
//Apply built-in table style
table.ApplyBuiltinStyle(PdfLightTableBuiltinStyle.ListTable6ColorfulAccent4);
//Draw table to the page of PDF document.
table.Draw(page, new PointF(10, 10));
//Save the document.
doc.Save("Output.pdf");
//close the document
doc.Close(true);
'Create a new PDF document.
Dim doc As New PdfDocument()
'Add a page.
Dim page As PdfPage = doc.Pages.Add()
'Create a new PDF light table instance.
Dim table As New PdfLightTable()
'Create a DataTable.
Dim dataTable As New DataTable()
'Add columns to the DataTable
dataTable.Columns.Add("ID")
dataTable.Columns.Add("Name")
'Add rows to the DataTable.
dataTable.Rows.Add(New Object() { "E01", "Clay"})
dataTable.Rows.Add(New Object() { "E02", "Thomas"})
dataTable.Rows.Add(New Object() { "E03", "George"})
dataTable.Rows.Add(New Object() { "E04", "Stefan"})
dataTable.Rows.Add(New Object() { "E05", "Mathew"})
'Assign data source.
table.DataSource = dataTable
'Apply built-in table style
table.ApplyBuiltinStyle(PdfLightTableBuiltinStyle.ListTable6ColorfulAccent4)
'Draw table to the page of PDF document.
table.Draw(page, New PointF(10, 10))
'Save the document.
doc.Save("Output.pdf")
'close the document
doc.Close(True)
ApplyBuiltinStyle(PdfLightTableBuiltinStyle, PdfLightTableBuiltinStyleSettings)
Apply built-in table style to the table
Declaration
public void ApplyBuiltinStyle(PdfLightTableBuiltinStyle lightTableStyle, PdfLightTableBuiltinStyleSettings lightTableSetting)
Parameters
Type | Name | Description |
---|---|---|
PdfLightTableBuiltinStyle | lightTableStyle | enum of PdfLightTableBuiltinStyle |
PdfLightTableBuiltinStyleSettings | lightTableSetting | The PdfLightTableBuiltinStyleSettings |
Examples
//Create a new PDF document.
PdfDocument doc = new PdfDocument();
//Add a page.
PdfPage page = doc.Pages.Add();
//Create a new PDF light table instance.
PdfLightTable table = new PdfLightTable();
//Create a DataTable.
DataTable dataTable = new DataTable();
//Add columns to the DataTable
dataTable.Columns.Add("ID");
dataTable.Columns.Add("Name");
//Add rows to the DataTable.
dataTable.Rows.Add(new object[] { "E01", "Clay" });
dataTable.Rows.Add(new object[] { "E02", "Thomas" });
dataTable.Rows.Add(new object[] { "E03", "George" });
dataTable.Rows.Add(new object[] { "E04", "Stefan" });
dataTable.Rows.Add(new object[] { "E05", "Mathew" });
//Assign data source.
table.DataSource = dataTable;
//Create PDF light table build style settings instance.
dfLightTableBuiltinStyleSettings settings = new PdfLightTableBuiltinStyleSettings();
settings.ApplyStyleForBandedColumns = true;
settings.ApplyStyleForBandedRows = true;
settings.ApplyStyleForFirstColumn = true;
settings.ApplyStyleForHeaderRow = true;
settings.ApplyStyleForLastColumn = true;
settings.ApplyStyleForLastRow = true;
//Apply built-in table style
table.ApplyBuiltinStyle(PdfLightTableBuiltinStyle.ListTable6ColorfulAccent4, settings);
//Draw table to the page of PDF document.
table.Draw(page, new PointF(10, 10));
//Save the document.
doc.Save("Output.pdf");
//close the document
doc.Close(true);
'Create a new PDF document.
Dim doc As New PdfDocument()
'Add a page.
Dim page As PdfPage = doc.Pages.Add()
'Create a new PDF light table instance.
Dim table As New PdfLightTable()
'Create a DataTable.
Dim dataTable As New DataTable()
'Add columns to the DataTable
dataTable.Columns.Add("ID")
dataTable.Columns.Add("Name")
'Add rows to the DataTable.
dataTable.Rows.Add(New Object() { "E01", "Clay"})
dataTable.Rows.Add(New Object() { "E02", "Thomas"})
dataTable.Rows.Add(New Object() { "E03", "George"})
dataTable.Rows.Add(New Object() { "E04", "Stefan"})
dataTable.Rows.Add(New Object() { "E05", "Mathew"})
'Assign data source.
table.DataSource = dataTable
'Create PDF light table build style settings instance.
Dim settings As New PdfLightTableBuiltinStyleSettings()
settings.ApplyStyleForBandedColumns = True
settings.ApplyStyleForBandedRows = True
settings.ApplyStyleForFirstColumn = True
settings.ApplyStyleForHeaderRow = True
settings.ApplyStyleForLastColumn = True
settings.ApplyStyleForLastRow = True
'Apply built-in table style
table.ApplyBuiltinStyle(PdfLightTableBuiltinStyle.ListTable6ColorfulAccent4, settings)
'Draw table to the page of PDF document.
table.Draw(page, New PointF(10, 10))
'Save the document.
doc.Save("Output.pdf")
'close the document
doc.Close(True)
Draw(PdfGraphics, PointF, Single)
Draw the PdfLightTable in the specified PdfGraphics with specified graphics ,location and width.
Declaration
public void Draw(PdfGraphics graphics, PointF location, float width)
Parameters
Type | Name | Description |
---|---|---|
PdfGraphics | graphics | Graphics context where the element should be printed. |
PointF | location | The location of the element. |
System.Single | width | The width of the table. |
Examples
//Create a new PDF document.
PdfDocument document = new PdfDocument();
//Add a page.
PdfPage page = document.Pages.Add();
// Create a PdfLightTable.
PdfLightTable pdfLightTable = new PdfLightTable();
// Initialize DataTable to assign as DataSource to the light table.
DataTable table = new DataTable();
//Include columns to the DataTable.
table.Columns.Add("Name");
table.Columns.Add("Age");
table.Columns.Add("Sex");
//Include rows to the DataTable.
table.Rows.Add(new string[] { "abc", "21", "Male" });
//Assign data source.
pdfLightTable.DataSource = table;
//Draw PdfLightTable.
pdfLightTable.Draw(page.Graphics, new PointF(0, 0),500);
//Save the document.
document.Save("Output.pdf");
//Close the document
document.Close(true);
'Create a new PDF document.
Dim document As New PdfDocument()
'Add a page.
Dim page As PdfPage = document.Pages.Add()
' Create a PdfLightTable.
Dim pdfLightTable As New PdfLightTable()
' Initialize DataTable to assign as DataSource to the light table.
Dim table As New DataTable()
'Include columns to the DataTable.
table.Columns.Add("Name")
table.Columns.Add("Age")
table.Columns.Add("Sex")
'Include rows to the DataTable.
table.Rows.Add(New String() { "abc", "21", "Male" })
'Assign data source.
pdfLightTable.DataSource = table
'Draw PdfLightTable.
pdfLightTable.Draw(page.Graphics, New PointF(0, 0),500)
'Save the document.
document.Save("Output.pdf")
'Close the document
document.Close(True)
Draw(PdfGraphics, RectangleF)
Declaration
public void Draw(PdfGraphics graphics, RectangleF bounds)
Parameters
Type | Name | Description |
---|---|---|
PdfGraphics | graphics | Graphics context where the element should be drawn. |
RectangleF | bounds | The bounds of the table should be drawn. |
Examples
//Create a new PDF document.
PdfDocument document = new PdfDocument();
//Add a page.
PdfPage page = document.Pages.Add();
// Create a PdfLightTable.
PdfLightTable pdfLightTable = new PdfLightTable();
// Initialize DataTable to assign as DataSource to the light table.
DataTable table = new DataTable();
//Include columns to the DataTable.
table.Columns.Add("Name");
table.Columns.Add("Age");
table.Columns.Add("Sex");
//Include rows to the DataTable.
table.Rows.Add(new string[] { "abc", "21", "Male" });
//Assign data source.
pdfLightTable.DataSource = table;
//Draw PdfLightTable.
pdfLightTable.Draw(page.Graphics, new RectangleF(0, 0,500,500));
//Save the document.
document.Save("Output.pdf");
//Close the document
document.Close(true);
'Create a new PDF document.
Dim document As New PdfDocument()
'Add a page.
Dim page As PdfPage = document.Pages.Add()
' Create a PdfLightTable.
Dim pdfLightTable As New PdfLightTable()
' Initialize DataTable to assign as DataSource to the light table.
Dim table As New DataTable()
'Include columns to the DataTable.
table.Columns.Add("Name")
table.Columns.Add("Age")
table.Columns.Add("Sex")
'Include rows to the DataTable.
table.Rows.Add(New String() { "abc", "21", "Male" })
'Assign data source.
pdfLightTable.DataSource = table
'Draw PdfLightTable.
pdfLightTable.Draw(page.Graphics, New RectangleF(0, 0,500,500))
'Save the document.
document.Save("Output.pdf")
'Close the document
document.Close(True)
Draw(PdfGraphics, Single, Single)
Draw the PdfLightTable in the specified PdfGraphics and x,y coordinates.
Declaration
public override void Draw(PdfGraphics graphics, float x, float y)
Parameters
Type | Name | Description |
---|---|---|
PdfGraphics | graphics | Graphics context where the element should be printed. |
System.Single | x | The x co-ordinate of the element. |
System.Single | y | The y co-ordinate of the element. |
Overrides
Examples
//Create a new PDF document.
PdfDocument document = new PdfDocument();
//Add a page.
PdfPage page = document.Pages.Add();
// Create a PdfLightTable.
PdfLightTable pdfLightTable = new PdfLightTable();
// Initialize DataTable to assign as DataSource to the light table.
DataTable table = new DataTable();
//Include columns to the Data Table.
table.Columns.Add("Name");
table.Columns.Add("Age");
table.Columns.Add("Sex");
//Include rows to the Data Table.//you can add multiple rows
table.Rows.Add(new string[] { "abc", "21", "Male" });
//Assign data source.
pdfLightTable.DataSource = table;
//Draw PdfLightTable.
pdfLightTable.Draw(page.Graphics, 10, 10);
//Save the document.
document.Save("Output.pdf");
//Close the document
document.Close(true);
'Create a new PDF document.
Dim document As New PdfDocument()
'Add a page.
Dim page As PdfPage = document.Pages.Add()
' Create a PdfLightTable.
Dim pdfLightTable As New PdfLightTable()
' Initialize DataTable to assign as DataSource to the light table.
Dim table As New DataTable()
'Include columns to the Data Table.
table.Columns.Add("Name")
table.Columns.Add("Age")
table.Columns.Add("Sex")
'Include rows to the Data Table.//you can add multiple rows
table.Rows.Add(New String() { "abc", "21", "Male" })
'Assign data source.
pdfLightTable.DataSource = table
'Draw PdfLightTable.
pdfLightTable.Draw(page.Graphics, 10, 10)
'Save the document.
document.Save("Output.pdf")
'Close the document
document.Close(True)
Draw(PdfGraphics, Single, Single, Single)
Draw the PdfLightTable with the specified PdfGraphics,x and y coordinates and width.
Declaration
public void Draw(PdfGraphics graphics, float x, float y, float width)
Parameters
Type | Name | Description |
---|---|---|
PdfGraphics | graphics | Graphics context where the element should be drawn. |
System.Single | x | The x co-ordinate of the element. |
System.Single | y | The y co-ordinate of the element. |
System.Single | width | The width of the table. |
Examples
//Create a new PDF document.
PdfDocument document = new PdfDocument();
//Add a page.
PdfPage page = document.Pages.Add();
// Create a PdfLightTable.
PdfLightTable pdfLightTable = new PdfLightTable();
// Initialize DataTable to assign as DataSource to the light table.
DataTable table = new DataTable();
//Include columns to the DataTable.
table.Columns.Add("Name");
table.Columns.Add("Age");
table.Columns.Add("Sex");
//Include rows to the DataTable.
table.Rows.Add(new string[] { "abc", "21", "Male" });
//Assign data source.
pdfLightTable.DataSource = table;
//Draw PdfLightTable.
pdfLightTable.Draw(page.Graphics, 10, 10, 500);
//Save the document.
document.Save("Output.pdf");
//Close the document
document.Close(true);
'Create a new PDF document.
Dim document As New PdfDocument()
'Add a page.
Dim page As PdfPage = document.Pages.Add()
' Create a PdfLightTable.
Dim pdfLightTable As New PdfLightTable()
' Initialize DataTable to assign as DataSource to the light table.
Dim table As New DataTable()
'Include columns to the DataTable.
table.Columns.Add("Name")
table.Columns.Add("Age")
table.Columns.Add("Sex")
'Include rows to the DataTable.
table.Rows.Add(New String() { "abc", "21", "Male" })
'Assign data source.
pdfLightTable.DataSource = table
'Draw PdfLightTable.
pdfLightTable.Draw(page.Graphics, 10, 10, 500)
'Save the document.
document.Save("Output.pdf")
'Close the document
document.Close(True)
Draw(PdfPage, PointF)
Draw the PdfLightTable in the specified PdfPage and location.
Declaration
public PdfLightTableLayoutResult Draw(PdfPage page, PointF location)
Parameters
Type | Name | Description |
---|---|---|
PdfPage | page | The page of the table should be drawn. |
PointF | location | The x,y coordinates of the table. |
Returns
Type | Description |
---|---|
PdfLightTableLayoutResult | The PdfLightTable layout result |
Examples
//Create a new PDF document.
PdfDocument document = new PdfDocument();
//Add a page.
PdfPage page = document.Pages.Add();
// Create a PdfLightTable.
PdfLightTable pdfLightTable = new PdfLightTable();
// Initialize DataTable to assign as DataSource to the light table.
DataTable table = new DataTable();
//Include columns to the DataTable.
table.Columns.Add("Name");
table.Columns.Add("Age");
table.Columns.Add("Sex");
//Include rows to the DataTable.
table.Rows.Add(new string[] { "abc", "21", "Male" });
//Assign data source.
pdfLightTable.DataSource = table;
//Draw PdfLightTable.
pdfLightTable.Draw(page, new PointF(0, 0));
//Save the document.
document.Save("Output.pdf");
//Close the document
document.Close(true);
'Create a new PDF document.
Dim document As New PdfDocument()
'Add a page.
Dim page As PdfPage = document.Pages.Add()
' Create a PdfLightTable.
Dim pdfLightTable As New PdfLightTable()
' Initialize DataTable to assign as DataSource to the light table.
Dim table As New DataTable()
'Include columns to the DataTable.
table.Columns.Add("Name")
table.Columns.Add("Age")
table.Columns.Add("Sex")
'Include rows to the DataTable.
table.Rows.Add(New String() { "abc", "21", "Male" })
'Assign data source.
pdfLightTable.DataSource = table
'Draw PdfLightTable.
pdfLightTable.Draw(page, New PointF(0, 0))
'Save the document.
document.Save("Output.pdf")
'Close the document
document.Close(True)
Draw(PdfPage, PointF, PdfLightTableLayoutFormat)
Draw the PdfLightTable in the specified PdfPage,location and PdfLightTableLayoutFormat.
Declaration
public PdfLightTableLayoutResult Draw(PdfPage page, PointF location, PdfLightTableLayoutFormat format)
Parameters
Type | Name | Description |
---|---|---|
PdfPage | page | The page of the table should be drawn. |
PointF | location | The x,y coordinates of the table. |
PdfLightTableLayoutFormat | format | The PdfLightTable layout format. |
Returns
Type | Description |
---|---|
PdfLightTableLayoutResult | The PdfLightTable layout result. |
Examples
//Create a new PDF document.
PdfDocument document = new PdfDocument();
//Add a page.
PdfPage page = document.Pages.Add();
// Create a PdfLightTable.
PdfLightTable pdfLightTable = new PdfLightTable();
// Initialize DataTable to assign as DataSource to the light table.
DataTable table = new DataTable();
//Include columns to the Data Table.
table.Columns.Add("Name");
table.Columns.Add("Age");
table.Columns.Add("Sex");
//Include rows to the Data Table.//you can add multiple rows
table.Rows.Add(new string[] { "abc", "21", "Male" });
//Assign data source.
pdfLightTable.DataSource = table;
//Set properties to paginate the table.
PdfLightTableLayoutFormat layoutFormat = new PdfLightTableLayoutFormat();
layoutFormat.Break = PdfLayoutBreakType.FitPage;
layoutFormat.Layout = PdfLayoutType.Paginate;
//Draw PdfLightTable.
pdfLightTable.Draw(page, new PointF(0, 0), layoutFormat);
//Save the document.
document.Save("Output.pdf");
//Close the document
document.Close(true);
'Create a new PDF document.
Dim document As New PdfDocument()
'Add a page.
Dim page As PdfPage = document.Pages.Add()
' Create a PdfLightTable.
Dim pdfLightTable As New PdfLightTable()
' Initialize DataTable to assign as DataSource to the light table.
Dim table As New DataTable()
'Include columns to the Data Table.
table.Columns.Add("Name")
table.Columns.Add("Age")
table.Columns.Add("Sex")
'Include rows to the Data Table.//you can add multiple rows
table.Rows.Add(New String() { "abc", "21", "Male" })
'Assign data source.
pdfLightTable.DataSource = table
'Set properties to paginate the table.
Dim layoutFormat As New PdfLightTableLayoutFormat()
layoutFormat.Break = PdfLayoutBreakType.FitPage
layoutFormat.Layout = PdfLayoutType.Paginate
'Draw PdfLightTable.
pdfLightTable.Draw(page, New PointF(0, 0), layoutFormat)
'Save the document.
document.Save("Output.pdf")
'Close the document
document.Close(True)
Draw(PdfPage, RectangleF)
Draw the PdfLightTable in the specified PdfPage and bounds.
Declaration
public PdfLightTableLayoutResult Draw(PdfPage page, RectangleF bounds)
Parameters
Type | Name | Description |
---|---|---|
PdfPage | page | The page of the table should be drawn. |
RectangleF | bounds | The bounds of the table. |
Returns
Type | Description |
---|---|
PdfLightTableLayoutResult | The PdfLightTable layout result |
Examples
//Create a new PDF document.
PdfDocument document = new PdfDocument();
//Add a page.
PdfPage page = document.Pages.Add();
// Create a PdfLightTable.
PdfLightTable pdfLightTable = new PdfLightTable();
// Initialize DataTable to assign as DataSource to the light table.
DataTable table = new DataTable();
//Include columns to the DataTable.
table.Columns.Add("Name");
table.Columns.Add("Age");
table.Columns.Add("Sex");
//Include rows to the DataTable.
table.Rows.Add(new string[] { "abc", "21", "Male" });
//Assign data source.
pdfLightTable.DataSource = table;
//Draw PdfLightTable.
pdfLightTable.Draw(page, new RectangleF(0,0,500,500));
//Save the document.
document.Save("Output.pdf");
//Close the document
document.Close(true);
'Create a new PDF document.
Dim document As New PdfDocument()
'Add a page.
Dim page As PdfPage = document.Pages.Add()
' Create a PdfLightTable.
Dim pdfLightTable As New PdfLightTable()
' Initialize DataTable to assign as DataSource to the light table.
Dim table As New DataTable()
'Include columns to the DataTable.
table.Columns.Add("Name")
table.Columns.Add("Age")
table.Columns.Add("Sex")
'Include rows to the DataTable.
table.Rows.Add(New String() { "abc", "21", "Male" })
'Assign data source.
pdfLightTable.DataSource = table
'Draw PdfLightTable.
pdfLightTable.Draw(page, New RectangleF(0,0,500,500))
'Save the document.
document.Save("Output.pdf")
'Close the document
document.Close(True)
Draw(PdfPage, RectangleF, PdfLightTableLayoutFormat)
Draw the PdfLightTable in the specified PdfPage,bounds and layout format.
Declaration
public PdfLightTableLayoutResult Draw(PdfPage page, RectangleF bounds, PdfLightTableLayoutFormat format)
Parameters
Type | Name | Description |
---|---|---|
PdfPage | page | The page of the table should be drawn. |
RectangleF | bounds | The bounds of the table. |
PdfLightTableLayoutFormat | format | The PdfLightTable layout format. |
Returns
Type | Description |
---|---|
PdfLightTableLayoutResult | The PdfLightTable layout result |
Examples
//Create a new PDF document.
PdfDocument document = new PdfDocument();
//Add a page.
PdfPage page = document.Pages.Add();
// Create a PdfLightTable.
PdfLightTable pdfLightTable = new PdfLightTable();
// Initialize DataTable to assign as DataSource to the light table.
DataTable table = new DataTable();
//Include columns to the Data Table.
table.Columns.Add("Name");
table.Columns.Add("Age");
table.Columns.Add("Sex");
//Include rows to the Data Table.//you can add multiple rows
table.Rows.Add(new string[] { "abc", "21", "Male" });
//Assign data source.
pdfLightTable.DataSource = table;
//Set properties to paginate the table.
PdfLightTableLayoutFormat layoutFormat = new PdfLightTableLayoutFormat();
layoutFormat.Break = PdfLayoutBreakType.FitPage;
layoutFormat.Layout = PdfLayoutType.Paginate;
//Draw PdfLightTable.
pdfLightTable.Draw(page, new RectangleF(0, 0,500,500), layoutFormat);
//Save the document.
document.Save("Output.pdf");
//Close the document
document.Close(true);
'Create a new PDF document.
Dim document As New PdfDocument()
'Add a page.
Dim page As PdfPage = document.Pages.Add()
' Create a PdfLightTable.
Dim pdfLightTable As New PdfLightTable()
' Initialize DataTable to assign as DataSource to the light table.
Dim table As New DataTable()
'Include columns to the Data Table.
table.Columns.Add("Name")
table.Columns.Add("Age")
table.Columns.Add("Sex")
'Include rows to the Data Table.//you can add multiple rows
table.Rows.Add(New String() { "abc", "21", "Male" })
'Assign data source.
pdfLightTable.DataSource = table
'Set properties to paginate the table.
Dim layoutFormat As New PdfLightTableLayoutFormat()
layoutFormat.Break = PdfLayoutBreakType.FitPage
layoutFormat.Layout = PdfLayoutType.Paginate
'Draw PdfLightTable.
pdfLightTable.Draw(page, New RectangleF(0, 0,500,500), layoutFormat)
'Save the document.
document.Save("Output.pdf")
'Close the document
document.Close(True)
Draw(PdfPage, Single, Single)
Draw the PdfLightTable in the specified PdfPage and x, y coordinates.
Declaration
public PdfLightTableLayoutResult Draw(PdfPage page, float x, float y)
Parameters
Type | Name | Description |
---|---|---|
PdfPage | page | The page of the table should be drawn. |
System.Single | x | The X co-ordinate of the element. |
System.Single | y | The y coordinate of the element. |
Returns
Type | Description |
---|---|
PdfLightTableLayoutResult | The PdfLightTable layout result |
Examples
//Create a new PDF document.
PdfDocument document = new PdfDocument();
//Add a page.
PdfPage page = document.Pages.Add();
// Create a PdfLightTable.
PdfLightTable pdfLightTable = new PdfLightTable();
// Initialize DataTable to assign as DataSource to the light table.
DataTable table = new DataTable();
//Include columns to the DataTable.
table.Columns.Add("Name");
table.Columns.Add("Age");
table.Columns.Add("Sex");
//Include rows to the DataTable.
table.Rows.Add(new string[] { "abc", "21", "Male" });
//Assign data source.
pdfLightTable.DataSource = table;
//Draw PdfLightTable.
pdfLightTable.Draw(page, 10, 10);
//Save the document.
document.Save("Output.pdf");
//Close the document
document.Close(true);
'Create a new PDF document.
Dim document As New PdfDocument()
'Add a page.
Dim page As PdfPage = document.Pages.Add()
' Create a PdfLightTable.
Dim pdfLightTable As New PdfLightTable()
' Initialize DataTable to assign as DataSource to the light table.
Dim table As New DataTable()
'Include columns to the DataTable.
table.Columns.Add("Name")
table.Columns.Add("Age")
table.Columns.Add("Sex")
'Include rows to the DataTable.
table.Rows.Add(New String() { "abc", "21", "Male" })
'Assign data source.
pdfLightTable.DataSource = table
'Draw PdfLightTable.
pdfLightTable.Draw(page, 10, 10)
'Save the document.
document.Save("Output.pdf")
'Close the document
Draw(PdfPage, Single, Single, PdfLightTableLayoutFormat)
Draw the PdfLightTable in the specified PdfPage , x,y coordinates and layout format.
Declaration
public PdfLightTableLayoutResult Draw(PdfPage page, float x, float y, PdfLightTableLayoutFormat format)
Parameters
Type | Name | Description |
---|---|---|
PdfPage | page | The page of the table should be drawn. |
System.Single | x | The x co-ordinate of the element. |
System.Single | y | The y coordinate of the element. |
PdfLightTableLayoutFormat | format | The PdfLightTable layout format. |
Returns
Type | Description |
---|---|
PdfLightTableLayoutResult | The PdfLightTable layout result. |
Examples
//Create a new PDF document.
PdfDocument document = new PdfDocument();
//Add a page.
PdfPage page = document.Pages.Add();
// Create a PdfLightTable.
PdfLightTable pdfLightTable = new PdfLightTable();
// Initialize DataTable to assign as DataSource to the light table.
DataTable table = new DataTable();
//Include columns to the Data Table.
table.Columns.Add("Name");
table.Columns.Add("Age");
table.Columns.Add("Sex");
//Include rows to the Data Table.//you can add multiple rows
table.Rows.Add(new string[] { "abc", "21", "Male" });
//Assign data source.
pdfLightTable.DataSource = table;
//Set properties to paginate the table.
PdfLightTableLayoutFormat layoutFormat = new PdfLightTableLayoutFormat();
layoutFormat.Break = PdfLayoutBreakType.FitPage;
layoutFormat.Layout = PdfLayoutType.Paginate;
//Draw PdfLightTable.
pdfLightTable.Draw(page, 10, 10, layoutFormat);
//Save the document.
document.Save("Output.pdf");
//Close the document
document.Close(true);
'Create a new PDF document.
Dim document As New PdfDocument()
'Add a page.
Dim page As PdfPage = document.Pages.Add()
' Create a PdfLightTable.
Dim pdfLightTable As New PdfLightTable()
' Initialize DataTable to assign as DataSource to the light table.
Dim table As New DataTable()
'Include columns to the Data Table.
table.Columns.Add("Name")
table.Columns.Add("Age")
table.Columns.Add("Sex")
'Include rows to the Data Table.//you can add multiple rows
table.Rows.Add(New String() { "abc", "21", "Male" })
'Assign data source.
pdfLightTable.DataSource = table
'Set properties to paginate the table.
Dim layoutFormat As New PdfLightTableLayoutFormat()
layoutFormat.Break = PdfLayoutBreakType.FitPage
layoutFormat.Layout = PdfLayoutType.Paginate
'Draw PdfLightTable.
pdfLightTable.Draw(page, 10, 10, layoutFormat)
'Save the document.
document.Save("Output.pdf")
'Close the document
document.Close(True)
Draw(PdfPage, Single, Single, Single)
Draw the PdfLightTable in the specified PdfPage ,x,y coordinates and width.
Declaration
public PdfLightTableLayoutResult Draw(PdfPage page, float x, float y, float width)
Parameters
Type | Name | Description |
---|---|---|
PdfPage | page | The page of the table should be drawn. |
System.Single | x | The x co-ordinate of the element. |
System.Single | y | The y coordinate of the element. |
System.Single | width | The width of the table. |
Returns
Type | Description |
---|---|
PdfLightTableLayoutResult | The PdfLightTable layout result |
Examples
//Create a new PDF document.
PdfDocument document = new PdfDocument();
//Add a page.
PdfPage page = document.Pages.Add();
// Create a PdfLightTable.
PdfLightTable pdfLightTable = new PdfLightTable();
// Initialize DataTable to assign as DataSource to the light table.
DataTable table = new DataTable();
//Include columns to the Data Table.
table.Columns.Add("Name");
table.Columns.Add("Age");
table.Columns.Add("Sex");
//Include rows to the Data Table.//you can add multiple rows
table.Rows.Add(new string[] { "abc", "21", "Male" });
//Assign data source.
pdfLightTable.DataSource = table;
//Draw PdfLightTable.
pdfLightTable.Draw(page, 10, 10, 500);
//Save the document.
document.Save("Output.pdf");
//Close the document
document.Close(true);
'Create a new PDF document.
Dim document As New PdfDocument()
'Add a page.
Dim page As PdfPage = document.Pages.Add()
' Create a PdfLightTable.
Dim pdfLightTable As New PdfLightTable()
' Initialize DataTable to assign as DataSource to the light table.
Dim table As New DataTable()
'Include columns to the Data Table.
table.Columns.Add("Name")
table.Columns.Add("Age")
table.Columns.Add("Sex")
'Include rows to the Data Table.//you can add multiple rows
table.Rows.Add(New String() { "abc", "21", "Male" })
'Assign data source.
pdfLightTable.DataSource = table
'Draw PdfLightTable.
pdfLightTable.Draw(page, 10, 10, 500)
'Save the document.
document.Save("Output.pdf")
'Close the document
document.Close(True)
Draw(PdfPage, Single, Single, Single, PdfLightTableLayoutFormat)
Draw the PdfLightTable in the specified PdfPage,x,y coordinates,width and layout format.
Declaration
public PdfLightTableLayoutResult Draw(PdfPage page, float x, float y, float width, PdfLightTableLayoutFormat format)
Parameters
Type | Name | Description |
---|---|---|
PdfPage | page | The page of the table should be drawn. |
System.Single | x | The x coordinate of the element. |
System.Single | y | The y coordinate of the element. |
System.Single | width | The width of the table. |
PdfLightTableLayoutFormat | format | The PdfLightTable layout format. |
Returns
Type | Description |
---|---|
PdfLightTableLayoutResult | The PdfLightTable layout result. |
Examples
//Create a new PDF document.
PdfDocument document = new PdfDocument();
//Add a page.
PdfPage page = document.Pages.Add();
// Create a PdfLightTable.
PdfLightTable pdfLightTable = new PdfLightTable();
// Initialize DataTable to assign as DataSource to the light table.
DataTable table = new DataTable();
//Include columns to the Data Table.
table.Columns.Add("Name");
table.Columns.Add("Age");
table.Columns.Add("Sex");
//Include rows to the Data Table.//you can add multiple rows
table.Rows.Add(new string[] { "abc", "21", "Male" });
//Assign data source.
pdfLightTable.DataSource = table;
//Set properties to paginate the table.
PdfLightTableLayoutFormat layoutFormat = new PdfLightTableLayoutFormat();
layoutFormat.Break = PdfLayoutBreakType.FitPage;
layoutFormat.Layout = PdfLayoutType.Paginate;
//Draw PdfLightTable.
pdfLightTable.Draw(page, 10,10,500, layoutFormat);
//Save the document.
document.Save("Output.pdf");
//Close the document
document.Close(true);
'Create a new PDF document.
Dim document As New PdfDocument()
'Add a page.
Dim page As PdfPage = document.Pages.Add()
' Create a PdfLightTable.
Dim pdfLightTable As New PdfLightTable()
' Initialize DataTable to assign as DataSource to the light table.
Dim table As New DataTable()
'Include columns to the Data Table.
table.Columns.Add("Name")
table.Columns.Add("Age")
table.Columns.Add("Sex")
'Include rows to the Data Table.//you can add multiple rows
table.Rows.Add(New String() { "abc", "21", "Male" })
'Assign data source.
pdfLightTable.DataSource = table
'Set properties to paginate the table.
Dim layoutFormat As New PdfLightTableLayoutFormat()
layoutFormat.Break = PdfLayoutBreakType.FitPage
layoutFormat.Layout = PdfLayoutType.Paginate
'Draw PdfLightTable.
pdfLightTable.Draw(page, 10,10,500, layoutFormat)
'Save the document.
document.Save("Output.pdf")
'Close the document
document.Close(True)
Layout(PdfLayoutParams)
Layouts the element.
Declaration
protected override PdfLayoutResult Layout(PdfLayoutParams param)
Parameters
Type | Name | Description |
---|---|---|
PdfLayoutParams | param | Lay outing parameters. |
Returns
Type | Description |
---|---|
PdfLayoutResult | Returns lay outing results. |
Overrides
remove_BeginCellLayout(BeginCellLayoutEventHandler)
Declaration
public void remove_BeginCellLayout(BeginCellLayoutEventHandler value)
Parameters
Type | Name | Description |
---|---|---|
BeginCellLayoutEventHandler | value |
remove_BeginRowLayout(BeginRowLayoutEventHandler)
Declaration
public void remove_BeginRowLayout(BeginRowLayoutEventHandler value)
Parameters
Type | Name | Description |
---|---|---|
BeginRowLayoutEventHandler | value |
remove_EndCellLayout(EndCellLayoutEventHandler)
Declaration
public void remove_EndCellLayout(EndCellLayoutEventHandler value)
Parameters
Type | Name | Description |
---|---|---|
EndCellLayoutEventHandler | value |
remove_EndRowLayout(EndRowLayoutEventHandler)
Declaration
public void remove_EndRowLayout(EndRowLayoutEventHandler value)
Parameters
Type | Name | Description |
---|---|---|
EndRowLayoutEventHandler | value |
remove_QueryColumnCount(QueryColumnCountEventHandler)
Declaration
public void remove_QueryColumnCount(QueryColumnCountEventHandler value)
Parameters
Type | Name | Description |
---|---|---|
QueryColumnCountEventHandler | value |
remove_QueryNextRow(QueryNextRowEventHandler)
Declaration
public void remove_QueryNextRow(QueryNextRowEventHandler value)
Parameters
Type | Name | Description |
---|---|---|
QueryNextRowEventHandler | value |
remove_QueryRowCount(QueryRowCountEventHandler)
Declaration
public void remove_QueryRowCount(QueryRowCountEventHandler value)
Parameters
Type | Name | Description |
---|---|---|
QueryRowCountEventHandler | value |
SetDataSource()
Declaration
public void SetDataSource()
Events
BeginCellLayout
The event raised on starting cell lay outing.
Declaration
public event BeginCellLayoutEventHandler BeginCellLayout
Event Type
Type |
---|
BeginCellLayoutEventHandler |
Examples
// Create a new document
PdfDocument document = new PdfDocument();
//Create a Page
PdfPage page = document.Pages.Add();
//Create DataTable for source
DataTable dataTable = new DataTable("myTable");
dataTable.Columns.Add("ID1");
dataTable.Columns[0].Caption = "id";
dataTable.Columns.Add("ID2");
object[] values = new object[] { "Roll Number", "Student Name" };
dataTable.Rows.Add(values);
values = new object[] { "011", "Cris" };
dataTable.Rows.Add(values);
values = new object[] { "011", "Clay" };
dataTable.Rows.Add(values);
//Create the PdfLightTable
PdfLightTable pdfLightTable = new PdfLightTable();
// Subscribe the cell layout event
pdfLightTable.BeginCellLayout += new BeginCellLayoutEventHandler(table_BeginCellLayout);
pdfLightTable.DataSource = dataTable;
pdfLightTable.Style.CellPadding = 16;
//Draw PdfLightTable.
pdfLightTable.Draw(page, new PointF(0, 0));
//Save the document.
document.Save("Output.pdf");
//Close the document
document.Close(true);
// Cell layout event handler
void table_BeginCellLayout(object sender, BeginCellLayoutEventArgs args)
{
if (args.RowIndex == 1)
{
args.Graphics.DrawRectangle(new PdfPen(PdfBrushes.Red, 2), PdfBrushes.White, args.Bounds);
}
}
' Create a new document
Dim document As New PdfDocument()
'Create a Page
Dim page As PdfPage = document.Pages.Add()
'Create DataTable for source
Dim dataTable As New DataTable("myTable")
dataTable.Columns.Add("ID1")
dataTable.Columns(0).Caption = "id"
dataTable.Columns.Add("ID2")
Dim values() As Object = { "Roll Number", "Student Name" }
dataTable.Rows.Add(values)
values = New Object() { "011", "Cris" }
dataTable.Rows.Add(values)
values = New Object() { "011", "Clay" }
dataTable.Rows.Add(values)
'Create the PdfLightTable
Dim pdfLightTable As New PdfLightTable()
' Subscribe the cell layout event
AddHandler pdfLightTable.BeginCellLayout, AddressOf table_BeginCellLayout
pdfLightTable.DataSource = dataTable
pdfLightTable.Style.CellPadding = 16
'Draw PdfLightTable.
pdfLightTable.Draw(page, New PointF(0, 0))
'Save the document.
document.Save("Output.pdf")
'Close the document
document.Close(True)
' Cell layout event handler
Private Sub table_BeginCellLayout(ByVal sender As Object, ByVal args As BeginCellLayoutEventArgs)
If args.RowIndex = 1 Then
args.Graphics.DrawRectangle(New PdfPen(PdfBrushes.Red, 2), PdfBrushes.White, args.Bounds)
End If
End Sub
BeginRowLayout
The event raised on starting row lay outing.
Declaration
public event BeginRowLayoutEventHandler BeginRowLayout
Event Type
Type |
---|
BeginRowLayoutEventHandler |
Examples
// Create a new document
PdfDocument document = new PdfDocument();
//Create a Page
PdfPage page = document.Pages.Add();
//Create DataTable for source
DataTable dataTable = new DataTable("myTable");
dataTable.Columns.Add("ID1");
dataTable.Columns[0].Caption = "id";
dataTable.Columns.Add("ID2");
object[] values = new object[] { "Roll Number", "Student Name" };
dataTable.Rows.Add(values);
values = new object[] { "011", "Cris" };
dataTable.Rows.Add(values);
values = new object[] { "011", "Clay" };
dataTable.Rows.Add(values);
//Create the PdfLightTable
PdfLightTable pdfLightTable = new PdfLightTable();
// Subscribe the begin row event
pdfLightTable.BeginRowLayout += new BeginRowLayoutEventHandler(table_BeginRowLayout);
//Set the data source
pdfLightTable.DataSource = dataTable;
//Draw PdfLightTable.
pdfLightTable.Draw(page, new PointF(0, 0));
//Save the document.
document.Save("Output.pdf");
//Close the document
document.Close(true);
void table_BeginRowLayout(object sender, BeginRowLayoutEventArgs args)
{
if (args.RowIndex == 1)
{
PdfLightTable table = (PdfLightTable)sender;
int count = table.Columns.Count;
int[] spanMap = new int[count];
// Set just spanned cells. Other values are not important except negatives that are not allowed.
spanMap[0] = 2;
spanMap[1] = 3;
args.ColumnSpanMap = spanMap;
//Set row height.
args.MinimalHeight = 30f;
}
}
' Create a new document
Dim document As New PdfDocument()
'Create a Page
Dim page As PdfPage = document.Pages.Add()
'Create DataTable for source
Dim dataTable As New DataTable("myTable")
dataTable.Columns.Add("ID1")
dataTable.Columns(0).Caption = "id"
dataTable.Columns.Add("ID2")
Dim values() As Object = { "Roll Number", "Student Name" }
dataTable.Rows.Add(values)
values = New Object() { "011", "Cris" }
dataTable.Rows.Add(values)
values = New Object() { "011", "Clay" }
dataTable.Rows.Add(values)
'Create the PdfLightTable
Dim pdfLightTable As New PdfLightTable()
' Subscribe the begin row event
AddHandler pdfLightTable.BeginRowLayout, AddressOf table_BeginRowLayout
'Set the data source
pdfLightTable.DataSource = dataTable
'Draw PdfLightTable.
pdfLightTable.Draw(page, New PointF(0, 0))
'Save the document.
document.Save("Output.pdf")
'Close the document
document.Close(True)
Private Sub table_BeginRowLayout(ByVal sender As Object, ByVal args As BeginRowLayoutEventArgs)
If args.RowIndex = 1 Then
Dim table As PdfLightTable = CType(sender, PdfLightTable)
Dim count As Integer = table.Columns.Count
Dim spanMap(count - 1) As Integer
' Set just spanned cells. Other values are not important except negatives that are not allowed.
spanMap(0) = 2
spanMap(1) = 3
args.ColumnSpanMap = spanMap
'Set row height.
args.MinimalHeight = 30f
End If
End Sub
EndCellLayout
The event raised on having finished cell layout.
Declaration
public event EndCellLayoutEventHandler EndCellLayout
Event Type
Type |
---|
EndCellLayoutEventHandler |
Examples
// Create a new document
PdfDocument document = new PdfDocument();
//Create a Page
PdfPage page = document.Pages.Add();
//Create DataTable for source
DataTable dataTable = new DataTable("myTable");
dataTable.Columns.Add("ID1");
dataTable.Columns[0].Caption = "id";
dataTable.Columns.Add("ID2");
object[] values = new object[] { "Roll Number", "Student Name" };
dataTable.Rows.Add(values);
values = new object[] { "011", "Cris" };
dataTable.Rows.Add(values);
values = new object[] { "011", "Clay" };
dataTable.Rows.Add(values);
//Create the PdfLightTable
PdfLightTable pdfLightTable = new PdfLightTable();
// Subscribe the cell layout event
pdfLightTable.EndCellLayout += new EndCellLayoutEventHandler(table_EndCellLayout);
pdfLightTable.DataSource = dataTable;
pdfLightTable.Style.CellPadding = 16;
//Draw PdfLightTable.
pdfLightTable.Draw(page, new PointF(0, 0));
//Save the document.
document.Save("Output.pdf");
//Close the document
document.Close(true);
// Cell layout event handler
void table_EndCellLayout(object sender, EndCellLayoutEventArgs args)
{
if (args.RowIndex == 1)
{
args.Graphics.DrawRectangle(new PdfPen(PdfBrushes.Red, 2), PdfBrushes.White, args.Bounds);
}
}
' Create a new document
Dim document As New PdfDocument()
'Create a Page
Dim page As PdfPage = document.Pages.Add()
'Create DataTable for source
Dim dataTable As New DataTable("myTable")
dataTable.Columns.Add("ID1")
dataTable.Columns(0).Caption = "id"
dataTable.Columns.Add("ID2")
Dim values() As Object = { "Roll Number", "Student Name" }
dataTable.Rows.Add(values)
values = New Object() { "011", "Cris" }
dataTable.Rows.Add(values)
values = New Object() { "011", "Clay" }
dataTable.Rows.Add(values)
'Create the PdfLightTable
Dim pdfLightTable As New PdfLightTable()
' Subscribe the cell layout event
AddHandler pdfLightTable.EndCellLayout, AddressOf table_EndCellLayout
pdfLightTable.DataSource = dataTable
pdfLightTable.Style.CellPadding = 16
'Draw PdfLightTable.
pdfLightTable.Draw(page, New PointF(0, 0))
'Save the document.
document.Save("Output.pdf")
'Close the document
document.Close(True)
' Cell layout event handler
Private Sub table_EndCellLayout(ByVal sender As Object, ByVal args As EndCellLayoutEventArgs)
If args.RowIndex = 1 Then
args.Graphics.DrawRectangle(New PdfPen(PdfBrushes.Red, 2), PdfBrushes.White, args.Bounds)
End If
End Sub
EndRowLayout
The event raised on having finished row lay outing.
Declaration
public event EndRowLayoutEventHandler EndRowLayout
Event Type
Type |
---|
EndRowLayoutEventHandler |
Examples
// Create a new document
PdfDocument document = new PdfDocument();
//Create a Page
PdfPage page = document.Pages.Add();
//Create DataTable for source
DataTable dataTable = new DataTable("myTable");
dataTable.Columns.Add("ID1");
dataTable.Columns[0].Caption = "id";
dataTable.Columns.Add("ID2");
object[] values = new object[] { "Roll Number", "Student Name" };
dataTable.Rows.Add(values);
values = new object[] { "011", "Cris" };
dataTable.Rows.Add(values);
values = new object[] { "011", "Clay" };
dataTable.Rows.Add(values);
//Create the PdfLightTable
PdfLightTable pdfLightTable = new PdfLightTable();
//Set the data source
pdfLightTable.DataSource = dataTable;
// Subscribe the end row event
pdfLightTable.EndRowLayout += new EndRowLayoutEventHandler(table_EndRowLayout);
//Draw PdfLightTable.
pdfLightTable.Draw(page, new PointF(0, 0));
//Save the document.
document.Save("Output.pdf");
//Close the document
document.Close(true);
void table_EndRowLayout(object sender, EndRowLayoutEventArgs args)
{
if (args.RowIndex == 1)
{
// Cancel property used to cancel the table rendering operation
args.Cancel = true;
}
}
' Create a new document
Dim document As New PdfDocument()
'Create a Page
Dim page As PdfPage = document.Pages.Add()
'Create DataTable for source
Dim dataTable As New DataTable("myTable")
dataTable.Columns.Add("ID1")
dataTable.Columns(0).Caption = "id"
dataTable.Columns.Add("ID2")
Dim values() As Object = { "Roll Number", "Student Name" }
dataTable.Rows.Add(values)
values = New Object() { "011", "Cris" }
dataTable.Rows.Add(values)
values = New Object() { "011", "Clay" }
dataTable.Rows.Add(values)
'Create the PdfLightTable
Dim pdfLightTable As New PdfLightTable()
'Set the data source
pdfLightTable.DataSource = dataTable
' Subscribe the end row event
AddHandler pdfLightTable.EndRowLayout, AddressOf table_EndRowLayout
'Draw PdfLightTable.
pdfLightTable.Draw(page, New PointF(0, 0))
'Save the document.
document.Save("Output.pdf")
'Close the document
document.Close(True)
Private Sub table_EndRowLayout(ByVal sender As Object, ByVal args As EndRowLayoutEventArgs)
If args.RowIndex = 1 Then
' Cancel property used to cancel the table rendering operation
args.Cancel = True
End If
End Sub
QueryColumnCount
The event raised when the column number is requested.
Declaration
public event QueryColumnCountEventHandler QueryColumnCount
Event Type
Type |
---|
QueryColumnCountEventHandler |
Examples
public string[][] datastring = new string[2][];
// Specify values for the table
datastring[0] = new string[] { "111", "Maxim", "100" };
datastring[1] = new string[] { "222", "Calvin", "95" };
// Create a new document
PdfDocument document = new PdfDocument();
//Create a Page
PdfPage page = document.Pages.Add();
//Create the PdfLightTable
PdfLightTable pdfLightTable = new PdfLightTable();
// Setting the DataSourceType as Direct
pdfLightTable.DataSourceType = PdfLightTableDataSourceType.External;
//Subscribing Events
pdfLightTable.QueryColumnCount += new QueryColumnCountEventHandler(table_QueryColumnCount);
pdfLightTable.QueryNextRow += new QueryNextRowEventHandler(table_QueryNextRow);
//Draw PdfLightTable.
pdfLightTable.Draw(page, new PointF(0, 0));
//Save the document.
document.Save("Output.pdf");
//Close the document
document.Close(true);
void table_QueryColumnCount(object sender, QueryColumnCountEventArgs args)
{
args.ColumnCount = 3;
}
void table_QueryNextRow(object sender, QueryNextRowEventArgs args)
{
if (datastring.Length > args.RowIndex)
args.RowData = new string[] { datastring[args.RowIndex][0], datastring[args.RowIndex][1], datastring[args.RowIndex][2] };
}
Public datastring(2)() As String
' Specify values for the table
datastring(0) = New String() { "111", "Maxim", "100" }
datastring(1) = New String() { "222", "Calvin", "95" }
' Create a new document' Create a new document
Dim document As New PdfDocument()
'Create a Page
Dim page As PdfPage = document.Pages.Add()
'Create the PdfLightTable
Dim pdfLightTable As New PdfLightTable()
' Setting the DataSourceType as Direct
pdfLightTable.DataSourceType = PdfLightTableDataSourceType.External
'Subscribing Events
AddHandler pdfLightTable.QueryColumnCount, AddressOf table_QueryColumnCount
AddHandler pdfLightTable.QueryNextRow, AddressOf table_QueryNextRow
'Draw PdfLightTable.
pdfLightTable.Draw(page, New PointF(0, 0))
'Save the document.
document.Save("Output.pdf")
'Close the document
document.Close(True)
Private Sub table_QueryColumnCount(ByVal sender As Object, ByVal args As QueryColumnCountEventArgs)
args.ColumnCount = 3
End Sub
Private Sub table_QueryNextRow(ByVal sender As Object, ByVal args As QueryNextRowEventArgs)
If datastring.Length > args.RowIndexThen
args.RowData = New String() { datastring(args.RowIndex)(0), datastring(args.RowIndex)(1), datastring(args.RowIndex)(2) }
End If
End Sub
QueryNextRow
The event raised when the next row data is requested.
Declaration
public event QueryNextRowEventHandler QueryNextRow
Event Type
Type |
---|
QueryNextRowEventHandler |
Examples
public string[][] datastring = new string[2][];
// Specify values for the table
datastring[0] = new string[] { "111", "Maxim", "100" };
datastring[1] = new string[] { "222", "Calvin", "95" };
// Create a new document
PdfDocument document = new PdfDocument();
//Create a Page
PdfPage page = document.Pages.Add();
//Create the PdfLightTable
PdfLightTable pdfLightTable = new PdfLightTable();
// Setting the DataSourceType as Direct
pdfLightTable.DataSourceType = PdfLightTableDataSourceType.External;
//Subscribing Events
pdfLightTable.QueryColumnCount += new QueryColumnCountEventHandler(table_QueryColumnCount);
pdfLightTable.QueryNextRow += new QueryNextRowEventHandler(table_QueryNextRow);
//Draw PdfLightTable.
pdfLightTable.Draw(page, new PointF(0, 0));
//Save the document.
document.Save("Output.pdf");
//Close the document
document.Close(true);
void table_QueryColumnCount(object sender, QueryColumnCountEventArgs args)
{
args.ColumnCount = 3;
}
void table_QueryNextRow(object sender, QueryNextRowEventArgs args)
{
if (datastring.Length > args.RowIndex)
args.RowData = new string[] { datastring[args.RowIndex][0], datastring[args.RowIndex][1], datastring[args.RowIndex][2] };
}
Public datastring(2)() As String
' Specify values for the table
datastring(0) = New String() { "111", "Maxim", "100" }
datastring(1) = New String() { "222", "Calvin", "95" }
' Create a new document' Create a new document
Dim document As New PdfDocument()
'Create a Page
Dim page As PdfPage = document.Pages.Add()
'Create the PdfLightTable
Dim pdfLightTable As New PdfLightTable()
' Setting the DataSourceType as Direct
pdfLightTable.DataSourceType = PdfLightTableDataSourceType.External
'Subscribing Events
AddHandler pdfLightTable.QueryColumnCount, AddressOf table_QueryColumnCount
AddHandler pdfLightTable.QueryNextRow, AddressOf table_QueryNextRow
'Draw PdfLightTable.
pdfLightTable.Draw(page, New PointF(0, 0))
'Save the document.
document.Save("Output.pdf")
'Close the document
document.Close(True)
Private Sub table_QueryColumnCount(ByVal sender As Object, ByVal args As QueryColumnCountEventArgs)
args.ColumnCount = 3
End Sub
Private Sub table_QueryNextRow(ByVal sender As Object, ByVal args As QueryNextRowEventArgs)
If datastring.Length > args.RowIndex Then
args.RowData = New String() { datastring(args.RowIndex)(0), datastring(args.RowIndex)(1), datastring(args.RowIndex)(2) }
End If
End Sub
QueryRowCount
The event raised when the row number is requested.
Declaration
public event QueryRowCountEventHandler QueryRowCount
Event Type
Type |
---|
QueryRowCountEventHandler |
Examples
public string[][] datastring = new string[3][];
// Specify values for the table
datastring[0] = new string[] { "111", "Maxim", "100" };
datastring[1] = new string[] { "222", "Calvin", "95" };
datastring[2] = new string[] { "333", "Criss", "99" };
// Create a new document
PdfDocument document = new PdfDocument();
//Create a Page
PdfPage page = document.Pages.Add();
//Create the PdfLightTable
PdfLightTable pdfLightTable = new PdfLightTable();
// Setting the DataSourceType as Direct
pdfLightTable.DataSourceType = PdfLightTableDataSourceType.External;
//Subscribing Events
pdfLightTable.QueryRowCount += new QueryRowCountEventHandler(table_QueryRowCount);
pdfLightTable.QueryColumnCount += new QueryColumnCountEventHandler(table_QueryColumnCount);
pdfLightTable.QueryNextRow += new QueryNextRowEventHandler(table_QueryNextRow);
//Draw PdfLightTable.
pdfLightTable.Draw(page, new PointF(0, 0));
//Save the document.
document.Save("Output.pdf");
//Close the document
document.Close(true);
void table_QueryColumnCount(object sender, QueryColumnCountEventArgs args)
{
args.ColumnCount = 3;
}
void table_QueryNextRow(object sender, QueryNextRowEventArgs args)
{
if (datastring.Length > args.RowIndex)
args.RowData = new string[] { datastring[args.RowIndex][0], datastring[args.RowIndex][1], datastring[args.RowIndex][2] };
}
void table_QueryRowCount(object sender, QueryRowCountEventArgs args)
{
args.RowCount = 2;
}
Public datastring(2)() As String
' Specify values for the table
datastring(0) = New String() { "111", "Maxim", "100" }
datastring(1) = New String() { "222", "Calvin", "95" }
datastring(2) = New String() { "333", "Criss", "99" }
' Create a new document
Dim document As New PdfDocument()
'Create a Page
Dim page As PdfPage = document.Pages.Add()
'Create the PdfLightTable
Dim pdfLightTable As New PdfLightTable()
' Setting the DataSourceType as Direct
pdfLightTable.DataSourceType = PdfLightTableDataSourceType.External
'Subscribing Events
AddHandler pdfLightTable.QueryRowCount, AddressOf table_QueryRowCount
AddHandler pdfLightTable.QueryColumnCount, AddressOf table_QueryColumnCount
AddHandler pdfLightTable.QueryNextRow, AddressOf table_QueryNextRow
'Draw PdfLightTable.
pdfLightTable.Draw(page, New PointF(0, 0))
'Save the document.
document.Save("Output.pdf")
'Close the document
document.Close(True)
Private Sub table_QueryColumnCount(ByVal sender As Object, ByVal args As QueryColumnCountEventArgs)
args.ColumnCount = 3
End Sub
Private Sub table_QueryNextRow(ByVal sender As Object, ByVal args As QueryNextRowEventArgs)
If datastring.Length > args.RowIndex Then
args.RowData = New String() { datastring(args.RowIndex)(0), datastring(args.RowIndex)(1), datastring(args.RowIndex)(2) }
End If
End Sub
Private Sub table_QueryRowCount(ByVal sender As Object, ByVal args As QueryRowCountEventArgs)
args.RowCount = 2
End Sub