Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Hello,

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.

Hello,

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.

EDIT:

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.

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

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

Hello,

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.

EDIT:

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.

Sample:

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.

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

Hello,

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.

EDIT:

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.

Sample:

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("com.sun.star.frame.DispatchHelper")
    dispatcher.executeDispatch(document, ".uno:EditDoc", "", 0, Array())
    oTexttable = oreportdoc.Texttables
    oreportdoc.GetCurrentController().Select(oTexttable)
    oName = oTexttable.getByName("Detail")
    oCell=oName.getCellByPosition(2,0)
    oText = oCell.Text
    oCurs = oText.createTextCursor()
    oCurs.gotoEND(True)
    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 five 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).

Hello,

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.

EDIT:

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.

Sample:

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("com.sun.star.frame.DispatchHelper")
    dispatcher.executeDispatch(document, ".uno:EditDoc", "", 0, Array())
    oTexttable = oreportdoc.Texttables
    oreportdoc.GetCurrentController().Select(oTexttable)
    oName = oTexttable.getByName("Detail")
    oCell=oName.getCellByPosition(2,0)
    oText = oCell.Text
    oCurs = oText.createTextCursor()
    oCurs.gotoEND(True)
    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 five 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).