poi-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Hamza Abdelkebir <hamza.abdelke...@gmail.com>
Subject Re: Removing sheets from workbook (poi 3.8)
Date Tue, 28 Jun 2011 14:43:15 GMT
Hi,
I think my problem is that the sheets that I'm trying to remove all start
with "Rack" and as other sheets that don't need to be removed start the same
way the XLS file gets messed up.

I don't know how to fix this.

Hamza


On Fri, Jun 24, 2011 at 8:16 PM, Jon Svede <jsvede@yahoo.com> wrote:

> If I create a workbook in Excel and open it in POI 3.8 BETA 3 and use your
> method, it works.
>
> Is there any more info you can provide?
>
> Jon
>
>
> ------------------------------
> *From:* Hamza Abdelkebir <hamza.abdelkebir@gmail.com>
> *To:* Jon Svede <jsvede@yahoo.com>
> *Cc:* POI Users List <user@poi.apache.org>
> *Sent:* Fri, June 24, 2011 8:52:37 AM
> *Subject:* Re: Removing sheets from workbook (poi 3.8)
>
> Yes, I'm using a workbook which represents an existing xls file.
>
> Hamza
>
>
> On Fri, Jun 24, 2011 at 4:50 PM, Jon Svede <jsvede@yahoo.com> wrote:
>
> > How is the workbook being created?  Is the workbook representing an
> > existing file or are you creating?
> >
> > Jon
> >
> >
> >
> > ------------------------------
> > *From:* Hamza Abdelkebir <hamza.abdelkebir@gmail.com>
> > *To:* POI Users List <user@poi.apache.org>
> > *Sent:* Fri, June 24, 2011 1:54:45 AM
> > *Subject:* Removing sheets from workbook (poi 3.8)
> >
> > Hi all,
> >
> > I'm having this exception when trying to remove the last 4 sheets from a
> > workbook :
> >
> > Exception in thread "main" java.lang.IllegalArgumentException: calculated
> > end index (484283) is out of allowable range (484279..484282)
> > at
> >
> >
> org.apache.poi.util.LittleEndianByteArrayOutputStream.<init>(LittleEndianByteArrayOutputStream.java:41)
> > at
> >
> org.apache.poi.hssf.record.StandardRecord.serialize(StandardRecord.java:38)
> > at
> >
> >
> org.apache.poi.hssf.usermodel.HSSFWorkbook$SheetRecordCollector.serialize(HSSFWorkbook.java:1246)
> > at
> >
> org.apache.poi.hssf.usermodel.HSSFWorkbook.getBytes(HSSFWorkbook.java:1292)
> > at
> org.apache.poi.hssf.usermodel.HSSFWorkbook.write(HSSFWorkbook.java:1191)
> > at pb.odm.ODM.saveData(ODM.java:1212)
> > at pb.odm.ODM.buildODM(ODM.java:195)
> > at pb.odm.ODM.run(ODM.java:1222)
> > at pb.odm.Main.main(Main.java:11)
> >
> >
> > Using this method :
> >
> > private void removeExtraSheets(){
> > int i=0;
> >        while(i<3){
> >            destwb.removeSheetAt(destwb.getNumberOfSheets()-1);
> >    i++;
> >        }
> > }
> >
> > Any ideas ?
> >
> > Thanks,
> > Hamza
> >
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message