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.
C#
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”);