Re: How do I open/populate a Writer “master document” programmatically?

Jens Tröger jens.troeger at
Mon Mar 26 22:01:58 UTC 2018

> On Mar 26, 2018, at 21:32, Caolán McNamara <caolanm at> wrote:
>> This email is a repost of the same question to the AOO forums: in
>> short, I’d like to open a Writer “Master Document” programmatically,
>> and then load multiple files into that document to iterate over all
>> of their contents. I haven’t quite figured out how to open that
>> Master Document though: is it a predefined URL argument to
>> loadComponentFromURL() like e.g. private:factory/swriter?
> private:factory/swriter/GlobalDocument should do it I think

Thank you Caolán, that worked.

However, when I tried to load and concatenate multiple documents into that “Master Document” using loadComponentFromURL() it didn’t quite work. Using “_default” as the target frame name created several new documents, “_self” and “_top” had no effect, and “_parent” seemed to load a document into that Master Document but then was replaced—not appended—by the next load.

What I’m trying to achieve is:

   • open a Master Document; then
   • load multiple documents into it, one following the next, essentially _concatenating_ multiple documents; then
   • iterate over the Master Document’s content as if it were a single document.


Jens Tröger

More information about the LibreOffice mailing list