fast_excel icon indicating copy to clipboard operation
fast_excel copied to clipboard

Money formatting with $ at the far left.

Open seigel opened this issue 5 years ago • 2 comments

Just wondering if you know what kind of formatting trickery might be used to get the '$' aligned far left with the numbers aligned right? Thanks!

seigel avatar May 12 '19 21:05 seigel

That's Accounting formatting. I wonder if just using the Accounting formatting from Excel when you select that would work:

_($* #,##0.00_);_($* (#,##0.00);_($* "-"??_);_(@_)

joshuapinter avatar Apr 14 '20 15:04 joshuapinter

Confirmed!

Screen Shot 2020-04-14 at 12 03 34 PM

Here is the format I used to get that formatting:

format = workbook.number_format( '_($* #,##0.00_);_($* (#,##0.00);_($* "-"??_);_(@_)' )
write_number( row_number, cell_number, value.to_d, format )

Of course, I'm not sure if you wanted it to be full Accounting format or not, with the negative values in parentheses, but now that you know you can have the currency symbol all the way to the left, you can easily modify this format to get the one that you like.

Powerful stuff!

@Paxa You can close this "Issue".

joshuapinter avatar Apr 14 '20 18:04 joshuapinter