Free Support Forum - aspose.com

Dotted lines in PDF

I’m using Aspose.Net 18.9 to convert an excel sheet to PDF:

        Aspose.Cells.Workbook doc = new Aspose.Cells.Workbook(quelle);
        doc.Save(ziel, Aspose.Cells.SaveFormat.Pdf);
        doc.Dispose();

This works fine in most cases but I have an example where normal lines are conveted to dotted lines in the PDF. When creating the PDF with excel, the lines look like they should. So the problem only occurs when using Aspose.

Is this a bug in Aspose or is there anything wrong with the excel file?

I’ve attached the excel file and two PDFs (one created with excel and one created with aspose):

1_Sonderuntersuchung.zip (14.9 KB)
created_with_aspose_net_18_9.pdf (65.1 KB)
created_with_excel.pdf (54.2 KB)

@csbdev,

Thanks for your query.

We were able to observe the issue but we need to look into it more. We have logged the issue in our database for investigation and for a fix. Once, we will have some news for you, we will update you in this topic.

This issue has been logged as

CELLSNET-46386 - Grid lines converted to dotted lines while converting XLSX to PDF

@csbdev,

Please try below code and let us know your feedback.

Workbook wb = new Workbook(srcFile);
PdfSaveOptions pdfSaveOptions = new PdfSaveOptions();
pdfSaveOptions.GridlineType = GridlineType.Hair;
wb.Save(outFile.pdf, pdfSaveOptions);

Thank you for the fast reply. I’ve tested the code with my example and it looks good.

But I’m curious which lines are actually affected by this setting? Does it mean, if the user puts some dotted lines in his excel file, are they replaced with normal lines as well?

Edit:
I’ve put some dotted lines in my test sheet and converted to PDF.

created_with_excel.JPG (6.1 KB)
created_with_aspose.JPG (13.8 KB)

In the Aspose version, there two lines overlaping. The thin line created due to the grid setting and the dotted line created by the user. In the Excel version there is only the dotted line.

@csbdev,

Thank you for providing more information. Please share your sample test excel file where you put dotted lines and used in your testing. Also send us a console application (runnable) which is used during the testing along with the output PDF file.

@csbdev,

Setting pdfSaveOptions.GridlineType = GridlineType.Hair; only changes gridline from dotted to solid. It would not change dotted lines setting in the cell borders.

The gridline should not be rendered when the cell border is set. We are afraid we can not fix it now for gridlines rendering because of performance considerations.