Lines missing in PDF

I’m creating a PDF from an Excel Sheet with Aspose.Cells for .NET. But in PDF the last lines are missing.



I’ve attached the Excel file and the PDF created with Aspose. On page 2 the PDF document ends with line “E21” but in Excel there are some more lines.

Is this a bug, or is something wrong with the Excel file?



Using the lastest version: Aspose.Cells 8.9.2

Hi Rainer,


Thank you for contacting Aspose support.

Please note, you sample spreadsheet has print area set to A1:S33, therefore any rows beyond 33 will not be included in the resultant PDF. You can avoid the said problem by clearing the PrintArea property for the said Worksheet. Please check the following piece of code and its resultant PDF.

C#

var book = new Workbook(dir + “CIP-Protokoll+Joghurtabteilung.xlsx”);
book.Worksheets[0].PageSetup.PrintArea = “”;
book.Save(dir + “output.pdf”);

Thank you for the fast reply.



Does Aspose set a default print area, if I don’t set one manually?

In the Excel file there is no print area set (see attached screenshots).

When I go to Excel and save the file as PDF, the missing lines are included. Only when using Aspose they are missing.

Hi again,


First of all, the sample spreadsheet shared in this thread shows the Print Area set to A1:S33 on my side. Please check the attached snapshot for your reference. If you are not seeing the same on your end, it is possible we are operating on 2 different samples.

Regarding your other concerns, Aspose.Cells APIs first consider the Print Area set for the Worksheet and renders accordingly. In case the Print Area hasn’t been set the the Aspose.Cells APIs will internally calculate the Print Area. It is mostly the range of cells that can also be obtained by Cells.MaxDisplayRange.

Thank you for your help.

I’ve done some further research and I can say that it’s not a Problem with Aspose. The Excel file does contain a print area but it’s not shown when opened with a german version of Excel.

When the Excel file is opened with a text Editor, the print area is shown.



I think this is a bug in Excel. Looks like, when a Excel file is saved with an english Version, some Features doesn’t work correctly any more when opend with a german Version after that.

The print area set by myself (A1:F6)has a different Name than the original print area.

I will Report this to Microsoft.

Hi Rainer,

Thank you for letting us know that you have figured out the problem. Please feel free to contact us back in case you need our further assistance with Aspose APIs.