I'm in the process of exploring the possibilities of Word VSTO add-in. Using a combination of custom task pane(s), a custom ribbon and a series of dialog boxes or forms I can collection information from the user. However, what I can figure out is where I can persist this information within the document. A docx is made of a series of individual files, how do I add my file within the cab as well? Storing the custom info outside of the document is not an option, it must travel with the document itself.
Thanks,
Update : If I use custom xml parts per the solution mentioned here https://msdn.microsoft.com/en-us/library/bb608612.aspx then it appears to me that the xml data is visible to the user. See screen shot. The user should not be able to browse data that my add-in is storeing - not because it's senstitive but because it makes no sense for them to see and interact with a bunch of serialized class data.
You can store your custom information inside the document using so called Custom XML Parts. This information is stored within the document.
Here is an example how to add a Custom XML Part to your document:
How to: Add Custom XML Parts to Documents by Using VSTO Add-Ins
Related
I am building a project with Django 2.2.4 and PostgreSQL 11.4. I am using JSON database fields to store data in JSON arrays.
In my app users create documents using "rich text editor" that provides standard text/image features already.
I also want to enable users create the document to drag and drop form inputs into the body of the document so that once the document is "published" other users can view the document an add input values to these fields before submitting and saving the document again.
Now, I'm trying to figure out conceptually the most efficient way to approach this.
I thought the first step would be to use an abstracted rich text editor which separates the document structure from the HTML, e.g. CKEditor or Quill; if I was to serialise the document with form inputs included I could in theory store templates in one JSONField and inputs in another.
This list is a really useful overview of various editors, but despite having read a lot of documentation it's not clear if this approach would be either correct or actually possible.
Does anyone have any similar experiences?
Pretty sure this isn't possible unfortunately.
Could you elaborate on what you're trying to do with this?
I'm trying to develop word add-in which allows to modify word content. One of the requirement is to select some text and mark it:
change its style (look) - and that is done
Associate that piece of text with some custom/hidden data, ex. an ID.
I want to somehow persist that data within the document, so that:
My add-in can read the document on the start and build a list of 'marked' elements
It should work on different machines - I can create a document on one machine, later open in on other machine, and add-in should be able to retrieve that data.
So far I tried to persist that data by first, getting data as HTML, and add attributes to tags, but that didn't work.
Also tried to add some hidden div, but it was only available during word app lifetime.
Recently, found this link: https://github.com/OfficeDev/Excel-Add-in-JavaScript-PersistCustomSettings , but still it allows to persist data in scope of "browser", so, I assume that on other machine it won't work.
What are my possibilities? Maybe I shouldn't store it within a document, but if not, where?
Developing it using office-js - it should work for both Word 2013 and Word 2016 (so I don't have an access to Word 2016 specific API).
Check out https://dev.office.com/reference/add-ins/shared/settings
The Office JS Settings object allows you to save custom data that persists with the document. It is pretty straight-forward to use. Getting settings is synchronous - saving settings is async. The biggest thing is that you have to remember to call Office.settings.saveAsync() after you have made your changes using Office.settings.set() in order to actually save the changes to the document.
Moreover to Nick's answer which is absolutely correct, you can use "Binding" mechanism.
Bindings are stored in document out-of-the-box, so that, you can access those later at any time.
An example, which fits my needs:
Select some text and click on button in add-in (to call some method)
Call addFromSelectionAsync() method (you can specify an id for it to reference it later)
Access it using getAllAsync() or getByIdAsync() method at any time you need it.
More about it: https://dev.office.com/docs/add-ins/develop/bind-to-regions-in-a-document-or-spreadsheet
Can anyone point me to info about how to create a Microsoft Word document that changes text input fields depending on what the user selects in a drop-down menu?
I'm using Word, Developer toolbar, Design mode, and have gotten as far as how to create the drop down selection box, and add text input fields below that on the page, but I need to know how to change what fields appear depending on what the selection is. I'm sure it's possible, I just don't know how to go about it.
I'm pretty good with this sort of thing in HTML with javascript and jQuery, but Word is its own little world.
I tried the "structured" tab but it suggests selecting XML add ins, and none appear in the list to select.
One option is using a template approach in combination with 3rd party toolkit and external application. External application takes care for user interface where user selects template and sets filter for data retrieval. The application then reads the data, generates new document based on template and populates it with data.
You don’t have to mess with MS Word macros and this solution can survive Office upgrades very smoothly.
Template design in done in MS Word. We are using third party toolkit (i.e. Docentric Toolkit) for populating Word documents with data.
I am using Adobe life cycle designer to create docs in my application....I have all my documents in word and I use the export to option in Adobe Life cycle designer and i get the document converted and now I need to have a user fill in the exported document..so can some one please suggest me how this would go and we use the java script behind....
You could have them fill the form in Adobe land, then use the scripting method exportData to get the form data as XML, then inject that XML into your Word docx as a custom xml part.
From there, Word will use the XML in any content controls bound to it.
I am creating a Word document template, I would like users who use this form to also be able to manage an attached file. The template is written with Microsoft Word 2000. Is there a way to create a part of the template that can be used to manage such an attachment?
I solved the problem by dragging the file I wanted to attach directly into the Word document.