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

Free Support Forum - aspose.com

Aspose.Cells - Save As Pdf - Grid Cell Borders problem

Hi,

Since recently we are have problems saving an Excel sheet to PDF. When using grid lines (this is what we want) the cells have big crosses inside (see attached example). Both Thin and Medium gridlines will case the same problem. This has worked well before. We are using Aspose.Cells.dll version 4.9.1.0

Please resolve asap.

Kind regards,

Jan Stolk.

Aspose.Cells.Workbook book = new Aspose.Cells.Workbook();
book.Open(XlsFileName);
book.Worksheets[0].PageSetup.Orientation = Aspose.Cells.PageOrientationType.Landscape;
book.DefaultStyle.ShrinkToFit = true;
book.DefaultStyle.Borders.SetStyle(Aspose.Cells.CellBorderType.Medium);
book.Save(PdfFileName, Aspose.Cells.FileFormatType.Pdf);

Hi Jan,

We have tested your code with the version you specified. It worked as it should. The test PDF result is attached. Can you please forward us your template file (Excel file) to test.

Thanks,

I attached the Excel sheet.

Have you tried? So all cells will have lines.

book.DefaultStyle.Borders.SetStyle(Aspose.Cells.CellBorderType.Medium);

Regards,

Jan Stolk

Hi,

When you use your described line of code, it will set all the borders including Diagonal Up/Down, kindly change your line of code i.e…,

book.DefaultStyle.Borders.SetStyle(Aspose.Cells.CellBorderType.Medium);

to:

book.DefaultStyle.Borders[BorderType.LeftBorder].LineStyle = CellBorderType.Medium;
book.DefaultStyle.Borders[BorderType.RightBorder].LineStyle = CellBorderType.Medium;
book.DefaultStyle.Borders[BorderType.BottomBorder].LineStyle = CellBorderType.Medium;
book.DefaultStyle.Borders[BorderType.TopBorder].LineStyle = CellBorderType.Medium;


Thank you.

Hi,

Alternatively you may use the line of code before saving to pdf file, e.g


book.Worksheets[0].PageSetup.PrintGridlines = true;

Thank you.