Table of Contents

Class PdfGridStyle

Namespace
Syncfusion.Pdf.Grid
Assembly
Syncfusion.Pdf.Portable.dll

Provides customization of the appearance for the PdfGrid.

public class PdfGridStyle : PdfGridStyleBase, ICloneable
Inheritance
PdfGridStyle
Implements
Inherited Members

Examples

//Create a new PDF document.
PdfDocument doc = new PdfDocument();
//Add a page.
PdfPage page = doc.Pages.Add();
//Create a PdfGrid.
PdfGrid pdfGrid = new PdfGrid();
//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" });
//Assign data source.
pdfGrid.DataSource = dataTable;
//Using the Column collection
pdfGrid.Columns[0].Width = 100;
//Adding grid style
PdfGridStyle gridStyle = new PdfGridStyle();
//Allow grid to overflow horizontally
gridStyle.AllowHorizontalOverflow = true;
//Adding cell spacing between cells
gridStyle.CellSpacing = 0.5F;
//Setting text pen for grid
gridStyle.TextBrush = PdfBrushes.Blue;
//Applying style to grid
pdfGrid.Style = gridStyle;
//Draw grid to the page of PDF document.
pdfGrid.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 PdfGrid.
Dim pdfGrid As New PdfGrid()
'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"})
'Assign data source.
pdfGrid.DataSource = dataTable
'Using the Column collection
pdfGrid.Columns(0).Width = 100
'Adding grid style
Dim gridStyle As New PdfGridStyle()
'Allow grid to overflow horizontally
gridStyle.AllowHorizontalOverflow = True
'Adding cell spacing between cells
gridStyle.CellSpacing = 0.5F
'Setting text pen for grid
gridStyle.TextBrush = PdfBrushes.Blue
'Applying style to grid
pdfGrid.Style = gridStyle
'Draw grid to the page of PDF document.
pdfGrid.Draw(page, New PointF(10, 10))
'Save the document.
doc.Save("Output.pdf")
'close the document
doc.Close(True)

Constructors

PdfGridStyle()

Initializes a new instance of the PdfGridStyle class.

public PdfGridStyle()

Examples

//Create a new PDF document.
PdfDocument doc = new PdfDocument();
//Add a page.
PdfPage page = doc.Pages.Add();
//Create a PdfGrid.
PdfGrid pdfGrid = new PdfGrid();
//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" });
//Assign data source.
pdfGrid.DataSource = dataTable;
//Using the Column collection
pdfGrid.Columns[0].Width = 100;
//Adding grid style
PdfGridStyle gridStyle = new PdfGridStyle();
//Allow grid to overflow horizontally
gridStyle.AllowHorizontalOverflow = true;
//Set cell padding
gridStyle.CellPadding = new PdfPaddings(5,5,5,5);
//Adding cell spacing between cells
gridStyle.CellSpacing = 0.5F;
//Set border ovelay style.
gridStyle.BorderOverlapStyle = PdfBorderOverlapStyle.Inside;
//Set horizontal overflow type.
gridStyle.HorizontalOverflowType = PdfHorizontalOverflowType.LastPage;
//Applying style to grid
pdfGrid.Style = gridStyle;
//Draw grid to the page of PDF document.
pdfGrid.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 PdfGrid.
Dim pdfGrid As New PdfGrid()
'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"})
'Assign data source.
pdfGrid.DataSource = dataTable
'Using the Column collection
pdfGrid.Columns(0).Width = 100
'Adding grid style
Dim gridStyle As New PdfGridStyle()
'Allow grid to overflow horizontally
gridStyle.AllowHorizontalOverflow = True
'Set cell padding
gridStyle.CellPadding = New PdfPaddings(5,5,5,5)
'Adding cell spacing between cells
gridStyle.CellSpacing = 0.5F
'Set border ovelay style.
gridStyle.BorderOverlapStyle = PdfBorderOverlapStyle.Inside
'Set horizontal overflow type.
gridStyle.HorizontalOverflowType = PdfHorizontalOverflowType.LastPage
'Applying style to grid
pdfGrid.Style = gridStyle
'Draw grid to the page of PDF document.
pdfGrid.Draw(page, New PointF(10, 10))
'Save the document.
doc.Save("Output.pdf")
'close the document
doc.Close(True)

