2

I am trying to export report to Excel (XLSX format) using jasper report, but get problems with stretching when text field is overflow. I get just empty cells when value of textfield is bigger than textfield size. I tried to use these parameters, but it isn't helping me:

<property name="net.sf.jasperreports.export.xls.collapse.row.span" value="true"/>
<property name="net.sf.jasperreports.print.keep.full.text" value="true"/>
<property name="net.sf.jasperreports.export.xls.detect.cell.type" value="true"/>
<property name="net.sf.jasperreports.export.xls.wrap.text" value="true"/>
<property name="net.sf.jasperreports.export.xls.auto.fit.row" value="true"/>
<property name="net.sf.jasperreports.export.xls.auto.fit.column" value="true"/>

Here is refer to screenshot: http://clip2net.com/s/39cbljj

In HTML it looks ok:

http://c2n.me/39cyhRf

Does anybody know how to fix this? Thanks.

Alex K
  • 22,315
  • 19
  • 108
  • 236
Pavel
  • 21
  • 1
  • 2

3 Answers3

9

you should do the following to get it working:

  1. Set isStretchWithOverflow="true" for all TextField elements on Detail band (it will fix cutting of long text values)
  2. Set stretchType="RelativeToBandHeight" for all TextField elements on Detail band (It will fix the issue with empty cells - all TextFields will be rendered with the same height)
  3. set the property <property name="net.sf.jasperreports.export.xls.auto.fit.row" value="true"/> on each TextField which may have long value. The point is that property net.sf.jasperreports.export.xls.auto.fit.row works on Element level only.Also please note that this property won't work for merged cells.
mike
  • 441
  • 7
  • 9
  • Thanks for your response. I have done 1,2,3 items. But it doesn't help. When I set stretchType="RelativeToBandHeight" for all TextField elements on Detail band I get all empty cells: http://c2n.me/39stiNa. Only 1st and 3rd also doesn't help I get result like in my previuos post. Thanks – Pavel Dec 25 '14 at 18:37
  • Does this issue appear in Excel output only? If so, there are likely overlapped text fields, only this can cause your problem. Please make sure that there is no overlapped fields on detail band. Steps from my comment should work then. Also it would be helpful if you provide your detail band code. – mike Dec 27 '14 at 09:50
  • This worked great for me - long text that was causing cells to magically become merged no longer happens. Thanks! – ununiform Jun 11 '15 at 15:22
0

It works perfect in HTML, but during export in EXCEL format I get problem. I looked stretch sample from jasper reports demo/samples folder and found out solution. I set horizontal alighment textfield parameter to "justify" and it will work in Excel and look perfect. Seems that without this parameter stretch does not work during export to Excel. Thanks for the help, user1390785 !

Pavel
  • 21
  • 1
  • 2
  • Tried, doesn't help (this is a cell in table). What is your vertical alignment setting? – jonny Sep 25 '15 at 13:31
0

I just got same issue and i solved it.

its simple. just open your report properties and set page height to 999999. convert again and see its just solved