Skip to main content
Solved

Populate MS-Word Template Bookmarks/Content Controls with Attributes


canerakin
Contributor
Forum|alt.badge.img+5

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?

Best answer by debbiatsafe

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.

View original
Did this help you find an answer to your question?

2 replies

debbiatsafe
Safer
Forum|alt.badge.img+20
  • Safer
  • Best Answer
  • April 20, 2022

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.


canerakin
Contributor
Forum|alt.badge.img+5
  • Author
  • Contributor
  • April 21, 2022
debbiatsafe wrote:

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


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings