There are many kinds of objects which have a
.Size property. Some have additional similar properties using different units.
A
com.sun.star.Sheet.SheetCellRange has a
.Size of type
com.sun.star.awt.Size . The used unit is "by concept" 10 µm (0.01 mm), but the relation to the actual size on screen or in print may depend.
Code: Select all
Sub showSizeOf(Optional pObj)
REM Only a primitive demo which can't treat selctions returned as containers.
If IsMissing(pObj) Then pObj = ThisComponent.CurrentSelection
sz = tryGetSize(ThisComponent.CurrentSelection)
If NOT IsNull(sz) Then
With sz
MsgBox("(Width;Height)=(" & .Width & ";" & .Height & ")")
End With
Else
MsgBox("Selected object has no 'Size'.")
EndIf
End Sub
Function tryGetSize(pObj) As Object
On Local Error Goto fail
tryGetSize = pObj.Size
fail:
End Function
===Editing, @FJCC===
Sorry. I missed to emphasize that
is one of the services knowing the .Size property in the above mentioned sense.
On Windows 10: LibreOffice 24.2 (new numbering) and older versions, PortableOpenOffice 4.1.7 and older, StarOffice 5.2
---
Lupp from München