You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@poi.apache.org by gliao <gl...@gmail.com> on 2008/08/26 21:35:44 UTC

merge worksheets from mutiple xls files

I want to merge worksheets from multiple xls files into a single workbook
with all those sheets. I can't find POI API to implement that. Any
suggestion? Thanks.
-- 
View this message in context: http://www.nabble.com/merge-worksheets-from-mutiple-xls-files-tp19168828p19168828.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


Re: merge worksheets from mutiple xls files

Posted by Anthony Andrews <py...@yahoo.com>.
No problem, enjoy problems like this one. Will have a look later today and post something out (hopefully) this evening.

--- On Thu, 9/4/08, gliao <gl...@gmail.com> wrote:
From: gliao <gl...@gmail.com>
Subject: Re: merge worksheets from mutiple xls files
To: user@poi.apache.org
Date: Thursday, September 4, 2008, 12:20 AM


I am still using the copy sheet code you provided. I appreciate your help.


 

Anthony Andrews wrote:
> 
> Are you still using that same basic piece of code to copy the sheets
> between workbooks? If so I will take a look today and see how to modify
> that to use the cloneStyle() method.
> 
> --- On Wed, 9/3/08, gliao <gl...@gmail.com> wrote:
> From: gliao <gl...@gmail.com>
> Subject: Re: merge worksheets from mutiple xls files
> To: user@poi.apache.org
> Date: Wednesday, September 3, 2008, 10:12 AM
> 
> Hi Nick,
> 
> Thanks a lot. Is there any sample code about this?
> 
> George
> 
> Nick Burch wrote:
>> 
>> On Fri, 29 Aug 2008, gliao wrote:
>>> Does the style including font and color? If it does, why it
doen't
> copy 
>>> font and color, even the code already set copyStyle boolean as
true?
> Any 
>>> idea.
>> 
>> Styles are specific to just one workbook. I think you'll be
wanting
> this:
>> 
>>
>
http://poi.apache.org/apidocs/org/apache/poi/hssf/usermodel/HSSFCellStyle.html#cloneStyleFrom(org.apache.poi.hssf.usermodel.HSSFCellStyle)
>> 
>> "Clones all the style information from another HSSFCellStyle,
onto
> this 
>> one. This HSSFCellStyle will then have all the same properties as the 
>> source, but the two may be edited independently. Any stylings on this 
>> HSSFCellStyle will be lost! The source HSSFCellStyle could be from
>> another
> 
>> HSSFWorkbook if you like. This allows you to copy styles from one 
>> HSSFWorkbook to another."
>> 
>> Nick
>> 
>> ---------------------------------------------------------------------
>> 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://www.nabble.com/merge-worksheets-from-mutiple-xls-files-tp19168828p19293663.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
> 
> 
> 
> 
>       
> 

-- 
View this message in context:
http://www.nabble.com/merge-worksheets-from-mutiple-xls-files-tp19168828p19304763.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




      

Re: merge worksheets from mutiple xls files

Posted by gliao <gl...@gmail.com>.

I am still using the copy sheet code you provided. I appreciate your help.


 

