Page 1 of 1

Page object?

Posted: Fri Jun 28, 2019 1:02 am
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?

Re: Page object?

Posted: Fri Jun 28, 2019 1:39 am
by robleyd

Re: Page object?

Posted: Fri Jun 28, 2019 1:42 am
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. :/

Re: Page object?

Posted: Fri Jun 28, 2019 6:21 am
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.

Re: Page object?

Posted: Fri Jun 28, 2019 7:02 am
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 191 times

Re: Page object?

Posted: Fri Jun 28, 2019 2:01 pm
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.

Re: Page object?

Posted: Fri Jun 28, 2019 3:49 pm
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.