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

Free Support Forum - aspose.com

Exception thrown saving as PDF

Using latest ASPOSE.Cells .NET (20.7.0.0), the Save method throws an exception dealing with certain XLSX documents.
using (var TempDocument = new Aspose.Cells.Workbook(@“c:\test\test.xlsx”))
{
TempDocument.Save(@“c:\test\test.pdf”, Aspose.Cells.SaveFormat.Pdf);
}
This normally works, but fails with the following XLSX document:

Is there a workaround?

thx!

@jay_bp,

Please try our latest version/fix: Aspose.Cells for .NET v20.7.6 (attached)
Aspose.Cells20.7.6 For .Net2_AuthenticodeSigned.Zip (5.4 MB)
Aspose.Cells20.7.6 For .Net4.0.Zip (5.4 MB)

I have tested your scenario/ case by converting your template file to PDF with Aspose.Cells for .NET v20.7.6, it works and I do not get exception. However, both pictures are not rendered but only text in the cells. Did you get the same issue, please confirm?

This version does not throw an exception. Thanks!

@jay_bp,

Ok but could you tell if the output PDF is fine or you still find any issue, please elaborate?

It does not crash, but it is not showing those images. Other images seem to rendered to PDF correctly, but images like in that sample are not. Is there something in those images that is not supported?

thx

@jay_bp,
We have observed the issue that images are not rendered to PDF. This issue is logged in our database for further investigation. We will write back here once any update is ready to share.

This issue is logged as:
CELLSNET-47533 - Images in the Excel file are not rendered to PDF

@jay_bp,
This is to inform you that we have fixed your issue (logged earlier as “CELLSNET-47533”) now. We will soon provide you the fixed version after performing QA and incorporating other enhancements and fixes.

Great, thanks!

@jay_bp,
You are welcome.

The issues you have found earlier (filed as CELLSNET-47533) have been fixed in Aspose.Cells for .NET v20.8. This message was posted using Bugs notification tool by Amjad_Sahi

Hi, I just downloaded and tried 20.8.0.0 and it still does not render the images in the PDF, for the XLSX in this thread. Was this supposed to fix this?
thx

@jay_bp,

You need to set some PDF options regarding EMF image rendering (to show those images) while converting your file to PDF file format. See the following sample code for your reference:
e.g
Sample code:

.......
            PdfSaveOptions pdfSaveOptions = new PdfSaveOptions();
            pdfSaveOptions.EmfRenderSetting = EmfRenderSetting.EmfPlusPrefer;
       workbook.Save("E:\\test2\\out1.pdf", pdfSaveOptions );

Let us know if you still find any issue.

I just added those options, but the images still do not render for the XLSX in this post.

@jay_bp,
I have tried using the latest version Aspose.Cells for .NET 20.8 but could not observe any issue as the images are rendered in the output PDF. You may ensure that latest version is used during the testing. For your reference, I have tried the following sample code:

using (var TempDocument = new Aspose.Cells.Workbook(path + "test.xlsx"))
{
    PdfSaveOptions pdfSaveOptions = new PdfSaveOptions();
    pdfSaveOptions.EmfRenderSetting = EmfRenderSetting.EmfPlusPrefer;
    TempDocument.Save(path + @"test1.pdf", pdfSaveOptions);
}

test1.pdf (34.4 KB)

This works! Thanks!

@jay_bp,

Good to know that your issue is resolved. In the event of further queries or issue, feel free to write us back, we will be happy to assist you soon.

@jay_bp,

Please note, the two images in the source file are EmfPlusOnly emf file, so, the EmfRenderSetting.EmfPlusPrefer should be set in PdfSaveOptions.