How to display '-' character in a cell when actual value is 0 (Zero) in ExcelJS

751 views Asked by At

This is easily done on Excel with custom formatting; but I don't find out how to do it programmatically in Javascript (ExcelJS). I don't want to replace the value, just how it is displayed.

view excel sheet

1

There are 1 answers

1
Gi1ber7 On BEST ANSWER

I found the way to accomplish this, it may help others. So here is it:

worksheet.getCell('A1').numFmt = '_(#,##0_);_( (#,##0);_( \\-\\ ??_);_(@_)';