Ask Your Question

Can LibreOffice Draw automatically label rectangles with size?

asked 2017-07-10 19:09:27 +0200

ikratins gravatar image

I use LODraw for simple 2-d drafting and would like to solve several problems I have:

  • default text size for labels is too large, 24pt is HUGE
  • individually labeling rectangles with their dimensions is time consuming, especially since I can't seem to change the default text size in a way that stays default
  • I want the size that shows up in the bottom frame of the drawing window to automatically be the label for a drawn rectangle.
edit retag flag offensive close merge delete

2 Answers

Sort by » oldest newest most voted

answered 2017-07-10 20:06:21 +0200

Grantler gravatar image

Look for the query and answers of

There could be some hints for you in them. My suggestion was to use the gallery instead of / additional to other ways of proceeding.

edit flag offensive delete link more

answered 2017-07-11 06:21:41 +0200

librebel gravatar image

Hello @ikratins,

To set the Default font for your Rectangles, do this:

1. Right-click inside your Rectangle and select "Edit Style...",
2. In the dialog that pops up, select the tab called "Font",
3. Set your preferred Font and click "OK".

To automatically insert the dimensions for each Rectangle, you could run the following macro:

Sub SetDrawShapeDimensionLabels()
REM Changes the Text inside all Draw Shapes in the first DrawPage of a Draw document.
REM The new text will display the shape's dimensions as follows: "0.00 x 0.00" ( in Millimeters ).
    Dim oDrawPage As Object, oShape As Object
    Dim strCaption As String, i As Integer
    On Error GoTo Exit_Sub
    oDrawPage = ThisComponent.getDrawPages().getByIndex( 0 )
    For i = 0 To oDrawPage.getCount() - 1
        oShape = oDrawPage.getByIndex( i )
        If oShape.ImplementationName = "SvxShapeText" Then
            strCaption = Format( oShape.Size.Width/100, "0.00" ) & " x " & Format( oShape.Size.Height/100, "0.00" )
            oShape.setString( strCaption )
        End If
End Sub
edit flag offensive delete link more
Login/Signup to Answer

Question Tools

1 follower


Asked: 2017-07-10 19:09:27 +0200

Seen: 348 times

Last updated: Jul 11 '17