Save as HTML throws exception when cell as a file reference


#1

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");

        try
        {
            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());
        }
        finally
        {
            workbook = null;
        }

Thanks,
Andy
FinalresponseCutDown.zip (184.2 KB)


#2

@bsant,

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.


#3

@bsant,
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.


#4

@bsant,

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.
[.NET]
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]
Aspose_Cells_Java_v19.9.3.zip (6.6 MB)


#5

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


#6

@bsant,

Good to know that your issue is sorted out by the new fix/version. And, yes, your understand 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.