Ask Your Question

set a text box width from left margin to right page margin

asked 2020-02-12 19:32:25 +0100

Parthica gravatar image

As title say. I have a text box and I want its width to be equal to the distance between the left and right margin of the page. Can i achieve this without having to manually adjust the width variable?

edit retag flag offensive close merge delete

2 Answers

Sort by » oldest newest most voted

answered 2020-02-13 01:42:06 +0100

Regina gravatar image

Why not use a frame instead of the text box? For a frame you can set the width relative 100% to page.

edit flag offensive delete link more

answered 2020-02-12 21:08:53 +0100

Lupp gravatar image

updated 2020-02-12 21:15:31 +0100

I don't think there is or will be one day a special tool for what you think to need. You will have to actually do this for your shapes (may be textboxes) one by one or to write user code for the task. (Then add it to a toolbar or a menu.)

You may start with this raw draft:

Sub alignObjectsLeftAndSetToAvailableWidth()
REM This code is very raw. There is not a bit of error catching.
REM Probable or expectable malfunctions are not analyzed!
On Local Error Goto fail
cSel                    = ThisComponent.CurrentSelection
u                       = cSel.Count - 1
For j = 0 To u
j_Object                = cSel(j)
With j_Object
  .HoriOrient             = 1
  shSize                  = .getSize
  availableWidth          = .HoriOrientPosition + shSize.Width
  .HoriOrient             = 0
  .HoriOrientPosition     = 0
  shSize.Width            = availableWidth
  .Size                   = shSize
End With
Next j
End Sub
edit flag offensive delete link more
Login/Signup to Answer

Question Tools

1 follower


Asked: 2020-02-12 19:32:25 +0100

Seen: 23 times

Last updated: Feb 13