Prevent Word on Mac to automatically follow hyperlinks on click - ms-word

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?

Related

Word, Excel web add-in prompts save dialog

Just wondering if I am experiencing an expected behavior - when I open my MS Word Web add-in and I want to close the document it prompts me if I want to save changes even I haven't changed anything on purpose. Let me know if there is a way not to pop up that dialog.
Thanks,
AU

Remove add-in in saved document

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

SWFUpload to upload files to website using PowerShell

I am trying to use PowerShell to automate the process of loading files to a website.
The process has four steps. I have automated the first three steps of the process by using getElementByID to fill values of textboxes and click buttons. The fourth step uploads the files. The website uses SWFUpload to upload the files. I cannot figure out how to trigger (fire event) the SWFUpload in PowerShell. I can trigger the other buttons using the .Click() method, but this does not work for the upload button. I suspect it is because it isn't really a button, but an SWFUpload utility (type=application/x-shockwave-flash).
Does anyone know how to trigger this in PowerShell? I can provide the HTML coding and the PowerShell script. I have referenced the website below, but it seems to show how to create the SWFUpload in JavaScript, not PowerShell.
https://www.chem.umn.edu/groups/gladfelter/blade_packs/system_CKeditor/plugins/pgrfilemanager/SWFUpload%20v2.2.0.1%20Core/Documentation/#swfupload
I did not find a way to work with SWFUpload in PowerShell, but I was able to find three work-arounds.
1.) SendKeys
2.) Mouse-click function via power shell : how to send middle mouse click?
3.) WASP https://wasp.codeplex.com/
I chose to use SendKeys because to use a mouse click, you must also move the mouse. This is possible, but it is so easy to nudge the mouse which would re-posisiton the mouse off of the button.
SendKeys allows the user to send keyboard keys to the computer without the user acutally doing anything. I used SendKeys to tab to the "Upload button", click it, navigate thru the Open File dialog box to select the files, and finally click the Open button to complete the upload.
There are some drawbacks to SendKeys, however. SendKeys will send the key(s) only to the window that is in the foreground. So if you are running your script and your computer sends you a pop-up message in the middle of it, SendKeys will send the keystrokes to that pop-up message.
SendKeys syntax:
http://blogs.technet.com/b/heyscriptingguy/archive/2011/01/10/provide-input-to-applications-with-powershell.aspx

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.