question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Bug Report]: formatN should not output "0" when no input is provided

See original GitHub issue

Environment Carbone Version: 2.1.0 Node Version: 10.20.1 Desktop OS: Debian Stretch LibreOffice: 6.1.5.2

Expected Behaviour

null:formatN() xml output should be an empty string

Actual Behaviour

null:formatN() output “0”

Steps to reproduce

Try to format null or undefined:

null:formatN()

Other comments

Is there a workaround? I am playing with Conditioned output but I can’t make it work.

{$my_number:ifEmpty()} // OK: value is not printed if null 
{$my_number:ifEmpty():formatN()} // KO: '0' is printed if null

Issue Analytics

  • State:open
  • Created 3 years ago
  • Comments:7 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
Toubcommented, Nov 5, 2020

Thanks for your reply.

I switch back to exceljs for complex spreedsheet generation.

But I will give an other try to carboneJS soon in order to provide to my applications users a simple way customize basic non-spreadsheet documents templates.

0reactions
steevepaycommented, Nov 5, 2020

Hello @Toub, sorry for the delay! After discussing with the team, we got the same problem internally. Our main priority is to improve the XLSX report generation and then we will be able to fix this issue. In the meantime, you can take a look at the preprocessing process where the formatN is behaving differently than other formatters for ODS/XLSX files: https://github.com/Ideolys/carbone/blob/37355e9e789320a5d50013ec94be50092e33b9e6/lib/preprocessor.js#L212 If a formatN formatter is found, the string cell is converted to a number cell. As it is a preprocessing function, this stage doesn’t know if the injected value exists. To fix the issue, the cell conversion should be done during or after the building process.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Ten simple rules for reporting a bug - PLOS
Rule 2: Check whether the bug is already fixed​​ If you really do need to file a bug against an old version, be...
Read more >
How to Report Bugs Effectively - PowerWorld
Anybody who has written software for public use will probably have received at least one bad bug report. Reports that say nothing ("It...
Read more >
Reading bug reports | Android Open Source Project
Android bug reports contain dumpsys , dumpstate , and logcat data in text (.txt) format, enabling you to easily search for specific content....
Read more >
GCC Bugs - GNU Project
If you report a bug which causes the compiler to print a bug box, include that bug box in your report, and do...
Read more >
CWE-20: Improper Input Validation (4.9) - MITRE
When software does not validate input properly, an attacker is able to craft the input in a form that is not expected by...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found