This project is read-only.

Minus number format with brackets - "()"

Aug 23, 2010 at 2:47 AM
Edited Aug 23, 2010 at 2:49 AM

First, thanks  you for a great NPOI. I feel it is easy to use...

 

I have 2 small problems:

01.  I wanna to format a number cell which has value < 0, I mean minus number with 2 brackets

For example: number    -9  will be format as (9)

02.  Date cell format with "dd/MM/yyyy"

In our culture, date will be formated as "dd/MM/yyyy". But in your example I found just could be "m/d/yy"

And When I open it with Open Office, the cell could not display the correct format

 

How can I do it with NPOI?

 

Thank you again with this library.

DongMT

 

 

Aug 27, 2010 at 9:47 PM

01.  Apply this custom number format to the cell  "#,##0_);(#,##0)".  That should work  If they need to be red use "#,##0_);[Red] (#,##0)".

02.  You should be able to format dates with that format, but remember, you can only apply custom formats to number cells, so you will have to convert your date to an OADate. 

Aug 28, 2010 at 2:59 AM

Thank you , dgusa

You have a high understanding about format in NPOI

To fix problem  02 may make the application slow down  cause it need to convert every date format cell to OADate ...

Thanks again :)

DongMT from  Vietnam