Macro to replace form control Names and Data fields [closed]

asked 2018-04-18 18:09:28 +0100

fsx96 gravatar image

I am in the process of constructing a very long survey using LibreOffice Writer. The idea is to eventually export the survey to PDF and, after the PDFs have been filled in by the respondents, extract the form control data using pdftk.

The survey is split in three parts, called "A1", "A2", and "A3".

Each section of the survey contains several questions named "Q1, Q2, ... Q100" (starting from 1 in each section).

Each question has a range of answer options, in the form of option buttons, that the respondent can tick. To group the option buttons, each button is given a name in the form control properties according to which section it belongs to, as well as which question number of that section it belongs to. It thus takes on the following naming scheme: "A1.Q1", "A1.Q2", ..., "A3.Q99".

The reference value (on) for each button is the option it represents ("a", "b", or "c").

Now, I have assigned the correct names for all option buttons in section A1. To avoid having to manually assign a new name for each option button, I would ideally like to create A2 and A3 as copies of A1 (in separate documents), and run a macro that substitutes "A1" in the Name field and the Data field of the properties of each option button for "A2", and for "A3". Is this possible (my knowledge of macros is limited)?

Any help with this would be greatly appreciated! I have attached a dummy document corresponding to the structure of section A1 to exemplify my point.C:\fakepath\Section A1.odt

edit retag flag offensive reopen merge delete

Closed for the following reason the question is answered, right answer was accepted by fsx96
close date 2018-04-19 11:32:57.690752

Comments

For anyone who might face the same issue, I have now solved it by saving the odf document as a Flat XML ODF document. Then you can open the file in Notepad++ and search for "form:name" and replace the relevant names.

fsx96 gravatar imagefsx96 ( 2018-04-19 11:32:40 +0100 )edit