Return-Path: Delivered-To: apmail-jakarta-poi-user-archive@www.apache.org Received: (qmail 86670 invoked from network); 1 Sep 2005 09:45:48 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 1 Sep 2005 09:45:48 -0000 Received: (qmail 15126 invoked by uid 500); 1 Sep 2005 09:45:45 -0000 Delivered-To: apmail-jakarta-poi-user-archive@jakarta.apache.org Received: (qmail 15107 invoked by uid 500); 1 Sep 2005 09:45:45 -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 15094 invoked by uid 99); 1 Sep 2005 09:45:45 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 01 Sep 2005 02:45:45 -0700 X-ASF-Spam-Status: No, hits=0.2 required=10.0 tests=NO_REAL_NAME,SPF_HELO_PASS,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (asf.osuosl.org: domain of dozean@gmx.de designates 213.165.64.20 as permitted sender) Received: from [213.165.64.20] (HELO mail.gmx.net) (213.165.64.20) by apache.org (qpsmtpd/0.29) with SMTP; Thu, 01 Sep 2005 02:45:59 -0700 Received: (qmail 2590 invoked by uid 0); 1 Sep 2005 09:45:42 -0000 Received: from 80.136.135.28 by www58.gmx.net with HTTP; Thu, 1 Sep 2005 11:45:42 +0200 (MEST) Date: Thu, 1 Sep 2005 11:45:42 +0200 (MEST) From: dozean@gmx.de To: "POI Users List" MIME-Version: 1.0 References: <4316B6DE.20505@hrs.de> Subject: =?ISO-8859-1?Q?Re:_HSSFCell_returns_numeric_value_instaed_of_String?= X-Priority: 3 (Normal) X-Authenticated: #9227561 Message-ID: <27221.1125567942@www58.gmx.net> X-Mailer: WWW-Mail 1.6 (Global Message Exchange) X-Flags: 0001 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 8bit X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N Hi Digo, my code is nearly like yours, if (typ == HSSFCell.CELL_TYPE_NUMERIC) content.append(cell.getNumericCellValue() + " "); if (typ == HSSFCell.CELL_TYPE_STRING) content.append(cell.getStringCellValue() + " "); and i try to reconstruct the situation you have!! 7.36132469E8 this form you get because the cell is formated in this way! And HSSFCell take this in the format, how it is in the exel file! But i have a question about the cell numeration!! I do the numeration that way: for (int sheetNr = 0; sheetNr < workbook.getNumberOfSheets(); sheetNr++) { for (int rowNr = sheet.getFirstRowNum(); rowNr <= sheet.getLastRowNum(); rowNr++) { the Problem is that it miss out rows which first cell is empty!!! Have anybody an idea? Also i get an NullPointerException!!! Bye Derya > --- Urspr�ngliche Nachricht --- > Von: Digo Chakraverty > An: POI Users List > Betreff: HSSFCell returns numeric value instaed of String > Datum: Thu, 01 Sep 2005 10:07:58 +0200 > > Hi all, > > when I try to retrieve the values from some cells, > the returned format confuses me. Maybe you can help. > > 1. In Excel, I formatted all cells as Strings. > 2. In the code it looks like this: > > private String convertToString(HSSFCell cell) { > String ret = ""; > > if (cell != null) > { > int type = cell.getCellType(); > switch (type) > { > case HSSFCell.CELL_TYPE_BLANK: > case HSSFCell.CELL_TYPE_BOOLEAN: > case HSSFCell.CELL_TYPE_ERROR: > case HSSFCell.CELL_TYPE_FORMULA: > break; > case HSSFCell.CELL_TYPE_NUMERIC: > ret = Double.toString(cell.getNumericCellValue()); > System.out.println("number: " + ret); > break; > case HSSFCell.CELL_TYPE_STRING: > ret = cell.getStringCellValue(); > System.out.println("String: " + ret); > break; > } > } > > return ret; > } > > > 3. With Strings, erverything is ok. Values consisting of numbers > appear as numbers (although I had formatted them as Strings in Excel). > 4.Furthermore, A number like 736132469 is displayed as 7.36132469E8 > > Any suggestions? > > > Thank you very much. > > Regards, Digo > > > --------------------------------------------------------------------- > 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/ > -- 5 GB Mailbox, 50 FreeSMS http://www.gmx.net/de/go/promail +++ GMX - die erste Adresse f�r Mail, Message, More +++ --------------------------------------------------------------------- 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/