[Solved] Shape: getting its position and width
[Solved] Shape: getting its position and width
could anyone tell me how given a rectangle drawn on a spreadsheet what the method is for getting its position on the document and the width of it
Last edited by Hagar Delest on Tue Jan 27, 2009 10:47 pm, edited 1 time in total.
Reason: tagged [Solved].
Reason: tagged [Solved].
Re: shape - positioning
Given a single rectangle, this appears to work. If there are several, you would have to know the index of the one you are interested in.
Code: Select all
Sub Main
Dim Doc, Sheet, Rect as Object
Dim Pos as New com.sun.star.awt.Point
Dim Size as New com.sun.star.awt.Size
Doc = ThisComponent
Sheet = Doc.Sheets(0)
Rect = Sheet.DrawPage.getByIndex(0)
Pos = Rect.Position
Size = Rect.Size
Print Pos.X
Print Pos.Y
Print Size.Width
Print Size.Height
End Sub
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.