I'm forwarding this to the new home of POI, Jakarta :-)

----- Original Message -----
From: "Rajiv R" <[EMAIL PROTECTED]>
To: "POI-Dev" <[EMAIL PROTECTED]>
Sent: Wednesday, February 06, 2002 4:13 AM
Subject: [Poi-devel] Adding exisitng sheets to a HSSFWorkbook.


> Hi !!! :)
>
> Me rajiv and just joined u alllllllll!!!!!
>
>   I was just trying the API from poi.sourceforge.net.
>
>   Say, I have 3 excel files(workbook) with 1 sheet
>  each. Now, I need to
>  combine them into 1 workbook with 3 sheets.
>
>   I thot I wud:
>   1. Create 3 HSSFWorkbook objects(say obj1,obj2,obj3)with the
>  inputstreams pointing to the 3
>  files.
>   2. Get the sheet from each of the 3 HSSFWorkbooks.
> 3. Create another HSSFWorkbook(Say obj4), and add above got
>  sheets into this new
> HSSFWoorkbook.
>   But I see no method in HSSFWorkbook which can take
> a HSSFSheet object!!
>
>   So what I did was this:
>
> public void addSheet(HSSFSheet mySheet)
>      {
>   sheets.add(mySheet);
>         workbook.setSheetName(sheets.size() - 1,"Sheet"
+(sheets.size() -
> 1));
>     }
>
> Added this method to HSSFWorkbook.
>
> Passed the 3 excel HSSFSheets objects (got from obj1,obj2,obj3) to
this
> method of obj4!!!!
>
> It worked but the generated excel file gives a Dr Watson Error or a
Memory
> Exception and shutsdown MS Excel itself!
>
> What do you have to say on this?
>
> We also tried this... We made the HSSFSheet constructor to public from
> protected (just for R and D), made a object of that in our class and
passed
> that to addSheet of HSSFWorkbook! it worked.. no errors/exception. The
excel
> file opened fine too!!!!
>
> Regards,
> Rajiv

**************************Disclaimer************************************
      


Information contained in this E-MAIL being proprietary to Wipro Limited
is 'privileged' and 'confidential' and intended for use only by the
individual or entity to which it is addressed. You are notified that any
use, copying or dissemination of the information contained in the E-MAIL
in any manner whatsoever is strictly prohibited.



 ********************************************************************

Reply via email to