Programmatically headless search and replace

Writing a book, Automating Document Production - Discuss your special needs here

Programmatically headless search and replace

Postby gersonfs » Thu Mar 15, 2018 2:17 pm

Hello!

I need to use find and replace via headless, but I have not found a way to do that.
Currently I uncompressed a .docx file and try to locate and replace it directly in the xml file, but often there are tags being opened and closed in the middle of my search string.

I have a template .docx file, and I need to replace certain strings with others, for example a lease, where I need to put name, address and other information via programming.

How i can do it?
OpenOffice 4 on CentOS 7
gersonfs
 
Posts: 3
Joined: Thu Mar 15, 2018 2:02 pm

Re: Programmatically headless search and replace

Postby RoryOF » Thu Mar 15, 2018 2:38 pm

You could use User defined fields; see this article for some helpful information
https://www.techrepublic.com/blog/linux-and-open-source/three-great-ways-to-use-variables-in-libreoffice-and-openoffice/

I am not certain that "headless" is the way to go - there might be too many substitute fields for convenient and reliable handling.
Apache OpenOffice 4.1.6 on Xubuntu 18.04.2 (mostly 64 bit version) and very infrequently on Win2K/XP
User avatar
RoryOF
Moderator
 
Posts: 29082
Joined: Sat Jan 31, 2009 9:30 pm
Location: Ireland

Re: Programmatically headless search and replace

Postby gersonfs » Thu Mar 15, 2018 2:44 pm

Thanks RoryOF

Any bookmark / variable that I could find directly in the file word / document.xml would already work perfectly.
OpenOffice 4 on CentOS 7
gersonfs
 
Posts: 3
Joined: Thu Mar 15, 2018 2:02 pm

Re: Programmatically headless search and replace

Postby gersonfs » Thu Mar 15, 2018 3:15 pm

I'm looking to use mono + openxml SDK on CentOS
OpenOffice 4 on CentOS 7
gersonfs
 
Posts: 3
Joined: Thu Mar 15, 2018 2:02 pm


Return to Advanced Uses

Who is online

Users browsing this forum: No registered users and 1 guest