Remove add-in in saved document - ms-word

If I save a Word document with my add-in open and opens the document on another computer that does not have my add-in installed, Word asks if the user trusts the add-in. If the user chooses to trust the add-in it is installed on the user computer. Is there any way to avoid this behavior.
My add-in is used to insert comments in to the document but the add-in is not meant for the recipients of the document.
It only seems to be the case on Mac.

As you have seen, when you close a taskpane, it is not really removed from the document -- it is just "hidden". If you want to "export out" a document and have the taskpane removed completely, go to Info -> Check for Issues, make sure that the "Task Pane Add-ins" is checked, click "Inspect", and then confirm that you want the taskpanes removed.
More info on Document Inspector here: https://support.office.com/en-us/article/Remove-hidden-data-and-personal-information-by-inspecting-documents-356b7b5d-77af-44fe-a07f-9aa4d085966f

Related

All Word 2016 add-ins erroneously auto-open, doesn't respect "Office.AutoShowTaskpaneWithDocument", sets taskpane visibility to "1"

I've observed that O365 is consistent with the documentation on "Auto Open" behavior for Office.js taskpanes, but W2016 is not, so I'm wondering if this is a bug or if there's alternate instructions I should refer to.
I've tested this with my add-in, a newly created word add-in (template), and the Wikipedia add-in on the store.
Word documents saved in W2016 while an Office.js taskpane is open will auto-open, even if Office.AutoShowTaskpaneWithDocument is absent or set to false. This is because visibility is set to "1" in word/webextensions/taskpanes.xml (whereas its set to "0" in O365). For users who don't have the add-in installed, any document saved with the add-in open (even those with auto open absent or set to false) will show a blank add in.
Is this expected behavior, and if so, how can I programmatically (via Office.js, not by modifying the raw xml) ensure the add-in does not auto-open for docs created on W2016?
Is there a way to programmatically set the "visibility" setting for the add-in?
Thanks in advance!

Prevent Word on Mac to automatically follow hyperlinks on click

I am developing a Word Add-in application that should work on Word application for both Windows and Mac. I have a problem specific to Word on Mac, while Word on Windows and Word online work as expected.
For business logic reasons my add-in application needs to create and update hyperlinks in the word document. The hyperlink gets updated once the user clicks on it in the document. However, the default behaviour of the Word on Mac is to automatically navigate user to the browser with the hyperlink URL, once he/she clicks on the hyperlink. Incidentally, if you press CMD + click on a Mac, you won't be navigated away from the application.
Is it possible to programatically (using Office/Word Api from the JS driven add-in application) prevent that kind of behaviour on hyperlinks when clicked?
If not, is it possible to capture and cancel the cursor click event on the hyperlink? Or capture it and maybe emit a new event which would simulate "CMD + click", with effect to not navigate from the document?

Dynamic data manipulation in word online

I am trying to build a task-pane add-in for word online which can do mail merge like desktop office. Now I understand that word online does not support mail merge out of the box, so I thought about the following steps -
Create a template (DOTX) using desktop office which will contain Region or something like a merge field etc. Upload the template to one drive.
Open a blank doc and add a task pane add-in in word online. This is temporary step for now.
Click a button on the add-in.
This click will stream the template (DOTX) from server using an app service call.
Render the stream into word online web page.
Edit and save.
Close word online and reopen.
Click the doc link.
This will render the doc in word online.
Add the add-in in the task pane (temp step).
Click edit button.
Call app service to fetch the latest merge data source.
Traverse through the word xml and replace the values corresponding to the region or special keys.
Re-render the doc.
My users will have E1 subscription of office 365.
Is this thought process logical and achievable with word online? Thanks in advance!...
I think your approach is much more complicated than it needs to be. Word Online supports Add-ins created using the JavaScript APIs, as supported by the information in this article: https://msdn.microsoft.com/EN-US/library/office/dn833104.aspx
It should be possible for you to create the "template" on the Desktop (Word 2013 or 2016 is required - but only 2016 supports the current full scope of the JS API) and "insert" your add-in, which links it to the document. Opening the document in Word online should automatically load the add-in, that can then link to the data source and fill in the data.
As data targets ("merge fields"), I recommend you use Content Controls.

Reactivating COM AddIn with Word Interop

I've written a custom ribbon for word. In my winForms-application I also open a word document with word-Interop to create some texts with word.
When I use normal word documents my ribbon is shown correct but when I open the document in my application then the ribbon is gone.
I found out that it is somehow disabled in the COM-AddIn-Options in Word. When I reactivate it manually it appears.
How can I reactivate it programmatically?
[Update]
For better understanding: I have two solutions.
1) A AddIn for Word which displays a ribbon
2) A winform-application which has a winword-control which loads word in it.
When the second one is started the first one is not available anymore.
To answer your question, it's not possible to programatically re-enable your add-in from the add-in itself. Think about it - it doesn't get loaded, so its code won't get run. So nothing you put in your code will re-enable the addin, because it won't get executed.
The only way would be to create a watchdog process that checks if the COM add-in has been disabled every 10 minutes or so, and re-enables it. You'll need to know where Word stores those settings though.

VSTO Word AddIn 2007/2010 Disable Editing, like document management systems do

Could you tell me please how it is possible to:
somehow disable editing an open document?
or get notified when the user is about to change the current document?
like some document management apps do: while the document is checked in they:
do not allow modifications to it or
when user tries to modify it he will be notified that the document is checked in so it should be checked out first
Set the document protection type to WdProtectionType.wdAllowOnlyReading which is similar to opening word document from Email, Internet or SharePoint portal.
When the use click the Edit anyway yellow bar in the top ProtectedViewWindowDeactivate Event will occur where you can raise an alert.