Properties

AllowHorizontalOverflow

Gets or sets a value indicating whether to allow horizontal overflow.

public bool AllowHorizontalOverflow { get; set; }

Property Value

bool

true if [allow horizontal overflow]; otherwise, false.

Examples

//Create a new PDF document.
PdfDocument doc = new PdfDocument();
//Add a page.
PdfPage page = doc.Pages.Add();
//Create a PdfGrid.
PdfGrid pdfGrid = new PdfGrid();
//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" });
//Assign data source.
pdfGrid.DataSource = dataTable;
//Using the Column collection
pdfGrid.Columns[0].Width = 100;
//Adding grid style
PdfGridStyle gridStyle = new PdfGridStyle();
//Allow grid to overflow horizontally
gridStyle.AllowHorizontalOverflow = true;
//Set cell padding
gridStyle.CellPadding = new PdfPaddings(5,5,5,5);
//Adding cell spacing between cells
gridStyle.CellSpacing = 0.5F;
//Set border ovelay style.
gridStyle.BorderOverlapStyle = PdfBorderOverlapStyle.Inside;
//Set horizontal overflow type.
gridStyle.HorizontalOverflowType = PdfHorizontalOverflowType.LastPage;
//Applying style to grid
pdfGrid.Style = gridStyle;
//Draw grid to the page of PDF document.
pdfGrid.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 PdfGrid.
Dim pdfGrid As New PdfGrid()
'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"})
'Assign data source.
pdfGrid.DataSource = dataTable
'Using the Column collection
pdfGrid.Columns(0).Width = 100
'Adding grid style
Dim gridStyle As New PdfGridStyle()
'Allow grid to overflow horizontally
gridStyle.AllowHorizontalOverflow = True
'Set cell padding
gridStyle.CellPadding = New PdfPaddings(5,5,5,5)
'Adding cell spacing between cells
gridStyle.CellSpacing = 0.5F
'Set border ovelay style.
gridStyle.BorderOverlapStyle = PdfBorderOverlapStyle.Inside
'Set horizontal overflow type.
gridStyle.HorizontalOverflowType = PdfHorizontalOverflowType.LastPage
'Applying style to grid
pdfGrid.Style = gridStyle
'Draw grid to the page of PDF document.
pdfGrid.Draw(page, New PointF(10, 10))
'Save the document.
doc.Save("Output.pdf")
'close the document
doc.Close(True)

Remarks

Defalult Value: false

BorderOverlapStyle

Gets or sets the border overlap style of the PdfGrid.

public PdfBorderOverlapStyle BorderOverlapStyle { get; set; }

Property Value

PdfBorderOverlapStyle

The border overlap style.

Examples

//Create a new PDF document.
PdfDocument doc = new PdfDocument();
//Add a page.
PdfPage page = doc.Pages.Add();
//Create a PdfGrid.
PdfGrid pdfGrid = new PdfGrid();
//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" });
//Assign data source.
pdfGrid.DataSource = dataTable;
//Using the Column collection
pdfGrid.Columns[0].Width = 100;
//Adding grid style
PdfGridStyle gridStyle = new PdfGridStyle();
//Allow grid to overflow horizontally
gridStyle.AllowHorizontalOverflow = true;
//Set cell padding
gridStyle.CellPadding = new PdfPaddings(5,5,5,5);
//Adding cell spacing between cells
gridStyle.CellSpacing = 0.5F;
//Set border ovelay style.
gridStyle.BorderOverlapStyle = PdfBorderOverlapStyle.Inside;
//Set horizontal overflow type.
gridStyle.HorizontalOverflowType = PdfHorizontalOverflowType.LastPage;
//Applying style to grid
pdfGrid.Style = gridStyle;
//Draw grid to the page of PDF document.
pdfGrid.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 PdfGrid.
Dim pdfGrid As New PdfGrid()
'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"})
'Assign data source.
pdfGrid.DataSource = dataTable
'Using the Column collection
pdfGrid.Columns(0).Width = 100
'Adding grid style
Dim gridStyle As New PdfGridStyle()
'Allow grid to overflow horizontally
gridStyle.AllowHorizontalOverflow = True
'Set cell padding
gridStyle.CellPadding = New PdfPaddings(5,5,5,5)
'Adding cell spacing between cells
gridStyle.CellSpacing = 0.5F
'Set border ovelay style.
gridStyle.BorderOverlapStyle = PdfBorderOverlapStyle.Inside
'Set horizontal overflow type.
gridStyle.HorizontalOverflowType = PdfHorizontalOverflowType.LastPage
'Applying style to grid
pdfGrid.Style = gridStyle
'Draw grid to the page of PDF document.
pdfGrid.Draw(page, New PointF(10, 10))
'Save the document.
doc.Save("Output.pdf")
'close the document
doc.Close(True)

