Return-Path: Delivered-To: apmail-jakarta-poi-user-archive@www.apache.org Received: (qmail 46464 invoked from network); 19 Oct 2005 21:02:34 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 19 Oct 2005 21:02:34 -0000 Received: (qmail 64996 invoked by uid 500); 19 Oct 2005 21:02:32 -0000 Delivered-To: apmail-jakarta-poi-user-archive@jakarta.apache.org Received: (qmail 64965 invoked by uid 500); 19 Oct 2005 21:02:31 -0000 Mailing-List: contact poi-user-help@jakarta.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: 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 64954 invoked by uid 99); 19 Oct 2005 21:02:31 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 19 Oct 2005 14:02:31 -0700 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests= X-Spam-Check-By: apache.org Received-SPF: pass (asf.osuosl.org: local policy) Received: from [207.0.184.5] (HELO arnie1.collegeview.com) (207.0.184.5) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 19 Oct 2005 14:02:31 -0700 Received: by arnie.collegeview.com with Internet Mail Service (5.5.2658.27) id <4MRLKHNQ>; Wed, 19 Oct 2005 16:56:57 -0400 Message-ID: From: Amol Deshmukh To: 'POI Users List' Subject: RE: green icon in the cell Date: Wed, 19 Oct 2005 16:56:56 -0400 MIME-Version: 1.0 X-Mailer: Internet Mail Service (5.5.2658.27) Content-Type: text/plain; charset="iso-8859-1" X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N Murali, Setting the cell type will not help. Also, when you setCellValue(..) the cell type is set internally by hssf. You need some logic in your code that converts the field to the appropriate type before inserting it into excel. (You can infer the correct type based on whether the string parses to a number etc.) HTH, ~ amol > -----Original Message----- > From: Murali Krishna [mailto:murali_padavala@yahoo.com] > Sent: Wednesday, October 19, 2005 4:46 PM > To: POI Users List > Subject: RE: green icon in the cell > > > Hi Amol, > > I am getting the numeric as string from the database. when I > am getting the string dynamically, I dont know whether it > contains only numbers or characters. so I can declare that as int. > > I tried setting the cell type to all possible combinations > like (String, numeric, Formula, Error). but still getting the > same issue like before. > > > Thanks, > Murali > > > Amol Deshmukh wrote: > Murali, > > cell.setCellValue(123434343); > > shoudl work. It seems that you are using > a string when you seem to want to set a > numeric value (?) > > ~ amol > > > > > > -----Original Message----- > > From: Murali Krishna [mailto:murali_padavala@yahoo.com] > > Sent: Wednesday, October 19, 2005 1:16 PM > > To: POI Users List > > Subject: Re: green icon in the cell > > > > > > Hi Leen Toelen, > > > > Thanks for the response. I have tried that before and after > > seeing your mail, with all the possible combinations of > > String, numeric, formula, error and blank. Still its not > > resolving my problem. Below is my code. please do let me > > know, whether i am making any mistake. > > > > Thanks, > > Murali > > > > > > public class IntFormatting { > > public static void main(String ar[]){ > > > > HSSFWorkbook wb = new HSSFWorkbook(); > > HSSFSheet sheet = wb.createSheet("format sheet"); > > HSSFCellStyle style; > > HSSFDataFormat format = wb.createDataFormat(); > > HSSFRow row; > > HSSFCell cell; > > short rowNum = 0; > > short colNum = 0; > > row = sheet.createRow(rowNum++); > > cell = row.createCell(colNum++); > > String s="1234343"; > > > > cell.setCellType(HSSFCell.CELL_TYPE_STRING); > > cell.setCellValue(s); > > > > String file = "c:\\intformatting.xls"; > > try{ > > FileOutputStream fileOut = new FileOutputStream(file); > > wb.write(fileOut); > > fileOut.close(); > > } > > catch(IOException ioe){ > > ioe.printStackTrace(); > > } > > System.out.println("output written to file : " + file); > > } > > } > > > > Leen Toelen wrote: > > Hi, > > > > setCellType to the rescue: > > > > void setCellType(int cellType) > > set the cells type (numeric, formula or string) > > > > Regards, > > Leen Toelen > > > > On 10/19/05, Murali Krishna wrote: > > > Hi, > > > I am getting a small green icon in the cell when i insert a > > string which is numeric data in the excel cell. the exact > > message is "the number in this cell is formatted as text or > > preceded by an apostophe". > > > > > > is there anyway I can get rid of that. Below is the sample > > code that I wrote. > > > > > > Thanks, > > > Murali > > > > > > > > > public class IntFormatting { > > > public static void main(String ar[]){ > > > > > > HSSFWorkbook wb = new HSSFWorkbook(); > > > HSSFSheet sheet = wb.createSheet("format sheet"); > > > HSSFCellStyle style; > > > HSSFDataFormat format = wb.createDataFormat(); > > > HSSFRow row; > > > HSSFCell cell; > > > short rowNum = 0; > > > short colNum = 0; > > > > > > row = sheet.createRow(rowNum++); > > > cell = row.createCell(colNum++); > > > String s="1234343"; > > > > > > cell.setCellValue(s); > > > > > > String file = "c:\\intformatting.xls"; > > > try{ > > > FileOutputStream fileOut = new FileOutputStream(file); > > > wb.write(fileOut); > > > fileOut.close(); > > > } > > > catch(IOException ioe){ > > > ioe.printStackTrace(); > > > } > > > System.out.println("output written to file : " + file); > > > } > > > } > > > > > > > > > > > > --------------------------------- > > > Yahoo! Music Unlimited - Access over 1 million songs. Try it free. > > > > > > > > --------------------------------------------------------------------- > > 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/ > > > > > > > > --------------------------------- > > Yahoo! Music Unlimited - Access over 1 million songs. Try it free. > > > > --------------------------------------------------------------------- > 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/ > > > > --------------------------------- > Yahoo! Music Unlimited - Access over 1 million songs. Try it free. > --------------------------------------------------------------------- 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/