Exception raised while opening an XLSX file after conversion from HTML

@kumar.penigalapati,

Which version of the product, you are using? I tested your scenario/case using your newly attached HTML file to convert to XLSX file format, it works fine and I do not find any exception. I used the following sample code with your file:
e.g.
Sample code:

HtmlLoadOptions opts = new HtmlLoadOptions(LoadFormat.Html);
            Workbook workbook = new Workbook("e:\\test2\\HtmlPage9.html", opts);
            string output = "e:\\test2\\out1.xlsx";
            workbook.Save(output);

Please try our latest version/fix (e.g. Aspose.Cells for .NET v21.2.x). If you still find the issue using latest version/fix, please paste your sample code (runnable) to reproduce the issue, we will check it soon.

Hi Amjad Sahi
i am using v21.2.0 and i am seeing the error.

here is my sample code

        string proxyurl = "xyzUrl";
        string bgresult = System.IO.File.ReadAllText(path1 + "\\HtmlFiles\\HtmlPage9.html");
        using (MemoryStream stream = new MemoryStream(System.Text.Encoding.UTF8.GetBytes(bgresult)))
        {
            HtmlLoadOptions options = new HtmlLoadOptions(LoadFormat.Html);
            options.StreamProvider = new StreamProvider47584(proxyurl);
            options.AutoFitColsAndRows = true;

            Workbook wb = new Workbook(stream, options);
            //Workbook wb = new Workbook(path1 + "\\HtmlFiles\\HtmlPage6.html", options);
           

            Worksheet ws = wb.Worksheets[0];
            ws.Name = "Test";
            ws.AutoFitRows();
            ws.AutoFitColumns();

            PageSetup pageSetup = ws.PageSetup;
            pageSetup.SetHeader(1, string.Format("&\"Times New Roman,Bold\"Title: {0} {1} {2}", "Test BillingGuide Name", "Enabled", DateTime.Now.ToString("yyyy-mm-dd")));

            wb.Save(path1 + "\\Page_out.xlsx", SaveFormat.Xlsx);
        }

its failing at line “Workbook wb = new Workbook(stream, options);”

when i removed the options.AutoFitColsAndRows = true, it seems to be working fine.
but we need this setting for other Html to Excel export files, i am not sure on other implications of this setting being removed.
what do you suggest ? removing vs removing on specific conditions if there are any ?
Thanks.

@kumar.penigalapati,
We have observed the issue and reopened the ticket for further investigation. You will be notified here once any update is ready for sharing.

Thanks Ahsan Iqbal!!

@kumar.penigalapati,
You are welcome.

Hi Ahsan Iqbal,
any update on the issue ?

@kumar.penigalapati,
We are gathering information about this issue and will share our feedback soon.

@kumar.penigalapati,
We have added a new ticket (“CELLSNET-47882”) for the last issue and we hope to provide you fix before the weekend.

Thank you!! Ahsan Iqbal

@kumar.penigalapati,
You are welcome.

@kumar.penigalapati,

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

@kumar.penigalapati,
Please try our latest version/fix: Aspose.Cells for .NET v21.2.6 (attached)
Aspose.Cells21.2.6 For .Net2_AuthenticodeSigned.Zip (5.5 MB)
Aspose.Cells21.2.6 For .Net4.0.Zip (5.5 MB)
Aspose.Cells21.2.6 For .NetStandard20.Zip (5.5 MB)

Your issue should be fixed in it.
Let us know your feedback.

Hi Amjad Sahi,
We are facing another issue with Html to Excel conversion.
some of the content from html file is missing in excel file after html to Excel conversion.
please see the attached screen shots and html file that was used.
we are using v21.2.6

Html to Excel Issue.zip (200.8 KB)

@kumar.penigalapati,

Please notice, we were able to reproduce the issue using your template file and following sample code. We found some HTML contents are missing the output Excel file.
e.g.
Sample code:

HtmlLoadOptions opts = new HtmlLoadOptions(LoadFormat.Html);
            opts.AutoFitColsAndRows = true;
            Workbook workbook = new Workbook("e:\\test2\\HtmlPage8.html", opts);
            string output = "e:\\test2\\out1.xlsx";
            workbook.Save(output);

We have logged a separate ticket with an id “CELLSNET-47920” for your issue. We will look into it soon.

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

Thank you Amjad Sahi

The issues you have found earlier (filed as CELLSNET-47882) have been fixed in this update. This message was posted using Bugs notification tool by simon.zhao

1 Like

Hi Amjad Sahi,
we have found one more issue with Html to Excel conversion.
there were some spaces missing in the text converted in Excel file.
please see the attached excel file and screenshots.
Html to Excel space Issue.zip (106.9 KB)

@kumar.penigalapati,
I have tried this scenario with the latest version 21.3 but could not observe any issue in the converted Excel file. You may please ensure that you are using the latest version. If issue is not resolved, share your complete runnable simple console based solution including the latest libraries for our reference. We will test your project here and share our feedback accordingly.

HtmlPage10.xlsx.zip (10.0 KB)

Hi Ahsan Iqbal,
I have tried using v21.3 and still see the issue of not showing the space in Exported file.
please see the attached screenshots.
Issue.zip (199.3 KB)