Read text file and insert to field object in other text file

Writing a book, Automating Document Production - Discuss your special needs here
Post Reply
zamuel
Posts: 1
Joined: Thu Sep 08, 2016 9:03 am

Read text file and insert to field object in other text file

Post by zamuel »

Hello all.

I am new to Open Office scripting and would like to ask some help. Ultimately I would like to accomplish following:
I would like to read text line from a simple text file and place it to several field object in open office document draft. Basically the text file would have several lines where each line would be placed to different fields in the actual document. I am not restricted to use certain format or extension of document or file so everything can be considered.

I have trouble of finding information of how to accomplish this, or maybe I am just looking to wrong places. Any help on this would be appreciated?

Thanks in advance.
Sami - Windows 10, Open office 4.1.2
User avatar
Villeroy
Volunteer
Posts: 31279
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany

Re: Read text file and insert to field object in other text

Post by Villeroy »

Connect a new database document to the directory where the text file is stored with possibly other text files of the same structure.
File>New>Database...
[X] Connect to existing
Type: "Text"
Specify import details
[X] Register database
Save database

In Writer hit F4, select the right text file on the left and drag column headers from the right into your document. This will create the linked fields. You can also insert the database fields via Insert>Fields...
When you print the mail merge document you can print documents for all records, filtered records or selected records and choose between printer, file and multiple files as output.
Please, edit this topic's initial post and add "[Solved]" to the subject line if your problem has been solved.
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice
Post Reply