Class PdfPaddings
The class used represents the cell padding of the PDF grid
Inheritance
System.Object
PdfPaddings
Namespace: Syncfusion.Pdf
Assembly: Syncfusion.Pdf.NET.dll
Syntax
public class PdfPaddings : Object
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();
//Adding cell padding
gridStyle.CellPadding = new PdfPaddings(5, 5, 5, 5);
//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()
'Adding cell padding
gridStyle.CellPadding = New PdfPaddings(5, 5, 5, 5)
'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
PdfPaddings()
Initializes a new instance of the PdfPaddings class.
Declaration
public PdfPaddings()
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();
//Create new padding instance.
PdfPaddings paddings = new PdfPaddings();
paddings.Left = 5;
paddings.Top = 10;
paddings.Bottom = 10;
paddings.Right = 5;
//Adding cell padding
gridStyle.CellPadding = paddings;
//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()
'Create new padding instance.
Dim paddings As PdfPaddings = New PdfPaddings()
paddings.Left = 5
paddings.Top = 10
paddings.Bottom = 10
paddings.Right = 5
'Adding cell padding
gridStyle.CellPadding = paddings
'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)
PdfPaddings(Single, Single, Single, Single)
Initializes a new instance of the PdfPaddings class with spacing of all sides Left,Right,Top,Bottom
Declaration
public PdfPaddings(float left, float right, float top, float bottom)
Parameters
Type | Name | Description |
---|---|---|
System.Single | left | The left space. |
System.Single | right | The right space. |
System.Single | top | The top space. |
System.Single | bottom | The bottom space. |
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();
//Adding cell padding
gridStyle.CellPadding = new PdfPaddings(5, 5, 5, 5);
//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()
'Adding cell padding
gridStyle.CellPadding = New PdfPaddings(5, 5, 5, 5)
'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
All
Sets space value to all sides of a cell Left,Right,Top,Bottom.
Declaration
public float All { set; }
Property Value
Type | Description |
---|---|
System.Single | The space value of all sides Left,Right,Top,Bottom. |
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();
//Create new padding instance.
PdfPaddings paddings = new PdfPaddings();
paddings.All = 5;
//Adding cell padding
gridStyle.CellPadding = paddings;
//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()
'Create new padding instance.
Dim paddings As PdfPaddings = New PdfPaddings()
paddings.All = 5
'Adding cell padding
gridStyle.CellPadding = paddings
'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)
Bottom
Gets or sets the bottom space of padding.
Declaration
public float Bottom { get; set; }
Property Value
Type | Description |
---|---|
System.Single | The bottom space. |
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();
//Create new padding instance.
PdfPaddings paddings = new PdfPaddings();
paddings.Left = 5;
paddings.Top = 10;
paddings.Bottom = 10;
paddings.Right = 5;
//Adding cell padding
gridStyle.CellPadding = paddings;
//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()
'Create new padding instance.
Dim paddings As PdfPaddings = New PdfPaddings()
paddings.Left = 5
paddings.Top = 10
paddings.Bottom = 10
paddings.Right = 5
'Adding cell padding
gridStyle.CellPadding = paddings
'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)
Left
Gets or sets the left space of padding.
Declaration
public float Left { get; set; }
Property Value
Type | Description |
---|---|
System.Single | The left space. |
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();
//Create new padding instance.
PdfPaddings paddings = new PdfPaddings();
paddings.Left = 5;
paddings.Top = 10;
paddings.Bottom = 10;
paddings.Right = 5;
//Adding cell padding
gridStyle.CellPadding = paddings;
//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()
'Create new padding instance.
Dim paddings As PdfPaddings = New PdfPaddings()
paddings.Left = 5
paddings.Top = 10
paddings.Bottom = 10
paddings.Right = 5
'Adding cell padding
gridStyle.CellPadding = paddings
'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)
Right
Gets or sets the right space of padding.
Declaration
public float Right { get; set; }
Property Value
Type | Description |
---|---|
System.Single | The right space. |
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();
//Create new padding instance.
PdfPaddings paddings = new PdfPaddings();
paddings.Left = 5;
paddings.Top = 10;
paddings.Bottom = 10;
paddings.Right = 5;
//Adding cell padding
gridStyle.CellPadding = paddings;
//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()
'Create new padding instance.
Dim paddings As PdfPaddings = New PdfPaddings()
paddings.Left = 5
paddings.Top = 10
paddings.Bottom = 10
paddings.Right = 5
'Adding cell padding
gridStyle.CellPadding = paddings
'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)
Top
Gets or sets the top space of padding.
Declaration
public float Top { get; set; }
Property Value
Type | Description |
---|---|
System.Single | The top space. |
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();
//Create new padding instance.
PdfPaddings paddings = new PdfPaddings();
paddings.Left = 5;
paddings.Top = 10;
paddings.Bottom = 10;
paddings.Right = 5;
//Adding cell padding
gridStyle.CellPadding = paddings;
//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()
'Create new padding instance.
Dim paddings As PdfPaddings = New PdfPaddings()
paddings.Left = 5
paddings.Top = 10
paddings.Bottom = 10
paddings.Right = 5
'Adding cell padding
gridStyle.CellPadding = paddings
'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)