Anthony Andrews wrote:
> 
> Are you still using that same basic piece of code to copy the sheets
> between workbooks? If so I will take a look today and see how to modify
> that to use the cloneStyle() method.
> 
> --- On Wed, 9/3/08, gliao <gl...@gmail.com> wrote:
> From: gliao <gl...@gmail.com>
> Subject: Re: merge worksheets from mutiple xls files
> To: user@poi.apache.org
> Date: Wednesday, September 3, 2008, 10:12 AM
> 
> Hi Nick,
> 
> Thanks a lot. Is there any sample code about this?
> 
> George
> 
> Nick Burch wrote:
>> 
>> On Fri, 29 Aug 2008, gliao wrote:
>>> Does the style including font and color? If it does, why it doen't
> copy 
>>> font and color, even the code already set copyStyle boolean as true?
> Any 
>>> idea.
>> 
>> Styles are specific to just one workbook. I think you'll be wanting
> this:
>> 
>>
> http://poi.apache.org/apidocs/org/apache/poi/hssf/usermodel/HSSFCellStyle.html#cloneStyleFrom(org.apache.poi.hssf.usermodel.HSSFCellStyle)
>> 
>> "Clones all the style information from another HSSFCellStyle, onto
> this 
>> one. This HSSFCellStyle will then have all the same properties as the 
>> source, but the two may be edited independently. Any stylings on this 
>> HSSFCellStyle will be lost! The source HSSFCellStyle could be from
>> another
> 
>> HSSFWorkbook if you like. This allows you to copy styles from one 
>> HSSFWorkbook to another."
>> 
>> Nick
>> 
>> ---------------------------------------------------------------------
>> 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://www.nabble.com/merge-worksheets-from-mutiple-xls-files-tp19168828p19293663.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
> 
> 
> 
> 
>       
> 

-- 
View this message in context: http://www.nabble.com/merge-worksheets-from-mutiple-xls-files-tp19168828p19304763.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


Re: merge worksheets from mutiple xls files

Posted by Anthony Andrews <py...@yahoo.com>.
Are you still using that same basic piece of code to copy the sheets between workbooks? If so I will take a look today and see how to modify that to use the cloneStyle() method.

--- On Wed, 9/3/08, gliao <gl...@gmail.com> wrote:
From: gliao <gl...@gmail.com>
Subject: Re: merge worksheets from mutiple xls files
To: user@poi.apache.org
Date: Wednesday, September 3, 2008, 10:12 AM

Hi Nick,

Thanks a lot. Is there any sample code about this?

George

Nick Burch wrote:
> 
> On Fri, 29 Aug 2008, gliao wrote:
>> Does the style including font and color? If it does, why it doen't
copy 
>> font and color, even the code already set copyStyle boolean as true?
Any 
>> idea.
> 
> Styles are specific to just one workbook. I think you'll be wanting
this:
> 
>
http://poi.apache.org/apidocs/org/apache/poi/hssf/usermodel/HSSFCellStyle.html#cloneStyleFrom(org.apache.poi.hssf.usermodel.HSSFCellStyle)
> 
> "Clones all the style information from another HSSFCellStyle, onto
this 
> one. This HSSFCellStyle will then have all the same properties as the 
> source, but the two may be edited independently. Any stylings on this 
> HSSFCellStyle will be lost! The source HSSFCellStyle could be from another

> HSSFWorkbook if you like. This allows you to copy styles from one 
> HSSFWorkbook to another."
> 
> Nick
> 
> ---------------------------------------------------------------------
> 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://www.nabble.com/merge-worksheets-from-mutiple-xls-files-tp19168828p19293663.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




      

Re: merge worksheets from mutiple xls files - where is clone method please?

Posted by "Kyle.Bober" <ky...@gmail.com>.
Has there been any updates or an easier more clean solution for copying a
worksheet from one workbook to another?

Any new information regarding how to do this appropriately would be much
appreciated. 

-Kyle




Anthony Andrews wrote:
> 
> Thanks Nick. I managed to find it in an archive from the nightly build
> section as you recommended to another poster (sorry to ask a question that
> someone already had by the way). Also, glad to say that it seems to work -
> at least in the quick and dirty bit of test code I put together.
> 
> --- On Thu, 9/4/08, Nick Burch <ni...@torchbox.com> wrote:
> From: Nick Burch <ni...@torchbox.com>
> Subject: Re: merge worksheets from mutiple xls files - where is clone
> method please?
> To: "POI Users List" <us...@poi.apache.org>, pythonaddict@yahoo.com
> Date: Thursday, September 4, 2008, 9:53 AM
> 
> On Thu, 4 Sep 2008, Anthony Andrews wrote:
>> Can you tell me please which version the HSSFCellStyle.cloneStyleFrom() 
>> method can be found within? I have downloaded 3.5 beta1 from the 
>> development section and cannot find the method there.
> 
> You'll want a recent-ish svn checkout, or the next beta from 3.1 or 3.5 
> when they come out
> 
> Nick
> 
> ---------------------------------------------------------------------
> 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://www.nabble.com/merge-worksheets-from-mutiple-xls-files-tp19168828p24592225.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


