Quantcast
Channel: NetOffice - MS Office in .NET
Viewing all articles
Browse latest Browse all 1741

Commented Unassigned: NetOffice.ExcelApi.Application.GetActiveInstance return null [20470]

$
0
0
When I've already have excel aplication with opened Workbook
instance = NetOffice.ExcelApi.Application.GetActiveInstance();
returns existing instance and it's correct.
But if the user change cell and leave the cell in Editing-Mode
the result of instance = NetOffice.ExcelApi.Application.GetActiveInstance() is null.

I need use exiting application anyway and not create new. How to get it?

P.S. It doesn't happen using Interop: the result is always correct
instance = (Application)System.Runtime.InteropServices.Marshal.GetActiveObject("Excel.Application");
Comments: ** Comment from web user: SebastianDotNet **

excel reject all programmatic access while calculate and edit cells but i'm wondering it works in interop. i want clearify the situation. as hotfix i suggest you to use interop. something like this:

var proxy = GetActiveObject("Excel.Application");
new NetOffice.ExcelApi.Application(null, proxy);

or a process window technique that is demonstrated in latest source state (folder tests\concept tests\object from window) (this technique is used by default for GetActiveInstance(s) in NO 1.7, coming soon)

Sebastian


Viewing all articles
Browse latest Browse all 1741

Trending Articles