Mansoor, I reckon you should have posted this in the User formu, not the Dev
one. Having said that, I think it is possible to use the Euro symbol in a
format String if you do the following;

Get the HSSFDataFormat object for the sheet you are working on by calling
the createDataFormat() method of the HSSFWorkbook object.
Then, you can call the getFormat() method of the HSSFDataFormat class and
pass this String - €#,##0;€#,##0 - to it whenever you need to set the cells
style something like this;

    Workbook wb = new HSSFWorkbook();
    Sheet sheet = wb.createSheet("format sheet");
    CellStyle style;
    DataFormat format = wb.createDataFormat();
    Row row;
    Cell cell;
    short rowNum = 0;
    short colNum = 0;

    row = sheet.createRow(rowNum++);
    cell = row.createCell(colNum);
    cell.setCellValue(11111.25);
    style = wb.createCellStyle();
    style.setDataFormat(format.getFormat("€#,##0;€#,##0"));
    cell.setCellStyle(style);

Just a tip, if you do not have the Euro symbol on your PC, simply sut and
paste the fromat String from this message.

As to your question regarding $\u20ac and $\u20ac-1, I am not sure what you
are asking here. Are you asking what characters the two unicode escape
sequences create?

Finally, whjat do you mean to render negative numbers as (XXX.XX) - is that
a literal that you want to display to the user whenever a negative number is
entered into a cell or do you want to display the value -2.20 as (2.20)? If
the latter, then all you need to do is create a format String something like
this;

"###.##;(###.##)"

That will display positive numbers like 220.30 as 22.30 and negative numbers
like -220.30 as (220.30).

If the former, then I am not at all sure how to accomplish this as Excel is
likely to insert what it sees as the most significant digits into the
display.


makthar wrote:
> 
> HI All
> 
> How do i insert the euro symbol in excel sheets.
> 
> I tried using [$\u20ac] #,##0.00 but of no use.
> 
> what is the difference between $\u20ac and $\u20ac-1. Also how do i tell
> POI that when it renders a negative number it should display it as
> (XXX.XX).
> 
> 
> Thank You
> Mansoor.
> 

-- 
View this message in context: 
http://www.nabble.com/Euro-symbol-using-Apache-POI-tp22046579p22052743.html
Sent from the POI - Dev mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to