Return-Path: Delivered-To: apmail-jakarta-poi-user-archive@www.apache.org Received: (qmail 61092 invoked from network); 4 Mar 2005 10:54:58 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur-2.apache.org with SMTP; 4 Mar 2005 10:54:58 -0000 Received: (qmail 55727 invoked by uid 500); 4 Mar 2005 10:54:56 -0000 Delivered-To: apmail-jakarta-poi-user-archive@jakarta.apache.org Received: (qmail 55693 invoked by uid 500); 4 Mar 2005 10:54:55 -0000 Mailing-List: contact poi-user-help@jakarta.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Subscribe: List-Help: List-Post: List-Id: "POI Users List" Reply-To: "POI Users List" Delivered-To: mailing list poi-user@jakarta.apache.org Received: (qmail 55666 invoked by uid 99); 4 Mar 2005 10:54:55 -0000 X-ASF-Spam-Status: No, hits=1.3 required=10.0 tests=DNS_FROM_RFC_ABUSE,FORGED_RCVD_HELO,FROM_ENDS_IN_NUMS,FROM_HAS_ULINE_NUMS X-Spam-Check-By: apache.org Received-SPF: pass (hermes.apache.org: local policy) Received: from sfovwl03.infy.com (HELO sfovwl03.infosys.com) (216.251.50.9) by apache.org (qpsmtpd/0.28) with ESMTP; Fri, 04 Mar 2005 02:54:53 -0800 Received: from indhubbhs01.ad.infosys.com ([192.168.200.81]) by sfovwl03.infosys.com with InterScan Messaging Security Suite; Fri, 04 Mar 2005 03:22:27 -0800 Received: from mngmsg03.ad.infosys.com ([192.168.32.25]) by indhubbhs01.ad.infosys.com with Microsoft SMTPSVC(5.0.2195.6713); Fri, 4 Mar 2005 16:24:31 +0530 X-MimeOLE: Produced By Microsoft Exchange V6.0.6487.1 content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="----_=_NextPart_001_01C520A8.8B6CDF7E" Subject: RE: Regarding HSSF Formatting issues Date: Fri, 4 Mar 2005 16:24:31 +0530 Message-ID: <63EE3A367BF7224FBF4F9152DD9EB26F012EF827@mngmsg03.ad.infosys.com> X-MS-Has-Attach: yes X-MS-TNEF-Correlator: Thread-Topic: Regarding HSSF Formatting issues Thread-Index: AcUgApWiTPN5lx1GSCyRIXPQJEHmpQAl/wHw From: "Suchitra Sundararajan" To: Cc: X-OriginalArrivalTime: 04 Mar 2005 10:54:31.0883 (UTC) FILETIME=[8B9CC9B0:01C520A8] X-Virus-Checked: Checked X-Spam-Rating: minotaur-2.apache.org 1.6.2 0/1000/N ------_=_NextPart_001_01C520A8.8B6CDF7E Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: quoted-printable Hi , Thanks Amol for the suggestions but I still require further help. Is there any other way other than increasing the JVM size, with respect to destroying the java objects and recreating them in say batches of 1000? I tried creating the File and Workbook objects inside the while loop and even though the file was created in append mode it had only one row, presumably the last row. Even when I am adding data in batches, without recreating the file and workbook objects that is, creating it outside the while loop, the object size keeps growing as, at no point are we destroying the object itself and every time I write the object it is actually overwriting the earlier file. Can you help me with this? I have attached the java file. The above code throws an out of memory exception. What I want is this. / Is there some way in which the object can be set to null and then created again and the file appended. I created the file in append mode but still no avail. / In case I increase the heap size how reliable is it? / What if I have applications having about 40-50 thousand rows. I mean there might be a case wherein even the max heap size might be exceeded? Can you please provide me info about these?=20 -----Original Message----- From: Amol Deshmukh [mailto:adeshmukh@hobsons-us.com]=20 Sent: Thursday, March 03, 2005 8:33 PM To: 'POI Users List' Subject: RE: Regarding HSSF Formatting issues try increasing JVM heap size (-Xmx 512 etc.) at startup. ~ amol > -----Original Message----- > From: Suchitra Sundararajan [mailto:Suchitra_S01@infosys.com] > Sent: Thursday, March 03, 2005 10:03 AM > To: POI Users List > Subject: RE: Regarding HSSF Formatting issues >=20 >=20 > Hi, > Further to the suggestions made by all of you, I no longer=20 > get the cell > style formatting issues. Thanks a lot!! > But then the Out of memory error persists , in my particular case when > the number of rows are 3998 and the columns are of the order of 60. I > checked out that quite a few people have reported such errors in some > of the mailing lists. Has a possible work around been got for=20 > this case? > Is this a bug in this utility? >=20 > Regards, > Suchitra >=20 > -----Original Message----- > From: Suchitra Sundararajan=20 > Sent: Thursday, March 03, 2005 8:14 PM > To: POI Users List > Subject: RE: Regarding HSSF Formatting issues >=20 > Hi, >=20 > Thanks a lot for the suggestions. I was earlier (before u guys mailed > out) creating a new cell style for every row. I changed this to create > one instance of the cell style and just keep the setCellStyle method > within the loop but I am still encountering the same problem. >=20 > I have attached the piece of code below. Kindly have a look at it and > tell me if I am missing out anything. >=20 > =20 >=20 > HSSFFont font=3Dhsf.createFont(); >=20 > HSSFCellStyle cellStyle=3D hsf.createCellStyle(); >=20 > font.setColor(HSSFFont.COLOR_NORMAL); >=20 > font.setItalic(false); >=20 > font.setFontName("Times New Roman"); >=20 > cellStyle.setFont(font); >=20 > cellStyle.setAlignment(cellStyle.ALIGN_JUSTIFY); >=20 > cellStyle.setWrapText(true); >=20 > =20 >=20 > while(rs.next()) >=20 > { >=20 > int iBatchCount=3D0; >=20 > =20 >=20 > HSSFRow row =3D = sheet.createRow((short)RowNum); >=20 > =20 >=20 > for(int i=3D1;i<=3Drsmd.getColumnCount();i++) >=20 > { >=20 > =20 >=20 > HSSFCell cell =3D > row.createCell((short)(i-1)); >=20 > cell.setCellStyle(cellStyle); >=20 > cell.setCellValue(rs.getString(i)); >=20 > } >=20 > RowNum++; >=20 > iBatchCount++; >=20 > System.out.println("Row num is " + RowNum); >=20 > if(iBatchCount=3D=3D1000) >=20 > { >=20 > hsf.write(fout); >=20 > iBatchCount=3D0; >=20 > =20 >=20 > } >=20 > } >=20 > hsf.write(fout); >=20 > =20 >=20 > Thanks and Regards, >=20 > Suchitra. >=20 > =20 >=20 > -----Original Message----- > From: Frans.Flippo@INGBank.com [mailto:Frans.Flippo@INGBank.com]=20 > Sent: Thursday, March 03, 2005 8:05 PM > To: poi-user@jakarta.apache.org > Subject: RE: Regarding HSSF Formatting issues >=20 > =20 >=20 > =20 >=20 > Are you creating a new HSSFStyle for each cell or using a=20 > single shared >=20 > style for all cells? >=20 > =20 >=20 > Regards, >=20 > Frans >=20 > =20 >=20 > =20 >=20 > > -----Original Message----- >=20 > > From: Suchitra Sundararajan [mailto:Suchitra_S01@infosys.com] >=20 > > Sent: Thursday, March 03, 2005 3:24 PM >=20 > > To: POI Users List >=20 > > Subject: Regarding HSSF Formatting issues >=20 > >=20 >=20 > >=20 >=20 > > Hi, >=20 > >=20 >=20 > > I have used the HSSF class to write the results of my select=20 >=20 > > query into >=20 > > an excel sheet. I noticed that even if there were just 2 columns and >=20 > > about 1000 rows, there are some formatting issues. My data=20 > is supposed >=20 > > to be in TimesNewRoman size 10 but beyond some rows, in this=20 >=20 > > case around >=20 > > 506 itself the format changes to Arial 10 and it reports Some text >=20 > > formatting might have changed because the maximum number of=20 > fonts has >=20 > > been exceeded. I have attached the screen shot of the=20 > error. The data >=20 > > seems to be fine but the format has changed >=20 > > Also once this error has been encountered, the next time i run the >=20 > > program without closing the java file (i was running it=20 > from Textpad) >=20 > > even if the selected rows are only 10 the same formatting=20 > error comes >=20 > > up. >=20 > > Also when the number of rows are very huge, about 10000 or=20 > so it gives >=20 > > me a run time exception of out of memory exception. I thought=20 >=20 > > initially >=20 > > this was because I was writing to the file at the end of=20 > all the rows. >=20 > > So I started writing for every row into the sheet but that made the >=20 > > whole process too slow. It was taking several minutes. So I started >=20 > > writing to the excel sheets in batches of 1000 but even=20 > that threw an >=20 > > Out of bound exception. Is this a reported bug in the feature? Am I >=20 > > missing out some very important thing here? Is there some=20 > clearing of >=20 > > the workbook object that I should do? >=20 > >=20 >=20 > > Thanks and Regards, >=20 > > Suchitra >=20 > >=20 >=20 > >=20 >=20 > >=20 > --------------------------------------------------------------------- >=20 > > To unsubscribe, e-mail: poi-user-unsubscribe@jakarta.apache.org >=20 > > Mailing List: http://jakarta.apache.org/site/mail2.html#poi >=20 > > The Apache Jakarta Poi Project: http://jakarta.apache.org/poi/ >=20 > >=20 >=20 > =20 >=20 > =20 >=20 > ----------------------------------------------------------------- >=20 > ATTENTION: >=20 > The information in this electronic mail message is private and >=20 > confidential, and only intended for the addressee. Should you >=20 > receive this message by mistake, you are hereby notified that >=20 > any disclosure, reproduction, distribution or use of this >=20 > message is strictly prohibited. Please inform the sender by >=20 > reply transmission and delete the message without copying or >=20 > opening it. >=20 > =20 >=20 > Messages and attachments are scanned for all viruses known. >=20 > If this message contains password-protected attachments, the >=20 > files have NOT been scanned for viruses by the ING mail domain. >=20 > Always scan attachments before opening them. >=20 > ----------------------------------------------------------------- >=20 > =20 >=20 >=20 >=20 > --------------------------------------------------------------------- > 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/ >=20 --------------------------------------------------------------------- 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/ ------_=_NextPart_001_01C520A8.8B6CDF7E Content-Type: text/plain; charset=us-ascii --------------------------------------------------------------------- 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/ ------_=_NextPart_001_01C520A8.8B6CDF7E--