i having jasper report api 5.0.1. have report having sub report export data in excel format.
when export report in excel, overflowed content of cell cuts down , not able view until resize row height. here snapshot of how looks.
i have checked solution on stackoverflow , jasper report community forum , tried solutions suggested in there. none have worked me.
i tried:
net.sf.jasperreports.print.keep.full.text
true
- set
stretch type
of band elementsrelative band height
but none of options worked me.
can please point out might doing wrong?
if there solution apache poi open apply it, if fixes issue.
update code , jasper report:
jrxml file:
<?xml version="1.0" encoding="utf-8"?> <jasperreport xmlns="http://jasperreports.sourceforge.net/jasperreports" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xsi:schemalocation="http://jasperreports.sourceforge.net/jasperreports http://jasperreports.sourceforge.net/xsd/jasperreport.xsd" name="memberworklisting_subreport" pagewidth="750" pageheight="802" whennodatatype="allsectionsnodetail" columnwidth="750" leftmargin="0" rightmargin="0" topmargin="0" bottommargin="0" uuid="50014970-029e-488c-9e4b-b42b8d743e84"> <property name="ireport.zoom" value="1.0"/> <property name="ireport.x" value="0"/> <property name="ireport.y" value="0"/> <querystring> <![cdata[select * tmp_wk_dtl]]> </querystring> <field name="wk_int_no" class="java.math.bigdecimal"/> <field name="wid_no" class="java.math.bigdecimal"/> <field name="iswc_no" class="java.lang.string"/> <field name="ttl_eng" class="java.lang.string"/> <field name="ttl_local" class="java.lang.string"/> <field name="duration" class="java.sql.timestamp"/> <field name="wk_lg" class="java.lang.string"/> <field name="wk_cat" class="java.lang.string"/> <field name="wk_status" class="java.lang.string"/> <field name="art_name_el" class="java.lang.string"/> <field name="art_name_le" class="java.lang.string"/> <field name="ip_set_no" class="java.math.bigdecimal"/> <field name="ip_int_no" class="java.math.bigdecimal"/> <field name="ip_nametype" class="java.lang.string"/> <field name="ip_wk_role" class="java.lang.string"/> <field name="ip_name_eng" class="java.lang.string"/> <field name="ip_name_local" class="java.lang.string"/> <field name="soc_name" class="java.lang.string"/> <field name="per_own_shr" class="java.math.bigdecimal"/> <field name="per_coll_shr" class="java.math.bigdecimal"/> <field name="mec_own_shr" class="java.math.bigdecimal"/> <field name="mec_coll_shr" class="java.math.bigdecimal"/> <field name="syn_own_shr" class="java.math.bigdecimal"/> <field name="syn_coll_shr" class="java.math.bigdecimal"/> <field name="seq" class="java.math.bigdecimal"/> <field name="agr_no" class="java.math.bigdecimal"/> <variable name="workcount" class="java.lang.integer" incrementtype="group" incrementgroup="internalnogroup"> <variableexpression><![cdata[$v{workcount} + 1]]></variableexpression> <initialvalueexpression><![cdata[0]]></initialvalueexpression> </variable> <group name="internalnogroup"> <groupexpression><![cdata[$f{wk_int_no}]]></groupexpression> </group> <background> <band splittype="stretch"/> </background> <title> <band height="34"> <statictext> <reportelement uuid="6bca70f4-3fc8-42b9-bc88-0b491f747c97" mode="opaque" x="0" y="0" width="80" height="34" backcolor="#c0c0c0"/> <box> <pen linewidth="0.75"/> <toppen linewidth="0.75"/> <leftpen linewidth="0.75"/> <bottompen linewidth="0.75"/> <rightpen linewidth="0.75"/> </box> <textelement textalignment="center" verticalalignment="middle"> <font fontname="arial narrow" isbold="true"/> </textelement> <text><![cdata[ internal no]]></text> </statictext> <statictext> <reportelement uuid="e20675cf-ac73-4baa-95cd-a4ff4a8365c8" mode="opaque" x="80" y="0" width="70" height="34" backcolor="#c0c0c0"/> <box> <pen linewidth="0.75"/> <toppen linewidth="0.75"/> <leftpen linewidth="0.75"/> <bottompen linewidth="0.75"/> <rightpen linewidth="0.75"/> </box> <textelement textalignment="center" verticalalignment="middle"> <font fontname="arial narrow" isbold="true"/> </textelement> <text><![cdata[iswc no]]></text> </statictext> <statictext> <reportelement uuid="c23427f6-11da-4b52-a7dd-df63116c8f6f" mode="opaque" x="150" y="0" width="180" height="34" backcolor="#c0c0c0"/> <box> <pen linewidth="0.75"/> <toppen linewidth="0.75"/> <leftpen linewidth="0.75"/> <bottompen linewidth="0.75"/> <rightpen linewidth="0.75"/> </box> <textelement textalignment="center" verticalalignment="middle"> <font fontname="arial narrow" isbold="true"/> </textelement> <text><![cdata[title]]></text> </statictext> <statictext> <reportelement uuid="9cd3477c-5763-40fe-9565-0dd412830fc2" mode="opaque" x="330" y="0" width="80" height="34" backcolor="#c0c0c0"/> <box> <pen linewidth="0.75"/> <toppen linewidth="0.75"/> <leftpen linewidth="0.75"/> <bottompen linewidth="0.75"/> <rightpen linewidth="0.75"/> </box> <textelement textalignment="center" verticalalignment="middle"> <font fontname="arial narrow" isbold="true"/> </textelement> <text><![cdata[language]]></text> </statictext> <statictext> <reportelement uuid="9863dbce-c990-44b7-b56c-fa8f3bbb0a00" mode="opaque" x="410" y="0" width="80" height="34" backcolor="#c0c0c0"/> <box> <pen linewidth="0.75"/> <toppen linewidth="0.75"/> <leftpen linewidth="0.75"/> <bottompen linewidth="0.75"/> <rightpen linewidth="0.75"/> </box> <textelement textalignment="center" verticalalignment="middle"> <font fontname="arial narrow" isbold="true"/> </textelement> <text><![cdata[category]]></text> </statictext> <statictext> <reportelement uuid="3baef4d4-aaf6-4024-9ebd-d47bdf348871" mode="opaque" x="490" y="0" width="80" height="34" backcolor="#c0c0c0"/> <box> <pen linewidth="0.75"/> <toppen linewidth="0.75"/> <leftpen linewidth="0.75"/> <bottompen linewidth="0.75"/> <rightpen linewidth="0.75"/> </box> <textelement textalignment="center" verticalalignment="middle"> <font fontname="arial narrow" isbold="true"/> </textelement> <text><![cdata[status]]></text> </statictext> <statictext> <reportelement uuid="72f3706d-885b-4a44-9608-bea5afe6186e" mode="opaque" x="570" y="0" width="180" height="34" backcolor="#c0c0c0"/> <box> <pen linewidth="0.75"/> <toppen linewidth="0.75"/> <leftpen linewidth="0.75"/> <bottompen linewidth="0.75"/> <rightpen linewidth="0.75"/> </box> <textelement textalignment="center" verticalalignment="middle"> <font fontname="arial narrow" isbold="true"/> </textelement> <text><![cdata[artiste]]></text> </statictext> </band> </title> <detail> <band height="15" splittype="stretch"> <textfield isstretchwithoverflow="true" isblankwhennull="true"> <reportelement uuid="660806ed-1806-4020-9a0f-c14408440422" stretchtype="relativetobandheight" isprintrepeatedvalues="false" x="0" y="0" width="80" height="15"/> <textelement textalignment="right" verticalalignment="top"> <font fontname="arial narrow"/> </textelement> <textfieldexpression><![cdata[$f{wk_int_no}]]></textfieldexpression> </textfield> <textfield isstretchwithoverflow="true" isblankwhennull="true"> <reportelement uuid="ad71b230-bfa8-480e-93c1-ccc6e48f57c5" stretchtype="relativetobandheight" isprintrepeatedvalues="false" x="80" y="0" width="70" height="15"/> <textelement> <font fontname="arial narrow"/> </textelement> <textfieldexpression><![cdata[$f{iswc_no}]]></textfieldexpression> </textfield> <textfield isstretchwithoverflow="true" isblankwhennull="true"> <reportelement uuid="eec7d04e-6f4c-4b28-a3fe-8a3433339d14" stretchtype="relativetobandheight" isprintrepeatedvalues="false" x="150" y="0" width="180" height="15"/> <textelement> <font fontname="arial narrow"/> </textelement> <textfieldexpression><![cdata[$f{ttl_eng}]]></textfieldexpression> </textfield> <textfield isstretchwithoverflow="true" isblankwhennull="true"> <reportelement uuid="d53915b9-edb6-439d-bec5-fd6231043a37" stretchtype="relativetobandheight" isprintrepeatedvalues="false" x="330" y="0" width="80" height="15"/> <textelement> <font fontname="arial narrow"/> </textelement> <textfieldexpression><![cdata[$f{wk_lg}]]></textfieldexpression> </textfield> <textfield isstretchwithoverflow="true" isblankwhennull="true"> <reportelement uuid="30e29311-5da3-481f-bb34-d78e4b5b7510" stretchtype="relativetobandheight" isprintrepeatedvalues="false" x="410" y="0" width="80" height="15"/> <textelement> <font fontname="arial narrow"/> </textelement> <textfieldexpression><![cdata[$f{wk_cat}]]></textfieldexpression> </textfield> <textfield isstretchwithoverflow="true" isblankwhennull="true"> <reportelement uuid="375efa25-af3b-4699-9a75-56998b52b62e" stretchtype="relativetobandheight" isprintrepeatedvalues="false" x="490" y="0" width="80" height="15"/> <textelement> <font fontname="arial narrow"/> </textelement> <textfieldexpression><![cdata[$f{wk_status}]]></textfieldexpression> </textfield> <textfield isstretchwithoverflow="true" isblankwhennull="true"> <reportelement uuid="ee80e636-4a4c-4fbf-90c0-fc61d8c0b894" stretchtype="relativetobandheight" isprintrepeatedvalues="false" x="570" y="0" width="180" height="15"/> <textelement> <font fontname="arial narrow"/> </textelement> <textfieldexpression><![cdata[$f{art_name_el}]]></textfieldexpression> </textfield> </band> </detail> </jasperreport>
export code:
jaspercompilemanager.compilereporttofile(jrxmlfile, jasperfile); jasperprint jasperprint = jasperfillmanager.fillreport(jasperfile, reportparameter, dbconnection); jrxlsexporter exporterxls = new jrxlsexporter(); exporterxls.setparameter(jrexporterparameter.jasper_print, jasperprint); exporterxls.setparameter(jrexporterparameter.output_file_name, reportfile); exporterxls.setparameter(jrexporterparameter.ignore_page_margins,boolean.true); exporterxls.setparameter(jrxlsexporterparameter.is_remove_empty_space_between_rows, boolean.true); exporterxls.setparameter(jrxlsexporterparameter.is_detect_cell_type, boolean.true); exporterxls.setparameter(jrxlsexporterparameter.is_remove_empty_space_between_columns, boolean.true); exporterxls.exportreport();
in order export excel, should prepare reports following of guidelines wrote down here: making html, xls or csv friendly reports
it's possible of elements composing report bit overlapping or not aligned.
thanks...! hope working :)
Comments
Post a Comment