Free Support Forum - aspose.com

Exception raised while opening an XLSX file after conversion from HTML

Hi Ahsan Iqbal,
We are facing one more new issue with Html to Excel conversion.
the excel is opened we are seeing the popup message
“We found a problem with some content in page xx. do you want us to try to recover as much as we can? … etc”

please see the attached html file that we used and error screen shots.

Html to Excel Issue.zip (31.9 KB)

@kumar.penigalapati,
We have observed the issue and logged it in our database for further investigation. We will write back here once any update is ready for sharing.

This issue is logged as:
CELLSNET-47840 - Exception raised while opening Excel file generated from an HTML

@kumar.penigalapati,
This is to inform you that we have fixed your issue now. We will soon provide you the fixed version after performing QA and incorporating other enhancements and fixes.

Thank you Ahsan Iqbal!!

@kumar.penigalapati,
You are welcome.

@kumar.penigalapati,
Please try the latest fix 21.1.4.
Aspose.Cells21.1.4 For .Net2_AuthenticodeSigned.Zip (5.5 MB)
Aspose.Cells21.1.4 For .Net4.0.Zip (5.5 MB)
Aspose.Cells21.1.4 For .NetStandard20.Zip (5.5 MB)

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

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

Thank you John, we will validate it and let you know.

Ahsan Iqbal,
we are facing another issue with HTML to excel conversion.

the error which we are seeing is

Cells in range A75:T75 cannot be merged because cells in range F75:Y75 have already been merged.

at .(Cells , Int32 , Int32 , Int32 , Int32 )
at ​.(Cell )
at ​. ()
at ​. ()
at ​.(String , ArrayList )
at ​.()
at ​.()
at ​.(Stream )
at .(String , Stream , LoadOptions )
at Aspose.Cells.Workbook.(Stream , LoadOptions , Boolean )
at Aspose.Cells.Workbook…ctor(Stream stream, LoadOptions loadOptions)

please see the attached Html file that we used.
Thank you.
HtmlPage9.zip (12.2 KB)

This issue has been resolved Thanks John!!

@kumar.penigalapati,
We are glad to know that your issue is resolved. Please feel free to write us back if you have any other query related to Aspose.Cells.

Ahsan Iqbal,
we are facing another issue with HTML to excel conversion.

the error which we are seeing is

Cells in range A75:T75 cannot be merged because cells in range F75:Y75 have already been merged.

at .(Cells , Int32 , Int32 , Int32 , Int32 )
at ​.(Cell )
at ​. ()
at ​. ()
at ​.(String , ArrayList )
at ​.()
at ​.()
at ​.(Stream )
at .(String , Stream , LoadOptions )
at Aspose.Cells.Workbook.(Stream , LoadOptions , Boolean )
at Aspose.Cells.Workbook…ctor(Stream stream, LoadOptions loadOptions)

please see the attached Html file that we used.
Thank you.HtmlPage9.zip (12.2 KB)

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