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

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 close merge delete

Sort by » oldest newest most voted

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

more

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.)

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
fail:
End Sub

more