I’m trying to use the html loadoptions for creating a workbook.
Hi Steve,
Thanks for your posting and using Aspose.Cells.
Please download and try the latest version: Aspose.Cells
for .NET v8.0.0.3 and see if it fixes your issue.
If your issue still persists, then please provide us your source html and sample code. We will look into it and update you asap.
Hi, please see the attached file.
Hi,
Thanks for your posting and using Aspose.Cells.
If you open your html file directly in MS-Excel, it will also not calculate the formula. Because your currency values are detected as General not as Numbers. So, I think, this issue cannot be fixed.
However, I have logged this issue in our database for further investigation. We will look into it and fix this issue. Once, the issue is resolved or we have some other update for you, we will let you know asap.
This issue has been logged as CELLSNET-42562.
I have attached the output file and screenshot for a reference.
C#
private string GetHtmlText()
{
return @"
<table style="“width: 100%”">
1.500,50 $
1.500,50 $
1.500,50 $
1.500,50 $
1.500,50 $
=SUM($A$1:$E$1)
Spanish Data and format
$ 1
$ 1
$ 1
$ 1
$ 1
=SUM($A$2:$E$2)
US Data
";
}
private void button1_Click(object sender, System.EventArgs e)
{
string html = GetHtmlText();
byte[] data = Encoding.UTF8.GetBytes(html);
var stream = new MemoryStream(data);
var loadOptions = new LoadOptions(LoadFormat.Html);
var wb = new Workbook(stream, loadOptions);
wb.Worksheets[0].AutoFitRows();
wb.Worksheets[0].AutoFitColumns();
// wb.CalculateFormula();
wb.Save(@“myasposetest.xlsx”, FileFormatType.Xlsx);
}
Hi Steve,
Thanks for using Aspose.Cells.
For numeric value, you can set the correct HtmlLoadOptions.Region to recognize the correct separators such as for your case ‘.’ is group separator and ‘,’ is decimal separator.
For currency symbol, because it is at the tail of the value, only ‘€’ can be recognized. If value in your given html file is like:
1.500,50 €
then with HtmlLoadOptions.Region = CountryCode.Germany user can get the correct double vlaue 1500.5 for this cell.
C#
var loadOptions = new HTMLLoadOptions();
loadOptions.Region = CountryCode.Germany;
var wb = new Workbook(stream, loadOptions);
Hi,
Thanks for using Aspose.Cells.
Please download and try this fix: Aspose.Cells
for .NET v8.0.1.1 and let us know your feedback.
Can you paste in the entire code you’re using for this to work? I’m getting the following error when I try setting the region.
Hi Steve,
Thanks for your posting and using Aspose.Cells.
Please use the following code. I have attached the output xlsx file generated by it for your reference.
C#
string html = @"
1.500,50 € | 1.500,50 € | 1.500,50 € | 1.500,50 € | 1.500,50 € | =SUM($A$1:$E$1) | Spanish Data and format |
$ 1 | $ 1 | $ 1 | $ 1 | $ 1 | =SUM($A$2:$E$2) | US Data |
";
byte[] data = Encoding.UTF8.GetBytes(html);
var stream = new MemoryStream(data);
var loadOptions = new HTMLLoadOptions();
loadOptions.Region = CountryCode.Germany;
var wb = new Workbook(stream, loadOptions);
wb.Worksheets[0].AutoFitRows();
wb.Worksheets[0].AutoFitColumns();
//wb.CalculateFormula();
wb.Save(@"myasposetest.xlsx", SaveFormat.Xlsx);
The issues you have found earlier (filed as CELLSNET-42562) have been fixed in this update.
This message was posted using Notification2Forum from Downloads module by Aspose Notifier.