Exception raised while opening an XLSX file after conversion from HTML

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

@kumar.penigalapati,
I have tried it again but could not observe any issue. You may please download the complete solution here and try it again. It contains the required dll also.
https://www.dropbox.com/s/bsgpiborq9prmvy/TestHtmlToExcel.zip?dl=0

Hi Ahsan Iqbal,
we are not able to download the drop box file because if some firewall ristrictions.
the code which i am using is like this

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

            Workbook wb = new Workbook(stream, 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);
        }

can you send me like zip file ?

@kumar.penigalapati,
Thank you for sharing sample code. It is observed that this issue is caused by using the following line of code:

options.AutoFitColsAndRows = true;

You may please remove this line of code and try the scenario again. As you have already used AutoFitRows and AutoFitColumns for the output Excel file therefore the output seems fine.

Thanks Ahsan Iqbal,
after removing that line its working fine.
but will this have any other implications of other scenarios ?

@kumar.penigalapati,

There would be no consequences. For certain scenarios, you may skip this option when loading the HTML.

Thanks Amjad Sahi ,
I am seeing the spaces in Excel now.
Thank you!!

@kumar.penigalapati,
Thanks for the feedback. Feel free to contact us any time if you need further help or have some other issue or queries, we will be happy to assist you soon.

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

1 Like

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

A post was split to a new topic: Exception raised while loading HTML file without using “HtmlLoadOptions.AutoFitColsAndRows = true”