Re: merge worksheets from mutiple xls files - where is clone method please?

Posted by Anthony Andrews <py...@yahoo.com>.
Thanks Nick. I managed to find it in an archive from the nightly build section as you recommended to another poster (sorry to ask a question that someone already had by the way). Also, glad to say that it seems to work - at least in the quick and dirty bit of test code I put together.

--- On Thu, 9/4/08, Nick Burch <ni...@torchbox.com> wrote:
From: Nick Burch <ni...@torchbox.com>
Subject: Re: merge worksheets from mutiple xls files - where is clone method please?
To: "POI Users List" <us...@poi.apache.org>, pythonaddict@yahoo.com
Date: Thursday, September 4, 2008, 9:53 AM

On Thu, 4 Sep 2008, Anthony Andrews wrote:
> Can you tell me please which version the HSSFCellStyle.cloneStyleFrom() 
> method can be found within? I have downloaded 3.5 beta1 from the 
> development section and cannot find the method there.

You'll want a recent-ish svn checkout, or the next beta from 3.1 or 3.5 
when they come out

Nick

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
For additional commands, e-mail: user-help@poi.apache.org




      

Re: merge worksheets from mutiple xls files - where is clone method please?

Posted by Nick Burch <ni...@torchbox.com>.
On Thu, 4 Sep 2008, Anthony Andrews wrote:
> Can you tell me please which version the HSSFCellStyle.cloneStyleFrom() 
> method can be found within? I have downloaded 3.5 beta1 from the 
> development section and cannot find the method there.

You'll want a recent-ish svn checkout, or the next beta from 3.1 or 3.5 
when they come out

Nick

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
For additional commands, e-mail: user-help@poi.apache.org


Re: merge worksheets from mutiple xls files - where is clone method please?

Posted by Anthony Andrews <py...@yahoo.com>.
Nick

Can you tell me please which version the HSSFCellStyle.cloneStyleFrom() method can be found within? I have downloaded 3.5 beta1 from the development section and cannot find the method there.

--- On Thu, 9/4/08, Nick Burch <ni...@torchbox.com> wrote:
From: Nick Burch <ni...@torchbox.com>
Subject: Re: merge worksheets from mutiple xls files
To: "POI Users List" <us...@poi.apache.org>
Date: Thursday, September 4, 2008, 2:29 AM

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: user-unsubscribe@poi.apache.org
For additional commands, e-mail: user-help@poi.apache.org




      

Re: merge worksheets from mutiple xls files

Posted by Anthony Andrews <py...@yahoo.com>.
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 <gl...@gmail.com> wrote:
From: gliao <gl...@gmail.com>
Subject: Re: merge worksheets from mutiple xls files
To: user@poi.apache.org
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: user-unsubscribe@poi.apache.org
> For additional commands, e-mail: user-help@poi.apache.org
> 
> 
> 

-- 
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: user-unsubscribe@poi.apache.org
For additional commands, e-mail: user-help@poi.apache.org




      

Re: merge worksheets from mutiple xls files

Posted by Nick Burch <ni...@torchbox.com>.
On Thu, 4 Sep 2008, gliao wrote:
> Thanks for your reply, Nick. Could you tell me the URL of the unit test 
> code?

http://svn.apache.org/repos/asf/poi/trunk/src/testcases/org/apache/poi/hssf/usermodel/TestCellStyle.java

Nick

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
For additional commands, e-mail: user-help@poi.apache.org


Re: merge worksheets from mutiple xls files

Posted by gliao <gl...@gmail.com>.
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: user-unsubscribe@poi.apache.org
> For additional commands, e-mail: user-help@poi.apache.org
> 
> 
> 

