We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

How to set Aspose.Pdf.Table.Cell border : dotted


I am currently trying to set the Aspose.Pdf.Table.Cell border style to “dotted”. This value doesn’t exist in the BorderStyle enum. Is there a way to do this ?


Hello Cuisinier,

Thanks for your interest in our products.

We are working over this query and will get back to you soon. We are really sorry for this inconvenience.

Thanks to you, I’ll waiting.


Hello Cuisinier,

Thanks for your patience.

Please try using the following code snippet to accomplish your requirements. I have also attached the sample PDF document that I have generated using Aspose.Pdf for .NET 5.4.0


//Instantiate a Pdf object by calling its empty constructor
Pdf pdf1 = new Pdf();
//Instantiate attachment instance
Aspose.Pdf.Section sec1 = pdf1.Sections.Add();

//Instantiate a table object
Aspose.Pdf.Table tab1 = new Aspose.Pdf.Table();
//Add the table in paragraphs collection of the desired section
//Set with column widths of the table
tab1.ColumnWidths = "50 50 50";
//Create a Graph object
GraphInfo Border_Graph = new GraphInfo();
// specify the dash length in white
Border_Graph.DashLengthInWhite = 2F;
// specify the dash length in Black
Border_Graph.DashLengthInBlack= 1;
//Set table border using customized BorderInfo object
tab1.DefaultCellBorder = new BorderInfo((int)BorderSide.All, Border_Graph);
//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();
//save the resultant PDF

You may also try using the following XML file to generate the PDF document with table having dotted border. Following XML only shows how to create dotted border and it's different from above code snippet.


<?xml version="1.0" encoding="utf-8" ?>
<Pdf xmlns="Aspose.Pdf">
<Table ColumnWidths="100" DefaultCellPaddingLeft="7.25" DefaultCellPaddingRight="7.25" DefaultCellPaddingTop="7.25" DefaultCellPaddingBottom="7.25">
<Box Dash="1 1" LineWidth="1.0" />
<Segment>Dotted border</Segment>

In case you have any further query, please feel free to contact.

Perfect !
I did not know the GraphInfo class.

Thank you.