Free Support Forum -

Double lines in table in pdf

I am trying to achieve double lines for the totals row in table.
can you please let me know how can i do it.

Hello Varsha,

Thanks for using our products.

In order to accomplish your requirements, please try using SetBorderStyle(....) method. Please take a look over the following code snippet in which I have created a sample table with double line border. I have also attached the resultant PDF that I have generated using Aspose.Pdf for .NET 5.2.1. Please take a look. In case it does not satisfy your requirements or you have any further query, please feel free to contact.


//Instantiate a Pdf object by calling its empty constructor
Pdf pdf1 = new Pdf();
//Create a new section in the Pdf object
Aspose.Pdf.Section sec1 = pdf1.Sections.Add();

//Instantiate a table object
Table tab1 = new Table();
//Set with column widths of the table
tab1.ColumnWidths = "50 50 50";

//Set default cell border using BorderInfo object
tab1.DefaultCellBorder = new BorderInfo((int)BorderSide.All, 0.1F);
// specify the border style for cells inside table. It will be displayed as outer border for table cells
tab1.DefaultCellBorder.SetBorderStyle((int)BorderSide.All, Aspose.Pdf.BorderStyle.Double);

//Set table border using another customized BorderInfo object
tab1.Border = new BorderInfo((int)BorderSide.All, 0.1F);
// specify the border style for table. It will be displayed as outer border for table
tab1.Border.SetBorderStyle((int)BorderSide.All, Aspose.Pdf.BorderStyle.Double);

//Create MarginInfo object and set its left, bottom, right and top margins
MarginInfo margin = new MarginInfo();
margin.Top = 5f;
margin.Left = 5f;
margin.Right = 5f;
margin.Bottom = 5f;
//Set the default cell padding to the MarginInfo object
tab1.DefaultCellPadding = margin;

//Create rows in the table and then cells in the rows
Row row1 = tab1.Rows.Add();
Row row2 = tab1.Rows.Add();

// add the text paragraph to paragraphs collection of section object
// save the resultant PDF document