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

Free Support Forum - aspose.com

Why PrintGridlines prints dotted gridlines?

I’m using Aspose.Cells 8.7.1. I set PageSetup.PrintGridlines to true and save the workbook as pdf. Then the gridlines are dotted. How can I get solid gridlines?

Thank you

Hi Marco,

Thank you for contacting Aspose support.

Please try the following alternative approach to set borders for the visible cell range. You may choose between different types of borders in order to simulate the grid lines.


var book = new Workbook(dir + “sample.xlsx”);
//Create a style to apply cell borders
var style = book.CreateStyle();
style.Borders[BorderType.BottomBorder].LineStyle = CellBorderType.Hair;
style.Borders[BorderType.RightBorder].LineStyle = CellBorderType.Hair;
style.Borders[BorderType.LeftBorder].LineStyle = CellBorderType.Hair;
style.Borders[BorderType.TopBorder].LineStyle = CellBorderType.Hair;
foreach (Worksheet sheet in book.Worksheets)
//Apply borders to visible range
sheet.Cells.MaxDisplayRange.ApplyStyle(style, new StyleFlag() { Borders = true });
book.Save(dir + “output.pdf”);


You are most welcome. Please feel free to contact us back in case you need our further assistance with Aspose APIs.