Possible bug in Cells when converting XLSX to PDF

Hello,

I’m getting an “object reference not set to an instance of an object” when I run the following code. I’m using Cells version 4.4.0.20 and PDF version 3.6.1.6.

The error only occurs when I’ve opened an Excel 2007 XLSX file to convert. Works great with Excel 2003 XLS files.


// Save the document to a memory stream
MemoryStream stream = new MemoryStream();
workbook.Save(stream, FileFormatType.AsposePdf); // Error occurs on this line
stream.Seek(0, SeekOrigin.Begin); // Reset the pointer to the beginning of the stream

// Load the document as raw XML
XmlDocument xmlDoc = new XmlDocument();
xmlDoc.Load(stream);

// Open in Aspose PDF
Aspose.Pdf.Pdf pdf = new Aspose.Pdf.Pdf();
pdf.BindXML(xmlDoc, null);


Thanks for thinking about this.

Mike

Hi,

Thanks for considering Aspose.

Could you post your template file here.

Thank you.

Sure. Here you go.

Hi,

Thanks for the template file.

Well, you file contais some charts and may contain some external references which are still to be supported for Excel2007 .xlsx format. We are working on it and support it soon.

Thank you.

I believe the external references have all been removed. I can successfully use Cells to merge data into this template… the problem only occurs when convering to PDF.

Mike

Hi Mike,

Thanks for considering Aspose.

Could you try to open your template file and save it as to .xlsx format only, I think you can't and will get " Do not support OpenXML file with external References!" which specifies that external references in .xlsx file is not supported yet. We will support them soon.

Thank you.

HI Mike,

After removing the external references in the file, we find the problem of converting excel to pdf file.

Please try this fix.

Hi Warren,

Thank you, but something seems wrong here. The version number of this file looks like it’s Cells v 4.4.0.20, but I’m already using that version. I didn’t try it, I thought I’d ask about the version number first.

Mike

Interesting though, that the file size is different than the 4.4.0.20 I already had. I’ll try it and let you know.

Hi,

Sorry! We forget to change the verion number. We will change it in the next fix.