Reply to topic  [ 4 posts ] 
Copying Sheets 
Author Message

Joined: Wed May 09, 2007 8:36 am
Posts: 14
Location: Israel
Reply with quote
Post Copying Sheets
I have a template with two sheets. I would like to copy the second sheet five times.

ExcelDocument xls = new ExcelDocument();
ExcelWorksheet xlsSheet = (ExcelWorksheet)xls.easy_getSheetAt(1);   

for (int j=0; j<5 ; j++) {
     xlsSheet.setSheetName("" + j);
     xls.easy_insertWorksheet(j+1, xlsSheet);


This gives me an error of
A sheet having this title already exists in this document!

I understand why this is, but I don't know how to solve it.

Sun Jul 08, 2007 11:34 pm

Joined: Fri Feb 03, 2006 12:23 pm
Posts: 163
Location: Brasov, Romania
Reply with quote
My suggestion is to create all 5 sheets into your template and not to try to use the same sheet.

If you are interesting only on using cell values and cell formatting from that sheet, you can use the following trick, but you will still have problems if you will try to add more data:

for (int j=0; j<5 ; j++) {
ExcelWorksheet xlsNewSheet = new ExcelWorksheet("" + j);
xls.easy_insertWorksheet(j+1, xlsNewSheet);

Mon Jul 09, 2007 4:27 am
Profile WWW

Joined: Mon Jul 16, 2007 12:52 pm
Posts: 3
Reply with quote
Is there ANY other better way to copy sheets and preserve things such as charts on the sheet ? When I do this, the charts are gone.

Also, when I do this and make changes on the copied sheet, it changes to original sheet. So it looks like the Excel Table is like a shallow copy and changes to it on the new sheets actually change the original sheet.

We really need a sheet copy functionality like Excel does. Is this not in the plans for EasyXLS? It seems like a nice feature to have.

Thu Jul 19, 2007 12:47 pm

Joined: Tue Oct 16, 2007 4:51 am
Posts: 1
Reply with quote
Post Copying Worksheets to new excel sheet
Hi All,

I need to copy the worksheet from one excel sheet to another excel sheet,how will i do that.When i rightclick on worksheet and select move or copy option it will not show new excel sheet.can anybody help me in this regard.

Would greatly appreciate ur help.


Tue Oct 16, 2007 6:32 am
Display posts from previous:  Sort by  
Reply to topic   [ 4 posts ] 

Who is online

Users browsing this forum: No registered users and 1 guest

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by STSoftware for PTF.