We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

How to make current sheet 2 in Excel file?

Dear Aspose Team,<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

First – congratulations for you excellent product!

I have 1 small question. I have template Excel file in which have 3 sheets. I open this file, then fill it with my data and finally I want to make current let say let say sheet2 so when user open Excel this sheet to be first which he see. How to do this ?

I try with this code, it not produce error, but not do what I need.

Worksheets sheets = wb.Worksheets;

Worksheet Sh1 = wb.Worksheets[SheetNumInExcel];

wb.Worksheets.ActiveSheetIndex = SheetNumInExcel;

// this do not work

Hi,

Well, the activating APIs like Worksheets.ActiveSheetIndex would work if you are using licensed version (using license file with the product). See the complete document for reference: http://www.aspose.com/documentation/.net-components/aspose.cells-for-.net/activating-sheets-and-making-an-active-cell-in-the-worksheet.html

If you are not using a license file, the last “evaluation watermark” worksheet would be active by default. So, you need to use the license file and set the licensing code first:

//Instantiate an instance of license and set the license file through its path


Aspose.Cells.License license = new Aspose.Cells.License();


license.SetLicense(“Aspose.Cells.lic”);


See the complete document: http://www.aspose.com/documentation/.net-components/aspose.cells-for-.net/licensing.html

Either you may purchase the product or ask for a 30 days temporary (free) license to evaluate these APIs.

Thank you.