Deal With Sheets

Jan 9, 2011 at 11:34 AM

Hi all,

Is there an easy way to do the following:

1. Duplicate sheets

2. Create new sheets

3. Delete\Hide sheets

Thanks in Advance !

Feb 18, 2011 at 6:02 PM
Edited Feb 18, 2011 at 6:09 PM

I am looking for easy way to duplicate worksheets too. Haven't figured it out yet.
To hide a sheet, guess you have to go into Open XML. <ins> ExtremeML does not allow direct modification of underlying SDK objects.</ins>

Here is ExtremeML code for create/delete:

using (var package = SpreadsheetDocumentWrapper.Open("MyWorkbook.xlsx")) {
    package.WorkbookPart.WorksheetParts.Add("New Worksheet Name");
    package.WorkbookPart.WorksheetParts.Delete("Existing Worksheet Name");
}
Apr 27, 2011 at 8:58 PM

Is there a solution for the duplicate sheet thing? That would be a cool feature

Apr 28, 2011 at 1:51 PM

This is the solution:

http://blogs.msdn.com/b/brian_jones/archive/2009/02/19/how-to-copy-a-worksheet-within-a-workbook.aspx

I tried it and works perfect, except when the sheet name has spaces then the xml will have errors.

 

 It would be nice if it is included in ExtremeML