Return-Path: Delivered-To: apmail-poi-user-archive@www.apache.org Received: (qmail 95570 invoked from network); 25 Jan 2010 12:54:11 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 25 Jan 2010 12:54:11 -0000 Received: (qmail 81180 invoked by uid 500); 25 Jan 2010 12:54:11 -0000 Delivered-To: apmail-poi-user-archive@poi.apache.org Received: (qmail 81124 invoked by uid 500); 25 Jan 2010 12:54:11 -0000 Mailing-List: contact user-help@poi.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: "POI Users List" Delivered-To: mailing list user@poi.apache.org Received: (qmail 81114 invoked by uid 99); 25 Jan 2010 12:54:10 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 25 Jan 2010 12:54:10 +0000 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of mathaiaju@gmail.com designates 209.85.220.220 as permitted sender) Received: from [209.85.220.220] (HELO mail-fx0-f220.google.com) (209.85.220.220) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 25 Jan 2010 12:54:01 +0000 Received: by fxm20 with SMTP id 20so3522749fxm.1 for ; Mon, 25 Jan 2010 04:53:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:content-type :content-transfer-encoding; bh=85cbRCShZWiCZyNaPmR+LmlDkZdKtAEF8XuOI+7lzws=; b=wFQeSiCxqdtlx35aB0xasUGNsJN0Ec7wZ+DnhJdwm/V/yN8SULFnML3ewgj4hF65iG y+o7MFGnqsgbtdkvhdKNf+7jl8eb9MrcNWbmrF2O1AgWvEW1Qkos+caxDM3EqU78z9Zw 8vkHuokrjO5S5zQn1G5Q+Cnq+8Q8GoN3j8Ie4= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type:content-transfer-encoding; b=Tipk36ZIc1FshM2YwuGoVhnedkxATAt8P/RcaMPNfKZp6aNuZxl7iwl+XqLVnexK+F X6Qckz6KgBo1AKTzaTnWwamS+ebe/aopiZbHONzaiTARqM/LJ0kIMZA1rigEY1347Sju 8oz0VL1iCNIvEVi0y91dHfJtjaUIYd38Hf6mM= MIME-Version: 1.0 Received: by 10.239.153.12 with SMTP id x12mr688238hbb.154.1264424021047; Mon, 25 Jan 2010 04:53:41 -0800 (PST) In-Reply-To: <27269628.post@talk.nabble.com> References: <42184d2d1001210116l2769be81x76f9b770d5d82ec4@mail.gmail.com> <27269628.post@talk.nabble.com> Date: Mon, 25 Jan 2010 18:23:40 +0530 Message-ID: <42184d2d1001250453s17295eb6k7fe76de5b0eefaf1@mail.gmail.com> Subject: Re: Problem reading XLS files From: Aju Mathai To: POI Users List Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Virus-Checked: Checked by ClamAV on apache.org Hi Mark, > > The file is generated automatically without any user intervention. How > do i find out whether the excel file has been modified in the ways you > talk about ? . The POI version that i am using is 3.5_beta3. > > Thanks & Regards, > mathaj On Fri, Jan 22, 2010 at 1:12 PM, MSB wrote: > > Excel can behave quite oddly at times and it will create a record for a c= ell > if it has been 'touched' in any way by the user during creation of the fi= le. > By this, I mean that if the user entered a value into a cell and then > cleared that out or if they set a format and then removied it, Excel will > recognise that something was done to the cell and will create a record fo= r > it in the file. Without seeing the actual file/files you are working with= I > cannot comment much further but do suspect that this may have been the ca= se; > either the user or the application that created the file left a few of th= ese > artifacts around. I do not expect that this is a problem with POI but to = be > certain, can you post one of the files that is exhibiting this sort of > behaviour so that we could take a closer look at it please? Further, can = you > say which version of the API you are using and how the Excel file is > generated - by someone using Excel or by another application - please? > > Yours > > Mark B > > > > Aju Mathai wrote: >> >> Hi, >> >> I am using the following POI libraries to read in the files with .xls >> and .xlsx files. I found a strange problem ,the celliterator.hasNext() >> sometimes gives true even if the next column in my xls file seems to >> be blank, i have no additional columns. How do i take care of such >> blank cells ? >> >> Here is my code snippet >> >> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 for(Iterator ri =3D row.ce= llIterator(); >> ri.hasNext();) =A0{ >> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 Cell cell =3D ri.next(); >> >> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 switch(cell.= getCellType()){ >> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 case Cell.CE= LL_TYPE_STRING: >> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 = =A0 text.append(cell.getRichStringCellValue().getString().trim()); >> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 = =A0 break; >> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 case Cell.CE= LL_TYPE_NUMERIC: >> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 = =A0 text.append(cell.getNumericCellValue()); >> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 = =A0 break; >> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 case Cell.CE= LL_TYPE_BOOLEAN: >> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 = =A0 text.append(cell.getBooleanCellValue()); >> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 = =A0 break; >> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 case Cell.CE= LL_TYPE_FORMULA: >> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 = =A0 text.append(cell.getCellFormula()); >> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 = =A0 break; >> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 case Cell.CE= LL_TYPE_BLANK: >> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 = =A0 break; >> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 default: >> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 = =A0 text.append(""); >> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 } >> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 // Column De= limiter >> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 if(ri.hasNex= t() && =A0!(cell.getCellType() =3D=3D Cell.CELL_TYPE_BLANK)) >> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 = =A0 text.append(COLUMN_DELIMITER); >> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 } >> >> >> Thanks >> mathaj >> >> --------------------------------------------------------------------- >> To unsubscribe, e-mail: user-unsubscribe@poi.apache.org >> For additional commands, e-mail: user-help@poi.apache.org >> >> >> > > -- > View this message in context: http://old.nabble.com/Problem-reading-XLS-f= iles-tp27254834p27269628.html > Sent from the POI - User mailing list archive at Nabble.com. > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: user-unsubscribe@poi.apache.org > For additional commands, e-mail: user-help@poi.apache.org > > --------------------------------------------------------------------- To unsubscribe, e-mail: user-unsubscribe@poi.apache.org For additional commands, e-mail: user-help@poi.apache.org