QXlsx icon indicating copy to clipboard operation
QXlsx copied to clipboard

Numbers with 4 digits

Open PMime opened this issue 5 years ago • 5 comments

In our project we try to get numbers(int and float) with 4 optional digits.

We used setNumberFormat with the String "0.####". The result is shown in the picture (Excel using german).

image

Is there a way to use setNumberFormat to get integers without the comma?

PMime avatar Nov 05 '19 13:11 PMime

Dear @PMime

Can you show me some code for testing?

j2doll avatar Nov 06 '19 08:11 j2doll

With an excel viewer, i have the same problem. With Openoffcie 4.1.7 (german settings) there is no problem.

It seems to be a problem with the system language settings and the decimal separator. If i understand the openxml, there is is no chance to have a solution without a vba macro.

GitterRalf avatar Dec 28 '19 13:12 GitterRalf

With an excel viewer, i have the same problem. With Openoffcie 4.1.7 (german settings) there is no problem.

It seems to be a problem with the system language settings and the decimal separator. If i understand the openxml, there is is no chance to have a solution without a vba macro.

Dear @GitterRalf

If you have any code that you have tested, please post it.
We will be able to start debugging and help you.

j2doll avatar Dec 28 '19 15:12 j2doll

With an excel viewer, i have the same problem. With Openoffcie 4.1.7 (german settings) there is no problem. It seems to be a problem with the system language settings and the decimal separator. If i understand the openxml, there is is no chance to have a solution without a vba macro.

Dear @GitterRalf

If you have any code that you have tested, please post it. We will be able to start debugging and help you.

I simply added "0.####" to numberformat.xlsx:

//Custom number formats
QStringList numFormats;
numFormats
	<< "Qt #"
	<< "yyyy-mmm-dd"
	<< "$ #,##0.00"
	<< "[red]0.00"
	<< "0.####";

GitterRalf avatar Dec 28 '19 15:12 GitterRalf

  • In my opinion, it seems to be different depending on local notation, not error.

  • Numeric formatting, In ECMA376

Picture Item Description
. Indicates the radix-point position. [Example: In a US-English context, =95.4 # $###.00 displays "$ 95.40. end example] The radix-point character displayed is locale-specific.
, Separates groups of three digits. [Example: In a US-English context, =2456800 # $#,###,### displays "2,456,800". end example] The separator character displayed is locale-specific.
  • And, How about trying something like this: (instead of 0.#### )
0.0000

j2doll avatar Jan 11 '20 13:01 j2doll