PdfGridStyle Class
Provides customization of the appearance for the PdfGrid.
Implements
System.ICloneable
Inherited Members
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.ToString()
Namespace: Syncfusion.Pdf.Grid
Assembly: Syncfusion.Pdf.Base.dll
Syntax
public class PdfGridStyle : PdfGridStyleBase, ICloneable
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.
Declaration
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.
Declaration
public bool AllowHorizontalOverflow { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
|
Remarks
Defalult Value: 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)
BorderOverlapStyle
Gets or sets the border overlap style of the PdfGrid.
Declaration
public PdfBorderOverlapStyle BorderOverlapStyle { get; set; }
Property Value
Type | Description |
---|---|
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.
Declaration
public PdfPaddings CellPadding { get; set; }
Property Value
Type | Description |
---|---|
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.
Declaration
public float CellSpacing { get; set; }
Property Value
Type | Description |
---|---|
System.Single | 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.
Declaration
public PdfHorizontalOverflowType HorizontalOverflowType { get; set; }
Property Value
Type | Description |
---|---|
PdfHorizontalOverflowType | The type of the horizontal overflow. |
Remarks
Default value: PdfHorizontalOverflowType.LastPage
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)
Implements
System.ICloneable