Skip to content

Add FORMAT_ACCOUNTING_CNY into NumberFormat #1576

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions src/PhpSpreadsheet/Style/NumberFormat.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,11 @@ class NumberFormat extends Supervisor
const FORMAT_CURRENCY_USD = '$#,##0_-';
const FORMAT_CURRENCY_EUR_SIMPLE = '#,##0.00_-"€"';
const FORMAT_CURRENCY_EUR = '#,##0_-"€"';
const FORMAT_CURRENCY_CNY_SIMPLE = '"¥" #,##0.00';
const FORMAT_CURRENCY_CNY = '¥ #,##0';
const FORMAT_ACCOUNTING_USD = '_("$"* #,##0.00_);_("$"* \(#,##0.00\);_("$"* "-"??_);_(@_)';
const FORMAT_ACCOUNTING_EUR = '_("€"* #,##0.00_);_("€"* \(#,##0.00\);_("€"* "-"??_);_(@_)';
const FORMAT_ACCOUNTING_CNY = '_("¥"* #,##0.00_);_("¥"* -#,##0.00_);_("¥"* "-"??_);_(@_)';

/**
* Excel built-in number formats.
Expand Down
15 changes: 15 additions & 0 deletions tests/data/Style/NumberFormat.php
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,16 @@
12345.678900000001,
'#,##0.000\ [$]',
],
[
'¥ 12,346',
12345.678900000001,
'¥ #,##0',
],
[
'¥ 12,345.68',
12345.678900000001,
'"¥" #,##0.00',
],
[
'5.68',
5.6788999999999996,
Expand Down Expand Up @@ -283,6 +293,11 @@
13.0316,
'_("€"* #,##0.00_);_("€"* \(#,##0.00\);_("€"* "-"??_);_(@_)',
],
[
' ¥ 1.03 ',
1.0327,
'_("¥"* #,##0.00_);_("¥"* -#,##0.00_);_("¥"* "-"??_);_(@_)',
],
// Named colours
// Simple color
[
Expand Down