lundi 16 novembre 2020

Populate Word Document Template randomly with Python and save filled in Docs

I have been working on MS word document templates which include "INSERT" (placeholder to insert text) and "SELECT" (placeholder to select from dropdown list, which can include INSERT), highlighted in Green as bellow:

enter image description here

What I am trying to ascertain is if there is a relativley painless way using docx,docx2python or other packages to fill in a random number of these fields with random values. Currently I am counting all, finding and replacing dynamically, however this is not random and is defined in VBA. What I am basically trying to do is in the absense of actual data, create a bunch of "synthetic" documents to work with, which have been automatically and "randomly" populated. It can be populated with anything, I have a seperate code which is supposed to be able to seperate the jibberish from the template.




Aucun commentaire:

Enregistrer un commentaire