-- 
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: user-unsubscribe@poi.apache.org
For additional commands, e-mail: user-help@poi.apache.org


Re: merge worksheets from mutiple xls files

Posted by Nick Burch <ni...@torchbox.com>.
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: user-unsubscribe@poi.apache.org
For additional commands, e-mail: user-help@poi.apache.org


Re: merge worksheets from mutiple xls files

Posted by gliao <gl...@gmail.com>.
Hi Nick,

Thanks a lot. Is there any sample code about this?

George

Nick Burch wrote:
> 
> On Fri, 29 Aug 2008, gliao wrote:
>> Does the style including font and color? If it does, why it doen't copy 
>> font and color, even the code already set copyStyle boolean as true? Any 
>> idea.
> 
> Styles are specific to just one workbook. I think you'll be wanting this:
> 
> http://poi.apache.org/apidocs/org/apache/poi/hssf/usermodel/HSSFCellStyle.html#cloneStyleFrom(org.apache.poi.hssf.usermodel.HSSFCellStyle)
> 
> "Clones all the style information from another HSSFCellStyle, onto this 
> one. This HSSFCellStyle will then have all the same properties as the 
> source, but the two may be edited independently. Any stylings on this 
> HSSFCellStyle will be lost! The source HSSFCellStyle could be from another 
> HSSFWorkbook if you like. This allows you to copy styles from one 
> HSSFWorkbook to another."
> 
> Nick
> 
> ---------------------------------------------------------------------
> 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://www.nabble.com/merge-worksheets-from-mutiple-xls-files-tp19168828p19293663.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


Re: merge worksheets from mutiple xls files

Posted by Nick Burch <ni...@torchbox.com>.
On Fri, 29 Aug 2008, gliao wrote:
> Does the style including font and color? If it does, why it doen't copy 
> font and color, even the code already set copyStyle boolean as true? Any 
> idea.

Styles are specific to just one workbook. I think you'll be wanting this:

http://poi.apache.org/apidocs/org/apache/poi/hssf/usermodel/HSSFCellStyle.html#cloneStyleFrom(org.apache.poi.hssf.usermodel.HSSFCellStyle)

"Clones all the style information from another HSSFCellStyle, onto this 
one. This HSSFCellStyle will then have all the same properties as the 
source, but the two may be edited independently. Any stylings on this 
HSSFCellStyle will be lost! The source HSSFCellStyle could be from another 
HSSFWorkbook if you like. This allows you to copy styles from one 
HSSFWorkbook to another."

Nick

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
For additional commands, e-mail: user-help@poi.apache.org


Re: merge worksheets from mutiple xls files

Posted by gliao <gl...@gmail.com>.
Hi Anthony ,

Thanks for your suggestion. I check the code about copyCell. It copy the
style:


