Is it possible to add dynamic content in docx?

What I’m trying to do in case if there’s new key or maybe some flag comes then I wanted to add some dynamic data in that file.

I’m using Angular in FE and checked all config settings but can’t find any option which can do similar thing

I’m referring this documentation : ONLYOFFICE Api Documentation - Config

Hello @mohitbumb
Could you please provide us with details of desired scenario? What do you mean by ‘dynamic content’ in the editor\file?

Hi @Alexandre , Thanks for reply

Scenario is I’ve some existing docx files with some content for each client and wanted to open those existing files initially so I’ve some pre-defined content already and then user can come and edit in that file.

Currently for each client file / content is different with help of document.key but initial file will always be blank I’m unable to open existing file with document.url or add some data in that file initially / first time

Hello @mohitbumb

I would like to be involved in this thread too.

Please clarify the point of usage of an empty/blank document in your scenario if you can share an existing document that has user defined content and edit it collaboratively. I think there are some more details yet to be discovered.

Hi, thanks for reply actually in our case there are some details of client will already be pre-filled in document (docx) file and our users can verify and add / edit details in that docx file

That’s why we wanted to open existing document which have those pre-filled details already exists

And pre-filled details in docx can be different for each docx but currently I’m unable to open existing document and every time when I initialise open office it returns blank document or last edited details but for first time its always blank

Please note that when you are opening two of more different files with the same document.key you will always end up in the first opened document no matter what document.url you’ve used.

So basically, if I get it correctly, you have a base document with certain information about clients and based on this document you want to create and open brand new document that contains part of the information from base document, is that correct?

yes, so is there any way to achieve it ?

In general, this can be done via plugin and Content Controls.
If you put all data per client into the Rich Text Content Controls in the base document and assign a certain tag to each of them, then via plugin you can fetch content of a specific Content Control by its ID with method SelectContentControl to store it somewhere* and then to paste it in new documents in the future. So basically, the goal is to load the plugin with those Content Controls in the first place to use them later on.

* it is all up to you as a plugin developer to decide where to store the data.

For example, here is a test plugin that can navigate through existing in the document Content Controls and show designated content of each them:
Also, an example can paste content into the CC by pressing the button (in this case the pre-defined text is used).

Note that this is just an example. For your scenario it will require certain modifications.