Category / Section
How can I customize border styles in the PdfLightTable?
1 min read
You can customize the color of the table border and border width in the PdfLightTable by using the BorderPen property.
Refer to the following code example to customize the border style in table.
C#
//Creates a new PDF document. PdfDocument doc = new PdfDocument(); //Adds a page. PdfPage page = doc.Pages.Add(); //Acquires page's graphics. PdfGraphics graphics = page.Graphics; //Declares the PdfLightTable. PdfLightTable pdfLightTable = new PdfLightTable(); //Customizes the color of the table border. pdfLightTable.Style.BorderPen = new PdfPen(new PdfColor(168, 189, 238), 0.5F); //Sets the DataSourceType as Direct. pdfLightTable.DataSourceType = PdfLightTableDataSourceType.TableDirect; //Creates columns. pdfLightTable.Columns.Add(new PdfColumn("Roll Number")); pdfLightTable.Columns.Add(new PdfColumn("Name")); pdfLightTable.Columns.Add(new PdfColumn("Class")); //Adds rows. pdfLightTable.Rows.Add(new object[] { "111", "Maxim", "III" }); //Draws the PdfLightTable. pdfLightTable.Draw(page, PointF.Empty); //Saves the document. doc.Save("Sample.pdf"); doc.Close(true);
Sample Link
http://www.syncfusion.com/downloads/support/directtrac/general/PdfLightTableSample-1780819773.zip