cuba-platform / reports

CUBA Reports Addon
https://www.cuba-platform.com/
Apache License 2.0
9 stars 4 forks source link

WordWrap settings of XLSX report template are ignored #42

Open haulmont-git opened 6 years ago

haulmont-git commented 6 years ago

Report Generator cannot adjust row height to its content.WordWrap settings are ignored. Hard-coded row height works, but it's not adjustable.

See the sample attached and the source link on the right.


Original issue: https://youtrack.haulmont.com/issue/PL-9905

ghost commented 6 years ago

Hi! Made some research on the issue. By far the most optimal way to achieve the goal is to use OO to optimize row height. There is TableRow interface (https://www.openoffice.org/api/docs/common/ref/com/sun/star/table/TableRow.html) but it looks as if it is not easy to call, whereas it does the job.

Another possible approach is to use a BASIC macro which uses the same TableRow. The following code works well, all we have to do is call it after report generation.

sub OptimalHeight

Dim Doc As Object
Dim Sheet As Object
Dim Row As Object
Dim Col As Object
Dim I As Integer

Doc = ThisComponent
Sheet = Doc.Sheets(0)

For I = 0 To 20
   Row = Sheet.Rows(I)
   Row.OptimalHeight = True
Next I

end sub

Any thoughts?