This project has moved and is read-only. For the latest updates, please go here.

How to upgroup sheet

Jun 24, 2010 at 9:33 AM

My project is copy template to multiple worksheet. How to ungroup sheet?

Jun 24, 2010 at 9:55 AM

Set OutlineLevel=0 on rows and columns.

Jun 24, 2010 at 10:17 AM

It doesn't work . My problem is xxx.xlsx[Group]. when I delete sheet all sheet is deleted.

Jun 27, 2010 at 7:52 PM

Can you give me an code example of what you are doing, I dont understand whats wrong here.

Oct 8, 2012 at 10:12 AM

I am experiencing a similar issue when copying sheet inside workbook (or adding by a copy).

When I edit a cell in the new or old sheet, the same cell in the other sheet is also edited.

I have tried to set OutlineLevel = 0 on every column and row, but to no effect.

package.Workbook.Worksheets.Add("Data " + sI, ws);

ws.Column(3).OutlineLevel = 0;
ws.Row(11).OutlineLevel = 0;

I have even tried to set OutlineLevel before and after the copy and on the new and old sheet.

It seems to me like it should be a property on the sheet level, as I can remove the grouping in Excel on the tab/sheet by right clicking.

What am I doing wrong guys?

Oct 17, 2012 at 8:50 AM


Really need some help on this matter

Oct 31, 2012 at 6:20 PM
Edited Oct 31, 2012 at 6:20 PM

I, too, have experienced this problem. In my situation I have a few separate XSLX files that I programmatically attach to a base workbook. It looks something like this:

ExcelPackage basePackage = new ExcelPackage(new System.IO.FileInfo("some_file.xlsx"));
ExcelPackage secondPackage = new ExcelPackage(new System.IO.FileInfo("another_file.xlsx"));
basePackage.Workbook.Worksheets.Add("Second", secondPackage.Workbook.Worksheets["Second"]);

Later on, this workbook (with multiple sheets that have been added from multiple sources) might get downloaded to the end user. When they then open it in Excel each of the sheets are grouped together by default. If they don't notice this (the only indication that the sheets are grouped is a subtle shading of the sheet tab name) they will wreak havoc by unknowingly modifying the values of multiple sheets when they mean to edit only one of the sheets.

Obviously, I would prefer the sheets didn't auto-group themselves together. I haven't investigated this bug very deeply yet; I was hoping to find an easy solution here.

Oct 31, 2012 at 7:24 PM

I may have figured out a fix for this problem. After I add all the disparate worksheets into my base workbook I issue this command:

epPackage.Workbook.Worksheets.First().View.TabSelected = true;
This forces the first page to be selected which, I guess, causes all of the other pages to become deselected.

Nov 1, 2012 at 10:59 AM

Thank you for posting your solution vaxjo.

I actually deselect every newly added tab, so I cannot confirm that TabSelected = true deselects all other tabs.

May 30, 2014 at 8:07 PM
@vaxjo That worked perfectly. Thx!