CellPadding

Gets or sets the cell padding.

public PdfPaddings CellPadding { get; set; }

Property Value

PdfPaddings

The cell padding.

Examples

//Create a new PDF document.
PdfDocument doc = new PdfDocument();
//Add a page.
PdfPage page = doc.Pages.Add();
//Create a PdfGrid.
PdfGrid pdfGrid = new PdfGrid();
//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" });
//Assign data source.
pdfGrid.DataSource = dataTable;
//Using the Column collection
pdfGrid.Columns[0].Width = 100;
//Adding grid style
PdfGridStyle gridStyle = new PdfGridStyle();
//Allow grid to overflow horizontally
gridStyle.AllowHorizontalOverflow = true;
//Set cell padding
gridStyle.CellPadding = new PdfPaddings(5,5,5,5);
//Adding cell spacing between cells
gridStyle.CellSpacing = 0.5F;
//Set border ovelay style.
gridStyle.BorderOverlapStyle = PdfBorderOverlapStyle.Inside;
//Set horizontal overflow type.
gridStyle.HorizontalOverflowType = PdfHorizontalOverflowType.LastPage;
//Applying style to grid
pdfGrid.Style = gridStyle;
//Draw grid to the page of PDF document.
pdfGrid.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 PdfGrid.
Dim pdfGrid As New PdfGrid()
'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"})
'Assign data source.
pdfGrid.DataSource = dataTable
'Using the Column collection
pdfGrid.Columns(0).Width = 100
'Adding grid style
Dim gridStyle As New PdfGridStyle()
'Allow grid to overflow horizontally
gridStyle.AllowHorizontalOverflow = True
'Set cell padding
gridStyle.CellPadding = New PdfPaddings(5,5,5,5)
'Adding cell spacing between cells
gridStyle.CellSpacing = 0.5F
'Set border ovelay style.
gridStyle.BorderOverlapStyle = PdfBorderOverlapStyle.Inside
'Set horizontal overflow type.
gridStyle.HorizontalOverflowType = PdfHorizontalOverflowType.LastPage
'Applying style to grid
pdfGrid.Style = gridStyle
'Draw grid to the page of PDF document.
pdfGrid.Draw(page, New PointF(10, 10))
'Save the document.
doc.Save("Output.pdf")
'close the document
doc.Close(True)

CellSpacing

Gets or sets the cell spacing of the PdfGrid.

public float CellSpacing { get; set; }

Property Value

float

The cell spacing.

Examples

