You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@poi.apache.org by Birendar Waldiya <bw...@cisco.com> on 2006/05/14 06:59:52 UTC
Dates displayed as Number : POI API's-POI Horrors !!!
Hi All,
I am facing an unpredictable behaviour of excel date while reading excel
files using POI, sometime the dates appear as dates and somtine they appear
as number ,
this often happens when I first chose a date format say mm/dd/yyyy read the
excel. Now I chage the date format dd/mm/yyyy now the date start appearing
as number No matter what format I go now.
Can anyone tell me why this is happening?
Thanks
Regards
Birendar S Waldiya
HSSFWorkbook wb = new HSSFWorkbook()?
Posted by LiuGuoMing <gm...@sytdc.com>.
HI,ALL
HSSFWorkbook wb = new HSSFWorkbook();
HSSFSheet sheet = wb.createSheet("new sheet");
HSSFRow row = sheet.createRow((short)30);
HSSFCell cell = row.createCell((short)0);
cell.setEncoding(HSSFCell.ENCODING_UTF_16);
cell.setCellValue("111");
cell=row.createCell((short)1);
cell.setCellValue("222");
row.createCell((short)2).setCellValue("333");
row.createCell((short)3).setCellValue(true);
FileOutputStream fileOut = new
FileOutputStream("f:/mytest/workbook.xls",true); // why it is not save.
// FileOutputStream fileOut = new
FileOutputStream("f:/mytest/workbook.xls"); // it is save success.
wb.write(fileOut);
fileOut.close();
---------------------------------------------------------------------
To unsubscribe, e-mail: poi-user-unsubscribe@jakarta.apache.org
Mailing List: http://jakarta.apache.org/site/mail2.html#poi
The Apache Jakarta Poi Project: http://jakarta.apache.org/poi/
Re: java.lang.OutOfMemoryError: Java heap space
Posted by Denis Pimenov <ki...@bitel.ru>.
LiuGuoMing wrote:
>Hi,ALL
>java.lang.OutOfMemoryError: Java heap space
>
>
>I'm currently using POI to generate some fairly large Excel files
>(30,000+ rows), using the org.apache.poi.hssf.usermodel package.
>
>it occur 'java.lang.OutOfMemoryError: Java heap space' when run it.
>
>
>
>Why?How to solve it?
>
>
>
I have already faced with that problem. And i haven’t found solution for
it. The trouble is in implementation of java language and poi . Big
excel file consists of great number of little structures and size plenty
of them is about 1 - 8 bytes. Poi creates java object for each
structure. Empty java object in sun implementation has size of 8 bytes.
An object with 1-byte field is aligned to 16 bytes, 4 - bytes to 16, 9
bytes to 24 and etc. This lead to that : poi reads a documents with size
of 45 Mb(about 3000 000 objects), but poi object has size of 700 Mb.
I have solved that problem for reading with using "poi event based api"
. I have read only data and placed it in lists. This decreased object's
size from 700 to 160.
But still i don't know solution for file generation. I even think that,
may be, poi developers can't help you.
---------------------------------------------------------------------
To unsubscribe, e-mail: poi-user-unsubscribe@jakarta.apache.org
Mailing List: http://jakarta.apache.org/site/mail2.html#poi
The Apache Jakarta Poi Project: http://jakarta.apache.org/poi/
java.lang.OutOfMemoryError: Java heap space
Posted by LiuGuoMing <gm...@sytdc.com>.
Hi,ALL
java.lang.OutOfMemoryError: Java heap space
I'm currently using POI to generate some fairly large Excel files
(30,000+ rows), using the org.apache.poi.hssf.usermodel package.
it occur 'java.lang.OutOfMemoryError: Java heap space' when run it.
strSQL = "select * from mydatabase";
QueryData qryData = dbcmd.selQuery(strSQL);
if (qryData.size() > 0) {
for (int i = 0;i < qryData.size();i++){
row=sheet.createRow((short)currRow);
cell = row.createCell((short)0);
cell.setCellValue(qryData.getRow(i).get("ID"));
cell = row.createCell((short)1);
cell.setCellValue(qryData.getRow(i).get("NAME"));
cell = row.createCell((short)2);
cell.setEncoding(HSSFCell.ENCODING_UTF_16);
cell.setCellValue(qryData.getRow(i).get("ADDRESS"));
cell = row.createCell((short)3);
cell.setCellValue(qryData.getRow(i).get("TEL"));
cell = row.createCell((short)4);
cell.setCellValue(qryData.getRow(i).get("ORDERBY"));
cell = row.createCell((short)5);
cell.setCellValue(qryData.getRow(i).get("LINKID"));
cell = row.createCell((short)6);
cell.setCellValue(qryData.getRow(i).get("CSTATUS"));
cell = row.createCell((short)7);
cell.setCellValue(qryData.getRow(i).get("NTATUS"));
cell = row.createCell((short)8);
cell.setCellValue(qryData.getRow(i).get("FLG"));
System.out.println(currRow);
currRow=currRow+1;
}
}
Why?How to solve it?
Thanks
Regards
---------------------------------------------------------------------
To unsubscribe, e-mail: poi-user-unsubscribe@jakarta.apache.org
Mailing List: http://jakarta.apache.org/site/mail2.html#poi
The Apache Jakarta Poi Project: http://jakarta.apache.org/poi/