0

I need some help on word add-ins

I will be programmatically creating a document and as part of that I need to add custom property (Pub_Doc_ID) to the document, as in the picture below.

enter image description here

I am using Word Java APIs now and could not find a way to do this job. The work flow I am targeting is very simple. Create a Document, get the Pub_Doc_Id from DB which is primary Key and assign to the document. Now primary key is attached to the document, so it will be lived with document.

Some more background : As I mentioned earlier I am using Word APIs. I am adding text, sections, images etch. Now I need to have one connector (Pub_Doc_ID) between Doc and DB. So wanted to use custom properties. If there is any better way to do it. Then let me know.

I know how to do this in VSTO. I am looking for Word Java API.

This pub_doc_id ID then I will be using to call API's and to load task pane.

Thanks, really appreciate any help on this.

*Pub_Doc_Id : Publishing Document ID.

Cindy Meister
  • 25,071
  • 21
  • 34
  • 43
Tanmay
  • 325
  • 1
  • 5
  • 13

2 Answers2

4

R/W access to custom properties is something my team is working on and would be delivered towards the end of the year.

Seems that for your scenarios you don't necessarily need to store that information as a custom property and you have a couple of alternatives in the meantime:

  1. You can add your own customXmlPart to the doc to store this information. Here is a great example on how to use this: https://github.com/OfficeDev/Word-Add-in-Work-with-custom-XML-parts/tree/master/C%23/CustomXMLAppWeb/App

  2. You could also store it a setting of your add in. Check out the settings object and how to store and retrieve settings: https://dev.office.com/reference/add-ins/shared/document.settings

Hope this helps!! Thanks

Juan Balmori
  • 4,898
  • 1
  • 8
  • 17
  • Thanks for quick response. Custom Web Parts would help us to achieve this.. Custom XML Part is hidden inside document, this makes us difficult to view. So now in order to see the properties we need develop extra screen to show properties or just open it as XML and then see it. The reason we wanted to use custom properties is we can see by just right clicking on it. This ease of the workflow and processes around it. But glad this your team is working on this. Again, thanks for your response. – Tanmay Jun 24 '16 at 16:12
1

You cannot presently access custom properties via the JavaScript API. They are currently working on it and have put information about proposed APIs on GitHub

lgaud
  • 2,430
  • 20
  • 30