Solved

Populate MS-Word Template Bookmarks/Content Controls with Attributes


Badge +4

I've realized that we can include a template to MS-Word writer (docx). However it seems it only captures formatting from the template.

 

Is there any way that I can populate specific Bookmarks/Content Controls based on their title/tag names with attributes?

icon

Best answer by debbiatsafe 21 April 2022, 00:00

View original

2 replies

Userlevel 2
Badge +17

Hi @canerakin​ 

The Microsoft Word writer does not have this functionality natively.

Since you are working with .docx files and this format is part of Open Office XML, it should be possible to unzip the .docx file and directly manipulate the XML files contained within the zip. The folders and files should be zipped afterwards.

I've included an example workspace of this method and I hope it helps.

Badge +4

Hi @canerakin​ 

The Microsoft Word writer does not have this functionality natively.

Since you are working with .docx files and this format is part of Open Office XML, it should be possible to unzip the .docx file and directly manipulate the XML files contained within the zip. The folders and files should be zipped afterwards.

I've included an example workspace of this method and I hope it helps.

Hi Debbie,

Thanks a lot for this example. I've actually prepared a python script with docxtpl library. However I feel like your example can be more sustainable in the long run. Appreciated!

Reply