Page object?

Discuss the word processor
Post Reply
Shadowskull1247
Posts: 3
Joined: Fri Jun 28, 2019 12:57 am

Page object?

Post by Shadowskull1247 »

Edit: Crossposted here

Hello,
Is there a page object in Writer that can be accessed via macro?

For example, say I wanted to copy the first page via macro, how would I access the first page object (if a page object exists) to copy it?

Would it be something like:

Code: Select all

ThisComponent.page
or

Code: Select all

ThisComponent.CurrentController.page
or

Code: Select all

ThisComponent.CurrentController.Frame.page
If there is no such thing as a page object, how would I copy all Draw, Images, and objects from the first page?
Last edited by Shadowskull1247 on Fri Jun 28, 2019 2:04 am, edited 2 times in total.
Libreoffice 6.2.3.2 (I know, I know it's not OpenOffice, but macro-wise, is identical. Also, there really isn't much help on their forums on macros. :( )
Windows 8.1
User avatar
robleyd
Moderator
Posts: 5055
Joined: Mon Aug 19, 2013 3:47 am
Location: Murbko, Australia

Re: Page object?

Post by robleyd »

Cheers
David
OS - Slackware 15 64 bit
Apache OpenOffice 4.1.15
LibreOffice 24.2.1.2; SlackBuild for 24.2.1 by Eric Hameleers
Shadowskull1247
Posts: 3
Joined: Fri Jun 28, 2019 12:57 am

Re: Page object?

Post by Shadowskull1247 »

Same question posed at AskLibreOffice.
...and that question was asked by me. I asked two questions at once in hopes of quicker replies. :/
Libreoffice 6.2.3.2 (I know, I know it's not OpenOffice, but macro-wise, is identical. Also, there really isn't much help on their forums on macros. :( )
Windows 8.1
User avatar
Zizi64
Volunteer
Posts: 11352
Joined: Wed May 26, 2010 7:55 am
Location: Budapest, Hungary

Re: Page object?

Post by Zizi64 »

Use a third party Object Inspection Tool, like the XrayTool or the MRI. Then you will able examine the properties, methods of the objects, and their existing child objects.
Tibor Kovacs, Hungary; LO7.5.8 /Win7-10 x64Prof.
PortableApps/winPenPack: LO3.3.0-7.6.2;AOO4.1.14
Please, edit the initial post in the topic: add the word [Solved] at the beginning of the subject line - if your problem has been solved.
User avatar
Zizi64
Volunteer
Posts: 11352
Joined: Wed May 26, 2010 7:55 am
Location: Budapest, Hungary

Re: Page object?

Post by Zizi64 »

The graphical objects located on one huge draw page (similar as a layer in the Draw) in the Writer documents.

You can get the objects located on this DrawPage, and you can determine, how they are anchored. If they are anchored to a page, the - I think it - there is some method to determine which page they are anchored to.
But when they are anchored to a paragraph, or to a character, or as a character, the location of the graphical object is not "constant": it will move with the text flow.
Drawpages in Writer.odt
(11.52 KiB) Downloaded 180 times
Tibor Kovacs, Hungary; LO7.5.8 /Win7-10 x64Prof.
PortableApps/winPenPack: LO3.3.0-7.6.2;AOO4.1.14
Please, edit the initial post in the topic: add the word [Solved] at the beginning of the subject line - if your problem has been solved.
Shadowskull1247
Posts: 3
Joined: Fri Jun 28, 2019 12:57 am

Re: Page object?

Post by Shadowskull1247 »

@Zizi64 I was aware of the Draw page, I just figured there would be some page object to access that would get all objects on that page (as well as a partial Draw page) because that would seem convenient to structure a Writer document like that. Perhaps I am incorrect with my assumption. It seems there is no way to easily pull objects and data from an individual page. It seems Writer formats its documents on a constant scroll of text and ignores the concept of pages (unless printing). I'd assume I would have to select each individual object and Draw object on the page and duplicate them (and maybe reanchor some Draw objects). Only problem: how would I access individual objects on my document that are NOT Draw objects?

P.S. I'll try out Xray and MRI.
Libreoffice 6.2.3.2 (I know, I know it's not OpenOffice, but macro-wise, is identical. Also, there really isn't much help on their forums on macros. :( )
Windows 8.1
User avatar
Zizi64
Volunteer
Posts: 11352
Joined: Wed May 26, 2010 7:55 am
Location: Budapest, Hungary

Re: Page object?

Post by Zizi64 »

Only problem: how would I access individual objects on my document that are NOT Draw objects?
Do you mean the text objects: paragraphs, sections, tables?
You can get the paragraphs by index number.

All of the graphs/charts, button, checkboxes, and other form control elements, and the shapes, images are graphical objects, and they are located on the Draw Page. You can get
- type
- name
- relative position to the anchor point
- and many more other properties
of them.


Install and use one of object inspection tools.
Tibor Kovacs, Hungary; LO7.5.8 /Win7-10 x64Prof.
PortableApps/winPenPack: LO3.3.0-7.6.2;AOO4.1.14
Please, edit the initial post in the topic: add the word [Solved] at the beginning of the subject line - if your problem has been solved.
Post Reply