Page object?

Discuss the word processor

Page object?

Postby Shadowskull1247 » Fri Jun 28, 2019 1:02 am

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   Expand viewCollapse view
ThisComponent.page


or
Code: Select all   Expand viewCollapse view
ThisComponent.CurrentController.page

or

Code: Select all   Expand viewCollapse view
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
Shadowskull1247
 
Posts: 3
Joined: Fri Jun 28, 2019 12:57 am

Re: Page object?

Postby robleyd » Fri Jun 28, 2019 1:39 am

Cheers
David
Apache OpenOffice Developer Build 4.2.0 9820 - Slackware 14.2 - 64 bit
LibreOffice 6.0.7.3 - Slackware 14.2 - 64 bit
Apache OpenOffice 4.1.4 - Windows 7 Virtual machine
User avatar
robleyd
Moderator
 
Posts: 2984
Joined: Mon Aug 19, 2013 3:47 am
Location: Murbko, Australia

Re: Page object?

Postby Shadowskull1247 » Fri Jun 28, 2019 1:42 am

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
Shadowskull1247
 
Posts: 3
Joined: Fri Jun 28, 2019 12:57 am

Re: Page object?

Postby Zizi64 » Fri Jun 28, 2019 6:21 am

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; LO6.1.6 on Win7-10 x64Prof.
PortableApps, winPenPack: LO3.3.0-6.2.5; AOO4.1.6
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: 8332
Joined: Wed May 26, 2010 7:55 am
Location: Budapest, Hungary

Re: Page object?

Postby Zizi64 » Fri Jun 28, 2019 7:02 am

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 65 times
Tibor Kovacs, Hungary; LO6.1.6 on Win7-10 x64Prof.
PortableApps, winPenPack: LO3.3.0-6.2.5; AOO4.1.6
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: 8332
Joined: Wed May 26, 2010 7:55 am
Location: Budapest, Hungary

Re: Page object?

Postby Shadowskull1247 » Fri Jun 28, 2019 2:01 pm

@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
Shadowskull1247
 
Posts: 3
Joined: Fri Jun 28, 2019 12:57 am

Re: Page object?

Postby Zizi64 » Fri Jun 28, 2019 3:49 pm

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; LO6.1.6 on Win7-10 x64Prof.
PortableApps, winPenPack: LO3.3.0-6.2.5; AOO4.1.6
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: 8332
Joined: Wed May 26, 2010 7:55 am
Location: Budapest, Hungary


Return to Writer

Who is online

Users browsing this forum: No registered users and 30 guests