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 select cell that is active when workbook is opened

Hi,

If I create a new workbook with ExcelEngine.Excel.Workbooks.Add() and then save it, how can I control which cell will be active when the file is opened in Excel?

Thanks,

Brian

3 Replies

GM Geetha M Syncfusion Team November 6, 2009 10:35 AM UTC

Hi Brian,

Thank you for your interest in Syncfusion products.

You may activate any cell using IRange as shown in the code snippet below.

sheet["B2"].Activate();

Please try this and let me know if you have any questions.

Regards,
Geetha


BS Brian Schinazi November 6, 2009 02:10 PM UTC

Hello Geetha,

I am getting a NullReferenceException when I try to make use of IRange.Activate().

This code is producing the exception for me:

ExcelEngine engine = new ExcelEngine();
IWorkbook workbook = engine.Excel.Workbooks.Add();
IWorksheet worksheet = workbook.Worksheets[0];
worksheet["B2"].Activate();
workbook.SaveAs(@"C:\testactivate.xls");

Calling the Activate() method in the fourth line raises the exception.

Thanks,

Brian




GM Geetha M Syncfusion Team November 9, 2009 06:38 AM UTC

Hi Brian,

Thank you for the details.

I am afraid that I am not able to reproduce this problem in our latest public release v7.4.0.15. You may get it from the forum thread linked below:

http://www.syncfusion.com/support/forums/general/91019/

Could you please make sure if you are using the above version and if you still see the problem, please send us the input file so that we could check and get back to you?

Regards,
Geetha

Loader.
Live Chat Icon For mobile
Up arrow icon