You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@poi.apache.org by bu...@apache.org on 2006/01/03 08:29:57 UTC

DO NOT REPLY [Bug 30319] - Euro symbol in usermodel DataFormat (+ FIX)

DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=30319>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=30319


jheight@apache.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED




------- Additional Comments From jheight@apache.org  2006-01-03 08:29 -------
I have implemnted a fix in SVN, however it is not as suggested in the Workbook,
but rather in the low level FormatRecord.

Confirmed that it works with the following code:

Please check on a euro excel version, but ill close since i think that it is now
fixed.


import org.apache.poi.hssf.usermodel.*;
import java.io.*;

public class Test {

  public static void main(String[] args) {
    try {
      long time1 = System.currentTimeMillis();
//      HSSFWorkbook wb = new HSSFWorkbook(new FileInputStream(new File(
//          "c:/workbook-orig.xls")));
//      wb.write(new FileOutputStream(new File("c:/workbook-out.xls")));
//
      HSSFWorkbook wb = new HSSFWorkbook();
      HSSFDataFormat df = wb.createDataFormat();
      short fmt = df.getFormat("_([$\u20ac-2]\\\\\\ *
#,##0.00_);_([$\u20ac-2]\\\\\\ * \\\\\\(#,##0.00\\\\\\);_([$\u20ac-2]\\\\\\
*\\\"\\-\\\\\"??_);_(@_)");
      HSSFSheet s = wb.createSheet("TestSheet");

      HSSFRow r = s.createRow(0);
      HSSFCell c = r.createCell((short)1);
      c.setCellValue(12.34);
      c.getCellStyle().setDataFormat(fmt);
            
      wb.write(new FileOutputStream(new File("c:/test1_out.xls")));
      System.out.println("Elapsed :"+(System.currentTimeMillis()-time1));
    } catch (Exception ex) {
      ex.printStackTrace();
    }
  }
}


-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

---------------------------------------------------------------------
To unsubscribe, e-mail: poi-dev-unsubscribe@jakarta.apache.org
Mailing List:    http://jakarta.apache.org/site/mail2.html#poi
The Apache Jakarta POI Project: http://jakarta.apache.org/poi/