We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Xlsx Data Formating issue

Hello,
when I did conversion from html to xlsx using Aspose , I have an issue with negatives number.
example using the same file, when I use your online tool all want fine . but when I did it locally , I can did addition operation on negatives number from the xlsx resulted doc.
this is the original html document mergedDoc.zip (541 Bytes)
this is the online tool result Olinetool.zip (6.3 KB)
and this what I generate locally localDev.zip (7.2 KB)
and this is my code c# :

private byte[] HtmlToXsl(string document)
    {
        byte[] byteArray = Encoding.Default.GetBytes(document);
        MemoryStream stream = new MemoryStream(byteArray);

        HtmlLoadOptions opts = new HtmlLoadOptions(LoadFormat.Html);
        OoxmlSaveOptions xlsx = new OoxmlSaveOptions(SaveFormat.Xlsx);

        var workbook = new Aspose.Cells.Workbook(stream, opts);

        Worksheet worksheet = workbook.Worksheets[0];
        worksheet.AutoFitColumns();

        MemoryStream streamOut = new MemoryStream();
        workbook.Save(streamOut, xlsx);
        byte[] b = streamOut.ToArray();
        return b;
    }

I need your help please .

here a screenshot of what about I want to do
image.png (47.7 KB)
negative number are handled as a string

@Benabdallah_Sabti,

Which version of the product you are using? I tested your scenario/case using our latest version/fix: Aspose.Cells for .NET v21.7.5 (Please try the latest fix if you are not already using it):
Aspose.Cells21.7.5 For .Net2_AuthenticodeSigned.Zip (5.5 MB)
Aspose.Cells21.7.5 For .Net4.0.Zip (5.6 MB)
Aspose.Cells21.7.5 For .NetStandard20.Zip (5.6 MB)

it works fine and the output file (attached) is fine tuned. Here is my simple sample code that I am using:
e.g.
Sample code:

 HtmlLoadOptions opts = new HtmlLoadOptions(LoadFormat.Html);
            OoxmlSaveOptions xlsx = new OoxmlSaveOptions(SaveFormat.Xlsx);

            var workbook = new Aspose.Cells.Workbook("e:\\test2\\mergedDoc.html", opts);

            Worksheet worksheet = workbook.Worksheets[0];
            worksheet.AutoFitColumns();
            workbook.Save("e:\\test2\\out1.xlsx", xlsx);

Please find attached the output file and open it into MS Excel if it is Ok.
files1.zip (7.2 KB)

hello Amjad,
thank you for your response, I did a test using ( Aspose.Cells21.7.5 For .NetStandard20.Zip)
but I steel have the same issue, I do not have the same number formatting as you , I take this screenshot my result are in red and yours in bleu :
image.png (55.4 KB)
it’s not linked to machine localisation?

@Benabdallah_Sabti,

Yes, your issue might be due to your locale or regional settings of your machine.
It looks like the separator for thousand group is ’ ’ and the decimal separator is ‘,’ for your computer. Kindly set the Region property of the LoadOptions or the CultureInfo property (at the start of your code) to be set to US English and it should work ok on your end as well.

Thank you Amjad, it’s work fine now.

@Benabdallah_Sabti,

That is great. Feel free to write us back if you have other queries or issue, we will be happy to assist you soon.