This project has moved. For the latest updates, please go here.

Select active sheet

Sep 9, 2012 at 11:25 AM

Can I make only one sheet to be the active sheet? I tried SetTabSelected and SetTabActive but they add the sheet to selected sheets and create a group.

Should I use a loop to unselect all the sheets !

Thanks and best regards,

Coordinator
Sep 9, 2012 at 3:37 PM

How can I reproduce it? The following works as expected:

            var wb = new XLWorkbook();
            var ws1 = wb.AddWorksheet("Sheet1");
            var ws2 = wb.AddWorksheet("Sheet2");
            var ws3 = wb.AddWorksheet("Sheet3");
 
            ws2.SetTabActive();
Sep 10, 2012 at 11:17 AM

Thanks for fast your response. I am doing something different; opening a file created by the user and fill some data and then activate the first sheet of the file. When I used SetTabActive a group is created (first sheet+ user selected sheet).

Coordinator
Sep 10, 2012 at 3:34 PM

Attach a file that I can use to reproduce the problem.

Nov 15, 2012 at 11:53 AM

I've had the same problem.

Use this decision for resolving:

var wb = new XLWorkbook(templatePath);

foreach (var worksheet in wb.Worksheets) 
{ 
    worksheet.SetTabSelected(false); 
}

Thanks!