Ask Your Question

Base, report, text fields : variable height [closed]

asked 2017-10-29 17:10:18 +0200

Denis_R gravatar image

updated 2017-10-29 19:27:24 +0200


Using Base and ReportBuilder, I want to insert a text field that contains comments. But the comment length is variable and I would like the field height to vary according to the text length.

How can I do that ?


edit retag flag offensive reopen merge delete

Closed for the following reason the question is answered, right answer was accepted by Alex Kemp
close date 2021-02-09 02:30:15.715166

2 Answers

Sort by » oldest newest most voted

answered 2017-10-29 19:46:03 +0200

Ratslinger gravatar image

updated 2017-12-13 07:23:46 +0200


I don't see any way in doing what you want without possibly some extensive macro coding. None of the report writers I use appear to have this capability although there are some limited options.

In your case, only what will fit within the field will be in the result.


Had a moment to do more research. Turns out Jaspersoft Studio has this function already. It is a simple setting on the field - "Stretch with Overflow". Since I don't print much or have had any need for this function I never knew it was there.


Not stretched: image description

With stretched: image description

Just one other note, you cannot use this if running an Embedded DB. Any other should work as you connect to DB via JDBC connector.

BTW - I believe Report Builder is much more than 10 yrs now but has seen little if any mods in some time.

Edit 12/12/2017:

@Denis_R Saw again your link to the other post. Have had that entire code (posted code is small portion - all code is quite imense & somewhat complex!) for a while now but decided to give it a whirl to take my mind off another large project.

Spent a few hours to get one field on one row to expand successfully. Here was the result using Report Builder:

image description

This report was run entirely from a macro. Here is the code used:

Sub SetHeaderAutofit2
    ocontroller = Thisdatabasedocument.currentController
    if not ocontroller.isconnected then ocontroller.connect
    oreportdoc = Thisdatabasedocument.reportdocuments.getbyname("Report1").open
    document   = oreportdoc.CurrentController.Frame
    dispatcher = createUnoService("")
    dispatcher.executeDispatch(document, ".uno:EditDoc", "", 0, Array())
    oTexttable = oreportdoc.Texttables
    oName = oTexttable.getByName("Detail")
    oText = oCell.Text
    oCurs = oText.createTextCursor()
    oName.getRows().getByIndex(0).IsAutoHeight = True    
End Sub

What makes this so difficult is that you have to configure what & where to expand because you need to work with the output document in edit mode. This means working with a text table (similar to calc) and locate specific cells. The last six lines (before End Sub) were specific to the single field and would be what needs repetition. The rest of the lines were just to get there.

So the code you pointed to works with some slight modifications (it was written for AOO older version) but it is a bear to implement. In my opinion, Jaspersoft was much easier to get running than to use this method.

If this answers your question please click on the ✔ (upper left area of answer).

edit flag offensive delete link more


My DB is embedded in LibreOffice ... and I moved from Ms Access to OpenOffice when I found the Sun Report Builder, 10 years ago :)

Since then I have reports with a text field that is either too big or too small ! But I professionally used report builder with such a functionality, sure.

Waiting for another 10 years ? :D

Denis_R gravatar imageDenis_R ( 2017-10-30 09:20:52 +0200 )edit

answered 2017-10-29 21:11:02 +0200

Denis_R gravatar image


Thanks for the answer. It's something I am waiting since 10 years with the 1st Sun Report Builder ... Strange that nobody has such a need.

I found something here but I don't know how to apply that in my report. I will search ...


edit flag offensive delete link more

Question Tools


Asked: 2017-10-29 17:10:18 +0200

Seen: 1,047 times

Last updated: Dec 13 '17