Free Support Forum -

Save as HTML throws exception when cell as a file reference

The attached file throws an exception when I try and save it as HTML. It works fine if I re-save it as XLSX. If you edit the cell in Excel and hit return in the cell so that it becomes an HTTP link, rather than a file, then the save will work.

The example code would be:

        Workbook workbook = new Workbook("FinalresponseCutDown.xslx");

            string baseFileName = Path.GetFileNameWithoutExtension(excelFile);
            string excelFileExt = Path.GetExtension(excelFile);
            string htmlFile = outputDir + baseFileName + ".html";
            // This will fail
            workbook.Save(htmlFile, SaveFormat.Html);

            using (MemoryStream memoryStream = new MemoryStream())
                // So will this, if the previous save is commented out.
                workbook.Save(memoryStream, Aspose.Cells.SaveFormat.Html);

        catch (Exception ex)
            Debug.WriteLine("Failed to save: " + ex.ToString());
            workbook = null;

Andy (184.2 KB)


Thanks for the template file and sample code segment.

After an initial test, I am able to reproduce the issue as you mentioned by using your sample code with your template file. I found that saving as HTML throws exception “Object reference not set to an instance of an object” when a cell has a file reference in the sheet. I have logged a ticket with an id “CELLSNET-46941” for your issue. We will look into it soon.

Once we have an update on it, we will let you know.

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


Please try our latest version/fix (.NET and Java): Aspose.Cells v19.9.3 (attached)
(Please choose/download the appropriate fix for your underlying platform/language)

Your issue should be fixed in it.
Let us know your feedback.
Aspose.Cells19.9.3 For .Net2_AuthenticodeSigned.Zip (4.9 MB)
Aspose.Cells19.9.3 For .Net4.0.Zip (4.9 MB)
Aspose.Cells19.9.3 For .NetStandard20.Zip (4.1 MB)

[Java] (6.6 MB)

Thanks, that worked. I presume it will be included in the next release that’s added to NuGet, correct?


Good to know that your issue is sorted out by the new fix/version. And, yes, your understanding is correct, the upcoming release (e.g Aspose.Cells for .NET v19.10 which is expected to be published before the end of this week or so) will include this fix.

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