We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

How to change the displayed worksheet programmatically?

Hi,

I have an application with the sfspreadsheetcontrol. I load an excel-file with multiple worksheets. The active sheet at start is the firsdt worksheet which is also displayed in the control. Now I need to switch by code to another worksheet, so that the user sees those new worksheet (e.g. because as a result of a search, I know that the wanted cell is on sheet 2).

I can change the active sheet:  spreadsheetControl.ActiveSheet = spreadsheetControl.Workbook.Worksheets[worksheetname];

Now the active sheet has changed, but still the old worksheet is displayed by the control. I have tried something like: spreadsheetControl.ActiveSheet.Activate();

But the old worksheet is still active.

So what do I need to change, worksheet?

Thanks,
Michael

1 Reply

KB Kanimozhi Bharathi Syncfusion Team April 26, 2016 12:37 PM UTC

Hi Michael, 

Thank you for contacting Syncfusion Support. 

We have added a new method “SetActiveSheet(“SheetName”) to set the active worksheet in SfSpreadsheet  and this method will be included in 2016Vol1 SP1 release which will be rolled out by the end of this month. 

if (this.Spreadsheet.SetActiveSheet("Sheet10")) 
MessageBox.Show("Sheet activated"); 


Regards 
Kanimozhi B 


Loader.
Live Chat Icon For mobile
Up arrow icon