Question

I am working on app for office 2013, now when i create a project it asks what capabilities do i like this to work for like word, excel, etc... that information is saved in the app manifest and that's fine but how inside the application i can figure out the name of the currently running app like whether it's "Microsoft Word", "Microsoft Excel" how do i get that information via code.

These are the capabilities that i added

<Capabilities>
   <Capability Name="Workbook" />
   <Capability Name="Presentation" />
   <Capability Name="Project" />
   <Capability Name="Document" />
</Capabilities>

My question is how can i get the current office application using my app with javascript?

Was it helpful?

Solution

There is no direct interface to get that information, and I'm not sure why you would.

But looking at the Java API For Office 1.1 you find that

  • Office.select() is only supported by Word and Excel
  • Document.getFileAsync() is only supported by Powerpoint and Word.

So by testing these two for success/failure you can decide that your host is Excel or Word.

Alternatively, you can loop through the script tags to see whether the document includes excel-xy.js or word-xy.js.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top