I have an add-in in MSWord. One of the ways in which users interact with it requires a user to type into a Word document "commands" and also their own user-defined "data elements". I would like to provide the user with some Intellisense to help them type these commands and data elements. Has anyone done anything like that (I guess it involves trapping user key-strokes destined for Word and to do something with them before handing the key-stroke on to Word, but it would be nice if someone had found an easier way). Oh, yes, I program in C#.
Related
I find that my collection of snippets has grown far beyond what can be managed by assigning a Category and Name. "I know I wrote this code before, it's probably in one of these three categories but it definitely hit table T and used function F; should my time be spent clicking thru each likely category and dragging out each snippet, reinventing it, or searching the snippets.xml?" is a conversation I have with myself far too often.
I tend to copy the snippet body into the tag so I can hover and see some of what's in there but still, being able to actually search the snippets (like we can do with SQL History) would be amazing. Is there a way?
No, there is no way today.
I'm happy to log an enhancement request on your behalf for that feature.
In the meantime, maybe consider trying the Code Templates instead?
You can 'search' either by the name of your code template, or by the first word of the code template 'source'
type the word, and then ctrl+enter to bring up the list of 'hits'
Seeing that I(or a user) have to manually go to check "Different First Page" in MS Word ever time I open a document, I wonder if there's a way I can include a command in the word-addins to conveniently check the "Different Fist Page" option? Or if this can be done in OOXML (via something like insertOoxml())? I think this is probably doable in VBA macro, but does Word-JS API have anything like setDifferentFirstPage()? or have it done in XML? Thanks!
I need to extract the attachments(pdf and .xlsx) from mail box using auto hot key.
Can somebody elaborate the steps for achieving this?
Any links could also be of help.
Thanks
#dheerendra
First, figure out how to do it in a stepwise fashion with just the mouse and/or keyboard (look for shortcut keys or accelerator keys or hot keys - those things with underlines under them). Once you can do it manually, secondly, use AutoHotKey (or any other scripting utility) to automate those steps. These links can help.
AutoHotKey can replicate Mouse clicks at locations:
https://www.autohotkey.com/docs/commands/Click.htm
AutoHotKey can replicate sending Keys from the keyboard:
https://www.autohotkey.com/docs/commands/Send.htm
That should do it, now you just put the steps into the script, maybe with some wait times between steps, or maybe with some error checking, or maybe add some flow control logic, or perhaps get and respond to additional user input, or even a GUI.
But if you have any trouble, show us what you tried (just enough of your code to disclose the troublesome part), and tell us what you expected to happen, and then tell us what actually happened.
EDIT: (Examples of the improvements)
E.g., you could use control logic to save in a place and name it depending on the sender or subject, or a category:
https://www.autohotkey.com/docs/commands/IfExpression.htm
Or you could get simple user input to determine where to save it and what to call it:
https://www.autohotkey.com/docs/commands/InputBox.htm
Or even create a full blown application with a GUI and connections to other data, and use that to establish a complete workflow process.
https://www.autohotkey.com/docs/commands/Gui.htm
Also, you didn't say what Mail client you are using, but I should mention that in addition to scripting mouse and keyboard actions, AutoHotKey lets you easily interact with Microsoft Outlook com interface which can easily expose email message objects and their attachments.
https://www.autohotkey.com/docs/commands/ComObjCreate.htm
Good luck, and Hth,
I'm creating a Office Word add-in that needs to fetch text and show it in the task pane. Since it would be preferred to show the text with the same formatting as in the host document, I'm using the getSelectedDataAsync() function and specifying Office.CoercionType.Html as coercion type. This works very well in Word online; but unfortunately not in Word 2013 and 2016 clients.
Looking at the documentation (http://dev.office.com/reference/add-ins/shared/document.getselecteddataasync), it says Office.CoercionType.Html is supported for Word but does not explicitly mention Word online. Judging from behaviour, it seems that the documentation is maybe faulty and should say the other way around.
But maybe I'm just missing something. Any ideas on why it's not working or how I can proceed to get it working? I would prefer to do minimal processing after getting the selection, which is why fetching it in HTML seemed to be the best solution. Fetching plain text does not even seem to take paragraphs into account which is a absolute minimum requirement of formatting.
The only really similar question I've found, Apps for Office 365 - Return selected text with styling and formatted, is related but does not answer my question.
This proved to be a problem not with Office.CoercionType.Html itself being unavailable, but rather it returning slightly different HTML in the Word clients and Word online. This made things break later in the code while applying some simple filters to the HTML which in turn made it look like the function did not return anything.
Like stated in the question the documentation is not completely obvious about the coercion type working in both Word clients and Word online, but I can hereby confirm that it does indeed work in both variants of Word.
I have been tasked with updating a Word 2010 fillable form for one of our departments. In various places in the form it uses a drop-down box with the same 20-or-so items in the list. I would like to make it so all occurrences of this box fill from a master list, thus making it easier to update in the future. I know in Excel you can do this with Data Validation and selecting a source list from somewhere else in the workbook. Is it possible to do something similar (reference a table, hidden text, etc) in Word? I have not been able to locate a feature in Word that looks promising, nor have my Google searches yielded anything useful. I realize this would probably work in VBA, but I'm hoping to avoid adding code to the workbook if possible. I would also prefer that the list be updateable by someone who does not know VBA. I'm not looking to do the impossible, so if you know for a fact that this cannot be done, say so and I'll move on.
Thanks.