Excel Number format not same as in styles.xml when workbook is opened.

R D 6 Reputation points
2022-07-27T23:54:45.25+00:00

225512-excel-options.pngExcel workbook is generated using aspose cells. Generated workbook's styles.xml appears correct. However when the excel workbook is opened, the number format is no longer what it shows in styles.xml.

For example - in this case I would like to have comma as the decimal separator and dot as thousand separator, with one digit after decimal.

The workbook has following specified in the styles.xml :
<numFmt numFmtId="182" formatCode="#.##0,0;[Color3]-#.##0,0"/>
</numFmts>

When this workbook is opened, and when I look at the corresponding number format for the cell, it has been replaced with incorrect format string:
"#,##00;[Color3]-#,##00" which makes the numbers appear incorrect.
225511-workbook.xml
Number -40845,3 appears incorrectly as "-40845,300" - with no thousand separator and incorrect number of decimal places.

Excel options-->advanced options has been set to correctly match the format options.

Any idea what could be wrong here and why Excel is changing the format string?

225521-styles.xml

225531-excel-cell.png

Office Open Specifications
Office Open Specifications
Office: A suite of Microsoft productivity software that supports common business tasks, including word processing, email, presentations, and data management and analysis.Open Specifications: Technical documents for protocols, computer languages, standards support, and data portability. The goal with Open Specifications is to help developers open new opportunities to interoperate with Windows, SQL, Office, and SharePoint.
127 questions
Excel Management
Excel Management
Excel: A family of Microsoft spreadsheet software with tools for analyzing, charting, and communicating data.Management: The act or process of organizing, handling, directing or controlling something.
1,685 questions
{count} vote

3 answers

Sort by: Most helpful
  1. Hung-Chun Yu 976 Reputation points Microsoft Employee
    2022-08-02T19:34:00.917+00:00

    Hi @R D

    It turned out it's by design.

    The option customer is toggling is an app setting and it has impact only in how user interacts with the application, it has no impact on how file load/save would operate. File content must be written in a way that's invariant across different locales and different app settings. As a result, files are always written using comma and period as the thousands/decimal separator respectively.

    Hung-Chun Yu
    Microsoft Open Specifications Support

    0 comments No comments

  2. R D 6 Reputation points
    2022-08-04T16:37:03.047+00:00

    If this is by design, please explain how one can set number formatting to custom format string, which is different than the standard English one.


  3. R D 6 Reputation points
    2022-08-04T18:37:24.193+00:00

    VB cannot work for us. Excel workbook is generated on the server using a java library. It is not possible to set client-side locale settings, or preferences. Workbook generated needs to set custom format using specified decimal and thousand separator in the cell itself.

    Also, this used to work before, and appears to be broken recently.