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

classic Classic list List threaded Threaded
3 messages Options
Jens Tröger Jens Tröger
Reply | Threaded
Open this post in threaded view
|

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

Hello,

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?

There’s a bit more detail here: https://forum.openoffice.org/en/forum/viewtopic.php?f=45&t=92922

Thanks!
Jens

--
Jens Tröger
http://savage.light-speed.de/

_______________________________________________
LibreOffice mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/libreoffice
Caolán McNamara Caolán McNamara
Reply | Threaded
Open this post in threaded view
|

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

On Mon, 2018-03-26 at 09:36 +1000, Jens Tröger wrote:
> Hello,
>
> 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
_______________________________________________
LibreOffice mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/libreoffice
Jens Tröger Jens Tröger
Reply | Threaded
Open this post in threaded view
|

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


> On Mar 26, 2018, at 21:32, Caolán McNamara <[hidden email]> 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.

Cheers,
Jens

--
Jens Tröger
http://savage.light-speed.de/

_______________________________________________
LibreOffice mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/libreoffice