Sorry to say that I have not had a lot of success because I could not locate 
the cloneStyleFrom() method that Nick referred to (I have posted a message here 
asking him to point me in the direction of the archive that holds it).

I suspect that once we have found this method, then there are a couple of 
simple changes that must be made to the copy code. The first is in the 
copyCell() method where I suspect this line;

        if( copyStyle ){
            newCell.setCellStyle(oldCell.getCellStyle());
        }

can simply be replaced with call to the cloneStyleFrom() method.

The other hurdle to overcome will be preventing our code from creating 
duplicate HSSFCellStyle objects. By this, I mean that it is common for cells 
that have the same format to share a single HSSFCellStyle object. We cannot 
create multiple objects if the cells share identical formatting but I suspect 
this should be relativly easy to avoid using some sort of mapping.

--- On Thu, 9/4/08, gliao <[EMAIL PROTECTED]> wrote:
From: gliao <[EMAIL PROTECTED]>
Subject: Re: merge worksheets from mutiple xls files
To: [email protected]
Date: Thursday, September 4, 2008, 6:03 AM

Thanks for your reply, Nick. Could you tell me the URL of the unit test code?


Nick Burch wrote:
> 
> On Wed, 3 Sep 2008, gliao wrote:
>> Thanks a lot. Is there any sample code about this?
> 
> Check the unit tests. It's a fairly new feature, so it's covered
by the 
> unit tests, but possibly not by stand-alone examples
> 
> Nick
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 
> 

-- 
View this message in context:
http://www.nabble.com/merge-worksheets-from-mutiple-xls-files-tp19168828p19308996.html
Sent from the POI - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




      

Reply via email to