Hello,
I need a little help. I would like to find all the frames in a document and retrieve their properties. The properties I would like to get is the size so that I can insert on image to match the frame. I am know how to find a frame if I know the name. But the document that I will be processing will have frames but I will not know the names. The using VB to do the work.
Regards,
Will
[Solved] Finding Frames and there Properties
-
- Posts: 4
- Joined: Fri Dec 08, 2017 6:55 pm
[Solved] Finding Frames and there Properties
Last edited by Hagar Delest on Sun Dec 10, 2017 11:11 pm, edited 1 time in total.
Reason: tagged [Solved].
Reason: tagged [Solved].
OpenOffice 4.1 on windows 10
Re: Finding Frames and there Properties
Here are three ways to iterate over the frames in a document
Code: Select all
oFrames = ThisComponent.TextFrames
'By Index
Cnt =oFrames.Count
For i = 0 to Cnt - 1
Frm = oFrames.getByIndex(i)
print Frm.Name, Frm.Size.Height, Frm.Size.Width
next i
'By Name
aNames = oFrames.ElementNames
For i = 0 to UBound(aNames)
Frm = oFrames.getByName(aNames(i))
print Frm.Name, Frm.Size.Height, Frm.Size.Width
next i
'Enumeration
oEnum = oFrames.createEnumeration()
While oEnum.hasMoreElements
Frm = oEnum.nextElement()
print Frm.Name, Frm.Size.Height, Frm.Size.Width
WEnd
OpenOffice 4.1 on Windows 10 and Linux Mint
If your question is answered, please go to your first post, select the Edit button, and add [Solved] to the beginning of the title.
If your question is answered, please go to your first post, select the Edit button, and add [Solved] to the beginning of the title.
-
- Posts: 4
- Joined: Fri Dec 08, 2017 6:55 pm