Page 1 of 1

[Solved] Headsup on importing Base into Writer

PostPosted: Fri Nov 02, 2018 10:23 am
by victusinambitus
I'm trying to import Base data into a Writer document. I have an odb database which I can create & understand reports and queries. I can register the Base file in Writer and F4 ok to see it connected. What I cannot determine is how to do the equivalent to a Mail Merge of my database into one document. I'm missing a step of logic in how to achieve this. My desired output (in HTML for demo purposes here only) would be something like
[record 1]
<table>[field1]<br>[field2]</table>
[page break]

[record 2]
<table>[field1]<br>[field2]</table>
[page break]
etc

Any clues where I can look to find help/instructions for this kind of output?
The closest I can get is to drag a query into the document and output as text, but I wish to format around the text.
Thanks in advance

Re: Headsup on importing Base into Writer

PostPosted: Fri Nov 02, 2018 1:37 pm
by Villeroy
Install the report builder extension. It can split database reports by means of page breaks. A database report is always stored within a Base document. However, after running a report the result can be stored as a stand-alone Writer document or PDF or any other text document format.
You have to group the record set by some field and then check the "keep together" property of that group. See documentation of the report builder extension. The tool is not trivial.

The extension for OpenOffice: https://extensions.openoffice.org/en/pr ... rt-builder
Here you find documentation on LibreOffice Base. LibreOffice comes with the report builder preinstalled: https://documentation.libreoffice.org/e ... tion/base/

This summer I wrote a macro which can split a report into multiple stand-alone text documents: https://forum.openoffice.org/en/forum/v ... 00&t=94514 (not trivial but should work with OpenOffice's "old style reports" as well)

Re: Headsup on importing Base into Writer

PostPosted: Fri Nov 02, 2018 8:18 pm
by MrProgrammer
victusinambitus wrote:I'm trying to import Base data into a Writer document. … What I cannot determine is how to do the equivalent to a Mail Merge of my database into one document. … My desired output … would be something like <table>[field1]<br>[field2]</table>.
Create a Writer document with the pattern you want, which in this case seems to be <table><br></table>. Use View → Data Sources and nagivate to your table. Drag the Field1 and Field2 headers at the top of the screen down into your Writer document and drop them into <table>◊<br> and into <br>◊</table> where the diamond shows the destination for the drop. File → Print → Form letter → Yes → Records → All → Output → File → Single document → OK.

Read about Mail Merge in Help → Index or in User Guides (PDF) or searching for topics about it in the forum.

If this solved your problem please go to your first post use the Edit button and add [Solved] to the start of the title. You can select the green checkmark icon at the same time.

Re: Headsup on importing Base into Writer

PostPosted: Fri Nov 02, 2018 11:00 pm
by victusinambitus
Thank you MrProgrammer
That was the part I was missing exactly - you need to Print to File in order to get the merging function. Couldn't find that in the instructions/tutorials I was perusing.
Much appreciated!