Skip to content
This repository has been archived by the owner on May 19, 2024. It is now read-only.

How to change number of decimals #33

Open
thomas-negrault opened this issue Dec 3, 2017 · 2 comments
Open

How to change number of decimals #33

thomas-negrault opened this issue Dec 3, 2017 · 2 comments

Comments

@thomas-negrault
Copy link

I have a cell with a formula and I would like to display only 2 decimals (if the value is 1.123456, I want to display 1.12).

In phpexcel, the following should work:

$sheet->getStyle('A1')->getNumberFormat()->setFormatCode('#,##0.00');
$sheet->getStyle("A1")->getNumberFormat()->setFormatCode('0.00'); 

I've tried:

{% xlscell 9 {style: {'numberFormat':{'formatCode':'#,##0.00','code':'#,##0.00'}}} %}
=J2 / 2
{% endxlscell %}

But it does not work..

What is the correct way to achieve this ?

For now I m using the Excel FIXED function but it is not optimal..

@lackynasta
Copy link

Did you solved it? I got the same issue.

@thomas-negrault
Copy link
Author

Unfortunately no, I'm still using the FIXED function
{% xlscell %}=FIXED({{ variable }},2){% endxlscell %}

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants