Workbook with embedded Excel workbook not rendering to PDF correctly



I convert the attached Excel workbook to PDF as follows using Aspose.Cells for .NET 19.5:

Aspose.Cells.Workbook workbook = new Aspose.Cells.Workbook("input.xls");

    foreach (var sheet in workbook.Worksheets)
        foreach (var ole in sheet.OleObjects)
            ole.HasLine = false;

var saveOpts = new Aspose.Cells.PdfSaveOptions();
saveOpts.PrintingPageType = Aspose.Cells.PrintingPageType.IgnoreStyle;
workbook.Save("output.pdf", saveOpts);

The first 5 pages of the PDF are rendered correctly. However, pages 6 to 58 are rendered as empty rows (happens regardless PrintingPageType being is set to IgnoreStyle or IgnoreBlank). The content in the workbook on sheet 2 is largely missing. (869.1 KB)

Can you please advise:

  1. How can I stop the empty rows from being added to the PDF;

  2. Is it possible to get the embedded workbook to fully display?

Thank you!


If we convert the entire workbook to PDf using Excel 2016, it also creates 58 pages. The same output is generated by Aspose.Cells.

You can hide your worksheets which you do not want to render to PDF and then save your workbook into PDF format. This way, your only visible worksheets will be rendered to PDF.

Please see the following documentation article which illustrates how to render each worksheet into a separate PDF file. You can use this same approach to render your selected worksheets into PDF.

Save Each Worksheet to a Different PDF File

Regarding displaying the embedded workbook, Aspose.Cells follows the features of Excel. Hence the embedded Excel file will be displayed in the rendered PDF.


We have investigated it a bit more, about pages 6 to 58 rendered as empty rows, it is because that the embedded object in sheet “Service Sheet” is only displayed as a thumbnail image in Excel. It is a big dimension image with a lot of blank pages (only gridlines in it). You can also check it in Microsoft Excel.

About stopping empty rows from being added to the PDF, it can not be done because blank pages are in the thumbnail image. For getting embedded workbook to fully display, you can try to get the embedded workbook from OleObject

Workbook workbook = new Workbook("input.xls");
Worksheet sheet = workbook.Worksheets["Service Sheet"];
int i = 0;
foreach(OleObject ole in sheet.OleObjects)
    byte[] data = ole.ObjectData;
    using(MemoryStream mstream = new MemoryStream(data))
        Workbook subWb = new Workbook(mstream);
        subWb.Save("output_" + i + ".pdf");

Hope, this helps a bit.