//Create a new PDF document.
PdfDocument doc = new PdfDocument();
//Add a page.
PdfPage page = doc.Pages.Add();
//Create a PdfGrid.
PdfGrid pdfGrid = new PdfGrid();
//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" });
//Assign data source.
pdfGrid.DataSource = dataTable;
//Using the Column collection
pdfGrid.Columns[0].Width = 100;
//Adding grid style
PdfGridStyle gridStyle = new PdfGridStyle();
//Allow grid to overflow horizontally
gridStyle.AllowHorizontalOverflow = true;
//Set cell padding
gridStyle.CellPadding = new PdfPaddings(5,5,5,5);
//Adding cell spacing between cells
gridStyle.CellSpacing = 0.5F;
//Set border ovelay style.
gridStyle.BorderOverlapStyle = PdfBorderOverlapStyle.Inside;
//Set horizontal overflow type.
gridStyle.HorizontalOverflowType = PdfHorizontalOverflowType.LastPage;
//Applying style to grid
pdfGrid.Style = gridStyle;
//Draw grid to the page of PDF document.
pdfGrid.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 PdfGrid.
Dim pdfGrid As New PdfGrid()
'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"})
'Assign data source.
pdfGrid.DataSource = dataTable
'Using the Column collection
pdfGrid.Columns(0).Width = 100
'Adding grid style
Dim gridStyle As New PdfGridStyle()
'Allow grid to overflow horizontally
gridStyle.AllowHorizontalOverflow = True
'Set cell padding
gridStyle.CellPadding = New PdfPaddings(5,5,5,5)
'Adding cell spacing between cells
gridStyle.CellSpacing = 0.5F
'Set border ovelay style.
gridStyle.BorderOverlapStyle = PdfBorderOverlapStyle.Inside
'Set horizontal overflow type.
gridStyle.HorizontalOverflowType = PdfHorizontalOverflowType.LastPage
'Applying style to grid
pdfGrid.Style = gridStyle
'Draw grid to the page of PDF document.
pdfGrid.Draw(page, New PointF(10, 10))
'Save the document.
doc.Save("Output.pdf")
'close the document
doc.Close(True)

HorizontalOverflowType

Gets or sets the type of the horizontal overflow of the PdfGrid.

public PdfHorizontalOverflowType HorizontalOverflowType { get; set; }

Property Value

PdfHorizontalOverflowType

The type of the horizontal overflow.

Examples

//Create a new PDF document.
PdfDocument doc = new PdfDocument();
//Add a page.
PdfPage page = doc.Pages.Add();
//Create a PdfGrid.
PdfGrid pdfGrid = new PdfGrid();
//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" });
//Assign data source.
pdfGrid.DataSource = dataTable;
//Using the Column collection
pdfGrid.Columns[0].Width = 100;
//Adding grid style
PdfGridStyle gridStyle = new PdfGridStyle();
//Allow grid to overflow horizontally
gridStyle.AllowHorizontalOverflow = true;
//Set cell padding
gridStyle.CellPadding = new PdfPaddings(5,5,5,5);
//Adding cell spacing between cells
gridStyle.CellSpacing = 0.5F;
//Set border ovelay style.
gridStyle.BorderOverlapStyle = PdfBorderOverlapStyle.Inside;
//Set horizontal overflow type.
gridStyle.HorizontalOverflowType = PdfHorizontalOverflowType.LastPage;
//Applying style to grid
pdfGrid.Style = gridStyle;
//Draw grid to the page of PDF document.
pdfGrid.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 PdfGrid.
Dim pdfGrid As New PdfGrid()
'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"})
'Assign data source.
pdfGrid.DataSource = dataTable
'Using the Column collection
pdfGrid.Columns(0).Width = 100
'Adding grid style
Dim gridStyle As New PdfGridStyle()
'Allow grid to overflow horizontally
gridStyle.AllowHorizontalOverflow = True
'Set cell padding
gridStyle.CellPadding = New PdfPaddings(5,5,5,5)
'Adding cell spacing between cells
gridStyle.CellSpacing = 0.5F
'Set border ovelay style.
gridStyle.BorderOverlapStyle = PdfBorderOverlapStyle.Inside
'Set horizontal overflow type.
gridStyle.HorizontalOverflowType = PdfHorizontalOverflowType.LastPage
'Applying style to grid
pdfGrid.Style = gridStyle
'Draw grid to the page of PDF document.
pdfGrid.Draw(page, New PointF(10, 10))
'Save the document.
doc.Save("Output.pdf")
'close the document
doc.Close(True)

Remarks

Default value: PdfHorizontalOverflowType.LastPage