public static void copyCell(HSSFCell oldCell, HSSFCell newCell,
			boolean copyStyle) {
		if (copyStyle) {
			newCell.setCellStyle(oldCell.getCellStyle());
		}


It invokes copyCell as:
copyCell(oldCell, newCell, true);

Does the style including font and color? If it does, why it doen't copy font
and color, even the code already set copyStyle boolean as true? Any idea.

George







Anthony Andrews wrote:
> 
> Thjat is good news, thanks for letting me know because I remembr following
> the original discussion and was never sure how everything was resolved.
> 
> The Font and colour info are both a part of the cells style. I have not
> had the chance to look at the code but I would guess that if you looked
> for the part where it copies the style - assuming it does of course - 
> then the change could be put in there. The only problem you may need to
> bear in mind when copying styles is that Excel imposes a maximum number of
> cell styles.
> 
> --- On Wed, 8/27/08, gliao <gl...@gmail.com> wrote:
> From: gliao <gl...@gmail.com>
> Subject: Re: merge worksheets from mutiple xls files
> To: user@poi.apache.org
> Date: Wednesday, August 27, 2008, 7:57 AM
> 
> Hi Anthony and Suyash,
> 
> Thanks a lot for your reply. 
> 
> Anthony, the code you provided can copy sheet. The only issue is it
> doesn't
> copy the font and color information of the original sheet, it only copy
> the
> content.
> 
> Regards,
> 
> George 
> 
> 
> 
> 
> Anthony Andrews wrote:
>> 
>> I have searched the archive and found this;
>> 
>>
> http://jxls.cvs.sourceforge.net/jxls/jxls/src/java/org/jxls/util/Util.java?view=markup
>> 
>> Do not know if it is exactly what you require and I have not tested it my
>> self but it may be worth a look.
>> 
>> Otherwise, as another poster has suggested, you will have to code your
>> own
>> method that copies across the cells one by one from one sheet to another.
>> 
>> --- On Tue, 8/26/08, Suyash Jape <su...@tcs.com> wrote:
>> From: Suyash Jape <su...@tcs.com>
>> Subject: Re: merge worksheets from mutiple xls files
>> To: "POI Users List" <us...@poi.apache.org>
>> Date: Tuesday, August 26, 2008, 8:41 PM
>> 
>> As far as i have searched, you may have to copy the cells row wise for 
>> each sheet into the target workbook.
>> There doesnt seem to be a copy sheet function for the workbook.
>> 
>> Regards
>> Suyash 
>> 
>> 
>> 
>> gliao <gl...@gmail.com> 
>> 27-08-2008 01:05
>> Please respond to
>> "POI Users List" <us...@poi.apache.org>
>> 
>> 
>> To
>> user@poi.apache.org
>> cc
>> 
>> Subject
>> merge worksheets from mutiple xls files
>> 
>> 
>> 
>> 
>> 
>> 
>> 
>> I want to merge worksheets from multiple xls files into a single workbook
>> with all those sheets. I can't find POI API to implement that. Any
>> suggestion? Thanks.
>> -- 
>> View this message in context: 
>>
> http://www.nabble.com/merge-worksheets-from-mutiple-xls-files-tp19168828p19168828.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
>> 
>> 
>> ForwardSourceID:NT0000691E 
>> =====-----=====-----=====
>> Notice: The information contained in this e-mail
>> message and/or attachments to it may contain 
>> confidential or privileged information. If you are 
>> not the intended recipient, any dissemination, use, 
>> review, distribution, printing or copying of the 
>> information contained in this e-mail message 
>> and/or attachments to it are strictly prohibited. If 
>> you have received this communication in error, 
>> please notify us by reply e-mail or telephone and 
>> immediately and permanently delete the message 
>> and any attachments. Thank you
>> 
>> 
>> 
>> 
>> 
>>       
>> 
> 
> -- 
> View this message in context:
> http://www.nabble.com/merge-worksheets-from-mutiple-xls-files-tp19168828p19182802.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
> 
> 
> 
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/merge-worksheets-from-mutiple-xls-files-tp19168828p19222497.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


Re: merge worksheets from mutiple xls files

Posted by Anthony Andrews <py...@yahoo.com>.
Thjat is good news, thanks for letting me know because I remembr following the original discussion and was never sure how everything was resolved.

The Font and colour info are both a part of the cells style. I have not had the chance to look at the code but I would guess that if you looked for the part where it copies the style - assuming it does of course -  then the change could be put in there. The only problem you may need to bear in mind when copying styles is that Excel imposes a maximum number of cell styles.

--- On Wed, 8/27/08, gliao <gl...@gmail.com> wrote:
From: gliao <gl...@gmail.com>
Subject: Re: merge worksheets from mutiple xls files
To: user@poi.apache.org
Date: Wednesday, August 27, 2008, 7:57 AM

Hi Anthony and Suyash,

Thanks a lot for your reply. 

Anthony, the code you provided can copy sheet. The only issue is it doesn't
copy the font and color information of the original sheet, it only copy the
content.

Regards,

George 




Anthony Andrews wrote:
> 
> I have searched the archive and found this;
> 
>
http://jxls.cvs.sourceforge.net/jxls/jxls/src/java/org/jxls/util/Util.java?view=markup
> 
> Do not know if it is exactly what you require and I have not tested it my
> self but it may be worth a look.
> 
> Otherwise, as another poster has suggested, you will have to code your own
> method that copies across the cells one by one from one sheet to another.
> 
> --- On Tue, 8/26/08, Suyash Jape <su...@tcs.com> wrote:
> From: Suyash Jape <su...@tcs.com>
> Subject: Re: merge worksheets from mutiple xls files
> To: "POI Users List" <us...@poi.apache.org>
> Date: Tuesday, August 26, 2008, 8:41 PM
> 
> As far as i have searched, you may have to copy the cells row wise for 
> each sheet into the target workbook.
> There doesnt seem to be a copy sheet function for the workbook.
> 
> Regards
> Suyash 
> 
> 
> 
> gliao <gl...@gmail.com> 
> 27-08-2008 01:05
> Please respond to
> "POI Users List" <us...@poi.apache.org>
> 
> 
> To
> user@poi.apache.org
> cc
> 
> Subject
> merge worksheets from mutiple xls files
> 
> 
> 
> 
> 
> 
> 
> I want to merge worksheets from multiple xls files into a single workbook
> with all those sheets. I can't find POI API to implement that. Any
> suggestion? Thanks.
> -- 
> View this message in context: 
>
http://www.nabble.com/merge-worksheets-from-mutiple-xls-files-tp19168828p19168828.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
> 
> 
> ForwardSourceID:NT0000691E 
> =====-----=====-----=====
> Notice: The information contained in this e-mail
> message and/or attachments to it may contain 
> confidential or privileged information. If you are 
> not the intended recipient, any dissemination, use, 
> review, distribution, printing or copying of the 
> information contained in this e-mail message 
> and/or attachments to it are strictly prohibited. If 
> you have received this communication in error, 
> please notify us by reply e-mail or telephone and 
> immediately and permanently delete the message 
> and any attachments. Thank you
> 
> 
> 
> 
> 
>       
> 

-- 
View this message in context:
http://www.nabble.com/merge-worksheets-from-mutiple-xls-files-tp19168828p19182802.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




      

Re: merge worksheets from mutiple xls files

Posted by gliao <gl...@gmail.com>.
Hi Anthony and Suyash,

Thanks a lot for your reply. 

Anthony, the code you provided can copy sheet. The only issue is it doesn't
copy the font and color information of the original sheet, it only copy the
content.

Regards,

George 




Anthony Andrews wrote:
> 
> I have searched the archive and found this;
> 
> http://jxls.cvs.sourceforge.net/jxls/jxls/src/java/org/jxls/util/Util.java?view=markup
> 
> Do not know if it is exactly what you require and I have not tested it my
> self but it may be worth a look.
> 
> Otherwise, as another poster has suggested, you will have to code your own
> method that copies across the cells one by one from one sheet to another.
> 
> --- On Tue, 8/26/08, Suyash Jape <su...@tcs.com> wrote:
> From: Suyash Jape <su...@tcs.com>
> Subject: Re: merge worksheets from mutiple xls files
> To: "POI Users List" <us...@poi.apache.org>
> Date: Tuesday, August 26, 2008, 8:41 PM
> 
> As far as i have searched, you may have to copy the cells row wise for 
> each sheet into the target workbook.
> There doesnt seem to be a copy sheet function for the workbook.
> 
> Regards
> Suyash 
> 
> 
> 
> gliao <gl...@gmail.com> 
> 27-08-2008 01:05
> Please respond to
> "POI Users List" <us...@poi.apache.org>
> 
> 
> To
> user@poi.apache.org
> cc
> 
> Subject
> merge worksheets from mutiple xls files
> 
> 
> 
> 
> 
> 
> 
> I want to merge worksheets from multiple xls files into a single workbook
> with all those sheets. I can't find POI API to implement that. Any
> suggestion? Thanks.
> -- 
> View this message in context: 
> http://www.nabble.com/merge-worksheets-from-mutiple-xls-files-tp19168828p19168828.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
> 
> 
> ForwardSourceID:NT0000691E 
> =====-----=====-----=====
> Notice: The information contained in this e-mail
> message and/or attachments to it may contain 
> confidential or privileged information. If you are 
> not the intended recipient, any dissemination, use, 
> review, distribution, printing or copying of the 
> information contained in this e-mail message 
> and/or attachments to it are strictly prohibited. If 
> you have received this communication in error, 
> please notify us by reply e-mail or telephone and 
> immediately and permanently delete the message 
> and any attachments. Thank you
> 
> 
> 
> 
> 
>       
> 

-- 
View this message in context: http://www.nabble.com/merge-worksheets-from-mutiple-xls-files-tp19168828p19182802.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


Re: merge worksheets from mutiple xls files

Posted by Anthony Andrews <py...@yahoo.com>.
I have searched the archive and found this;

http://jxls.cvs.sourceforge.net/jxls/jxls/src/java/org/jxls/util/Util.java?view=markup

Do not know if it is exactly what you require and I have not tested it my self but it may be worth a look.

Otherwise, as another poster has suggested, you will have to code your own method that copies across the cells one by one from one sheet to another.

--- On Tue, 8/26/08, Suyash Jape <su...@tcs.com> wrote:
From: Suyash Jape <su...@tcs.com>
Subject: Re: merge worksheets from mutiple xls files
To: "POI Users List" <us...@poi.apache.org>
Date: Tuesday, August 26, 2008, 8:41 PM

As far as i have searched, you may have to copy the cells row wise for 
each sheet into the target workbook.
There doesnt seem to be a copy sheet function for the workbook.

Regards
Suyash 



gliao <gl...@gmail.com> 
27-08-2008 01:05
Please respond to
"POI Users List" <us...@poi.apache.org>


To
user@poi.apache.org
cc

Subject
merge worksheets from mutiple xls files







I want to merge worksheets from multiple xls files into a single workbook
with all those sheets. I can't find POI API to implement that. Any
suggestion? Thanks.
-- 
View this message in context: 
http://www.nabble.com/merge-worksheets-from-mutiple-xls-files-tp19168828p19168828.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


ForwardSourceID:NT0000691E 
=====-----=====-----=====
Notice: The information contained in this e-mail
message and/or attachments to it may contain 
confidential or privileged information. If you are 
not the intended recipient, any dissemination, use, 
review, distribution, printing or copying of the 
information contained in this e-mail message 
and/or attachments to it are strictly prohibited. If 
you have received this communication in error, 
please notify us by reply e-mail or telephone and 
immediately and permanently delete the message 
and any attachments. Thank you





      

Re: merge worksheets from mutiple xls files

Posted by Suyash Jape <su...@tcs.com>.
As far as i have searched, you may have to copy the cells row wise for 
each sheet into the target workbook.
There doesnt seem to be a copy sheet function for the workbook.

Regards
Suyash 



gliao <gl...@gmail.com> 
27-08-2008 01:05
Please respond to
"POI Users List" <us...@poi.apache.org>


To
user@poi.apache.org
cc

Subject
merge worksheets from mutiple xls files







I want to merge worksheets from multiple xls files into a single workbook
with all those sheets. I can't find POI API to implement that. Any
suggestion? Thanks.
-- 
View this message in context: 
http://www.nabble.com/merge-worksheets-from-mutiple-xls-files-tp19168828p19168828.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


ForwardSourceID:NT0000691E 
=====-----=====-----=====
Notice: The information contained in this e-mail
message and/or attachments to it may contain 
confidential or privileged information. If you are 
not the intended recipient, any dissemination, use, 
review, distribution, printing or copying of the 
information contained in this e-mail message 
and/or attachments to it are strictly prohibited. If 
you have received this communication in error, 
please notify us by reply e-mail or telephone and 
immediately and permanently delete the message 
and any attachments. Thank you