How to bind Office web addin dynamically on demand from host application(asp.net website) - ms-word

For VSTO I have a provision to call it based on demand from my host application. Where as for web addin it is globally installed in server so it will be reflected if I open any word document. I want the addin to be activated programmatically from my host application(.Net/C# MVC). Please suggest how can I achieve this.

This isn't possible with Office Web Add-ins currently. Please go to Office Developer Voice and search to see if this idea has been suggested. If it has, vote for it. If it hasn't, make the suggestion.

Related

Is there official clipboard access from office-js for Word add-in?

I have reviewed the office-js docs and not found any formal way of working with the clipboard through a Word add-in.
I attempted to use the newer navigator.clipboard.writeText but it is automatically rejected by the internal Word browser (where the add-in is hosted) without prompting the user (like a browser does). I have not seen any associated support for permissions policy that can be used to communicate with Word that the add-in would like clipboard permissions.
So, I am resorting to the deprecated document.executeCommand('copy') for now, but am concerned that will get my add-in rejected by the MS App Store.
Is there an official/sanctioned way to use the clipboard from within a MS Word add-in?
OfficeJS doesn't provide anything for that. You may sill use the Document.execCommand() API which includes "copy", "cut" and "paste". But it was deprecated and may not work in the web browsers any longer.
Feature requests on Tech Community are considered, when the dev team go through the planning process. Use the github label: Type: product feature request at https://aka.ms/M365dev-suggestions .
It seems like there's one method Range.copyFrom of Excel rich client api. I can't find the alternatives either. Maybe you can ask to provide the new feature. Whether it could be in the future feature list or not may also take some time.

Add-in disappearing from customers' ribbon in Word desktop

We are getting an increased number of reports from customers that our add-in sporadically disappear from the ribbon in Word. It is a problem for us as people don't use what they can't see and many are very un-tech savvy and don't know how to reactivate add-ins (especially if they are used to have their central admin push them out to them).
Is this a known issue? Is there any setting in the manifest file that we might have missed? We would appreciate any information that might point us in the right direction to solve this.
First of all, I'd suggest making sure the add-in is available and loaded by host application.
Second, I'd recommend checking whether any ribbon UI errors are thrown by the host application. By default, if an add-in attempts to manipulate the Microsoft Office user interface (UI) and fails, no error message is displayed. However, you can configure Microsoft Office applications to display messages for errors that relate to the UI. You can use these messages to help determine why a custom ribbon does not appear, or why a ribbon appears but no controls appear.
To show add-in user interface errors you need to start the application and configure the following option:
Click the File tab.
Click Options.
In the categories pane, click Advanced.
In the details pane, select Show VSTO Add-in user interface errors, and then click OK.
See How to: Show Add-in user interface errors for more information.

Microsoft WORD add-in generated by generator-office can not load Office object

I have not enough reputation to post pictures, you can see the similar question here: https://learn.microsoft.com/en-us/answers/questions/392363/word-add-in-generated-by-generator-office-can-not.html
According to the Microsoft official Office documentation, I tried to use Yeoman's generator-office to generate WORD add-in, and then use npm start to start, but in the Taskpane it always showed "Please sideload your add-in to see app body".
Using the Microsoft Edge DevTools Preview tool, I can see the missing Office objects.So this question has something to do with the version?
But when I visited this add-in via the web page, I can see that the Office object is loaded successfully.
Why is the Office object unsuccessful when accessing this add-in in WORD,and how can I fix this?
Recorded following on May 19th. I tried to executed this example on another computer with Win7 and Office Professional 2016,it works well.
I tried the Office 2019 Professional,this problem is solved. I don't know it's the problem of edition, or of activation.

How to Enable/Disable Ms-Word Command Button Using Office JS?

I am creating a word custom add-ins and in that depending on the file name I have to disable and enable custom ribbon button/s or we can say hide/show custom ribbon button/s.
I go through the link given in Microsoft Docs Here and many other article that suggest that it is only currently in preview state and only accessible on Excel.
I also go through Office User Voice and found one suggestion here.
If anyone have alternative of this then please help me to achieve that.
Support: This add-ins should support Word for Windows, Word For Mac and Word For Web.
As you found in the documentation, enable/disable of ribbon buttons is currently only available in Excel. We are currently looking at bringing the capabilities to PPT but I cannot give you a timeline for when to expect enable/disable for Word.
I would suggest adding a comment to the User Voice suggestion regarding compatibility with Word.

Office.js fails to initialize in Word add-in with Angular

I'm building an (JS based) add-in for Word and it seems that I'm somehow unable to properly load (or actually, initialize) the office.js library when using the add-in in Word, both online as well as the desktop clients. I cannot execute any functions related to the office.js.
I've done some debugging and I found out that the sample projects work just fine, based on that finding I removed Angular from my add-in and it works fine that way. I load the office.js in exactly the same way in both the projects with and without angular. Is there a known incompatibility between Angular and Office add-ins? I haven't been able to find anything on this.
Actually there is a common error that I, and others, have come across several times when building angular apps in the context of an Office add-in. The office.js initialize function is there to set-up the communication between the add-in frame and the Office host application. If the office.js does not respond to the host application within 5 seconds after loading the add-in, it will fail. In this case, what happens often is that the office.js is loaded after (or by) angular, by then the 5 seconds are gone. What you should do is bootstrap angular in your office initialize. A more elaborate explanation and a guide on how to do this can be found here: https://www.itunity.com/article/building-excel-2016-addin-angular-enhanced-officejs-2637