Collectives™ on Stack Overflow
Find centralized, trusted content and collaborate around the technologies you use most.
Learn more about Collectives
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
Learn more about Teams
Ask Question
I have a class library (that can be seen as a stand-alone application for this purpose) that does this:
Creates a new excel application
Creates a new sheet
Populates the sheet
Needs to add controls to the sheet with events (c# events, not willing to use VBA or text scripts)
My library cannot have another project type, nor can it be a VSTO addin (because this library is already an addin for another application not related with Office, this I cannot change)
Nevertheless, I noticed that I can reference the
Microsoft.Office.Tools.Excel.dll
library and access its types which exposes the control methods I want to explore.
So, the questions are:
How can I get a
Microsoft.Office.Tools.Excel.Worksheet
from a
Microsoft.Office.Interop.Excel.Worksheet
object?
From the Microsoft
documentation
, I see that they suggest to use
Globals.Factory.GetVstoObject(nativeWorkbook)
. The problem is: my application is not a VSTO add-in and I do not have a
Globals
variable in my project.
Is there a way to access the
Globals
class/variable from a standalone application?
Is there a way to create a
Globals
instance from
Microsoft.Office.Interop
somehow?
Unfortunately,
Factory
is not a class that I can instanciate, it's just an interface
Is it possible to create an intance of
Factory
in a standalone application?
Thanks for contributing an answer to Stack Overflow!
-
Please be sure to
answer the question
. Provide details and share your research!
But
avoid
…
-
Asking for help, clarification, or responding to other answers.
-
Making statements based on opinion; back them up with references or personal experience.
To learn more, see our
tips on writing great answers
.