Free Support Forum -

PDF rendition of an Excel document is missing top lines

I am using latest Aspose.Cells to convert and excel file to pdf. Post transformation, the pdf produced lacks few information from top.

Code Used:

   Workbook doc = new Workbook("C:\\Users\\Administrator\\Desktop\\3447181.xls");"C:\\Users\\Administrator\\Desktop\\Xls.pdf");

Attaching input file and output (43.9 KB)


We have evaluated your issue and found there is specific printable area (i.e., A11:M41) set for the sheet (in MS Excel, open Page Setup dialog and check Print area which does not cover all the data range of the sheet). That’s why when you render either by MS Excel or via Aspose.Cells, it just renders specific area only and misses certain top part of the sheet (mind you, both Aspose.Cells and MS Excel renders to PDF based on what is shown in the print preview of the sheet). To fix the issue, please either remove the printable area manually (in MS Excel) to re-save the file or set/remove the area to cover the whole range. You can do that either by using MS Excel or via Aspose.Cells in code. See the sample lines of code for your reference.
Sample code:

    Workbook doc = new Workbook("C:\\Users\\Administrator\\Desktop\\3447181.xls");
    Worksheet sheet = doc.getWorksheets().get(0);
    // remove the printable area
    sheet.getPageSetup().setPrintArea("");"C:\\Users\\Administrator\\Desktop\\Xls.pdf", SaveFormat.PDF);

Let us know if you still find any issue.

Hi @Amjad_Sahi,
Thank you so much for your assistance. I am able to get the required output now.


This is great. In the event of further queries or issue, feel free to write us back.