Class PdfColumn
- Namespace
- Syncfusion.Pdf.Tables
- Assembly
- Syncfusion.Pdf.Portable.dll
Represents a single column of the table.
public class PdfColumn
- Inheritance
-
PdfColumn
- Inherited Members
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;
// Add Columns
tableColumns.Add(new PdfColumn("Roll Number"));
tableColumns.Add(new PdfColumn("Name"));
tableColumns.Add(new PdfColumn("Class"));
// Add 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 PDF document
Dim document As New PdfDocument()
'Create a new 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
' Get the columns collection
Dim tableColumns As PdfColumnCollection = table.Columns
' Add Columns
tableColumns.Add(New PdfColumn("Roll Number"))
tableColumns.Add(New PdfColumn("Name"))
tableColumns.Add(New PdfColumn("Class"))
' Add 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)
Constructors
PdfColumn()
Initializes a new instance of the PdfColumn class.
public PdfColumn()
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("Name"));
tableColumns.Add(new PdfColumn("Class"));
// Create a new column
PdfColumn rollNumber = new PdfColumn();
//Set the string format
rollNumber.StringFormat = new PdfStringFormat(PdfTextAlignment.Left);
//set the column name
rollNumber.ColumnName = "Roll Number";
//Add the column
tableColumns.Add(rollNumber);
// 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);
' Create a PDF document
Dim document As New PdfDocument()
'Create a new page
Dim page As PdfPage = document.Pages.Add()
Dim table As 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("Name"))
tableColumns.Add(New PdfColumn("Class"))
' Create a new column
Dim rollNumber As New PdfColumn()
'Set the string format
rollNumber.StringFormat = New PdfStringFormat(PdfTextAlignment.Left)
'set the column name
rollNumber.ColumnName = "Roll Number"
'Add the column
tableColumns.Add(rollNumber)
' 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)
PdfColumn(string)
Initializes a new instance of the PdfColumn class with specified column name.
public PdfColumn(string columnName)
Parameters
columnNamestringThe name of the column.
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("Name"));
tableColumns.Add(new PdfColumn("Class"));
// Create a new column
PdfColumn rollNumber = new PdfColumn();
//Set the string format
rollNumber.StringFormat = new PdfStringFormat(PdfTextAlignment.Left);
//set the column name
rollNumber.ColumnName = "Roll Number";
//Add the column
tableColumns.Add(rollNumber);
// 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);
' Create a PDF document
Dim document As New PdfDocument()
'Create a new page
Dim page As PdfPage = document.Pages.Add()
Dim table As 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("Name"))
tableColumns.Add(New PdfColumn("Class"))
' Create a new column
Dim rollNumber As New PdfColumn()
'Set the string format
rollNumber.StringFormat = New PdfStringFormat(PdfTextAlignment.Left)
'set the column name
rollNumber.ColumnName = "Roll Number"
'Add the column
tableColumns.Add(rollNumber)
' 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)
Properties
ColumnName
Gets or sets name of the column.
public string ColumnName { get; set; }
Property Value
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("Name"));
tableColumns.Add(new PdfColumn("Class"));
// Create a new column
PdfColumn rollNumber = new PdfColumn();
//Set the string format
rollNumber.StringFormat = new PdfStringFormat(PdfTextAlignment.Left);
//set the column name
rollNumber.ColumnName = "Roll Number";
//Add the column
tableColumns.Add(rollNumber);
// 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);
' Create a PDF document
Dim document As New PdfDocument()
'Create a new page
Dim page As PdfPage = document.Pages.Add()
Dim table As 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("Name"))
tableColumns.Add(New PdfColumn("Class"))
' Create a new column
Dim rollNumber As New PdfColumn()
'Set the string format
rollNumber.StringFormat = New PdfStringFormat(PdfTextAlignment.Left)
'set the column name
rollNumber.ColumnName = "Roll Number"
'Add the column
tableColumns.Add(rollNumber)
' 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)
StringFormat
Gets or sets the string format of the column text
public PdfStringFormat StringFormat { get; set; }
Property Value
- PdfStringFormat
The format of the cell text.
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("Name"));
tableColumns.Add(new PdfColumn("Class"));
// Create a new column
PdfColumn rollNumber = new PdfColumn("Roll Number");
//Set the string format
rollNumber.StringFormat = new PdfStringFormat(PdfTextAlignment.Right);
//Add the column
tableColumns.Add(rollNumber);
// 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);
' Create a PDF document
Dim document As New PdfDocument()
'Create a new page
Dim page As PdfPage = document.Pages.Add()
Dim table As 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("Name"))
tableColumns.Add(New PdfColumn("Class"))
' Create a new column
Dim rollNumber As New PdfColumn("Roll Number")
'Set the string format
rollNumber.StringFormat = New PdfStringFormat(PdfTextAlignment.Right)
'Add the column
tableColumns.Add(rollNumber)
' 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)
Width
Gets or sets the width of the column.
public float Width { get; set; }
Property Value
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("Name"));
tableColumns.Add(new PdfColumn("Class"));
// Create a new column
PdfColumn rollNumber = new PdfColumn("Roll Number");
//Set the string format
rollNumber.StringFormat = new PdfStringFormat(PdfTextAlignment.Left);
//set the width
rollNumber.Width = 20;
//Add the column
tableColumns.Add(rollNumber);
// 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);
' Create a PDF document
Dim document As New PdfDocument()
'Create a new page
Dim page As PdfPage = document.Pages.Add()
Dim table As 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("Name"))
tableColumns.Add(New PdfColumn("Class"))
' Create a new column
Dim rollNumber As New PdfColumn("Roll Number")
'Set the string format
rollNumber.StringFormat = New PdfStringFormat(PdfTextAlignment.Left)
'set the width
rollNumber.Width = 20
'Add the column
tableColumns.Add(rollNumber)
' 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)