Jump to content
JasperReports Library 7.0 is now available ×

Distinguish the output format in jrxml


jang888

Recommended Posts

 Hi,

Is there anyway that I can distinguish the output format (xls, pdf, csv,..) in jrxml. I need to apply different pattern for each output format.

 

 
Thank you for your help.
 
Code:
<textField isStretchWithOverflow="true" isBlankWhenNull="true"><reportElement key="textField" style="detail" x="1290" y="0" width="90" height="18" stretchType="RelativeToTallestObject"><printWhenExpression>new Boolean({OUTPUT_FORMAT}.equals("EXCEL"))</printWhenExpression></reportElement><textFieldExpression class="java.lang.Double"><![CDATA[new DecimalFormat("#,##0.0000")).format($F{test}]]></textFieldExpression></textField>  <textField isStretchWithOverflow="true" isBlankWhenNull="true"><reportElement key="textField" style="detail" x="1290" y="0" width="90" height="18" stretchType="RelativeToTallestObject"><printWhenExpression>new Boolean({OUTPUT_FORMAT}.equals("PDF"))</printWhenExpression></reportElement><textFieldExpression class="java.lang.Double"><![CDATA[new DecimalFormat("#,##0.00")).format($F{test}]]></textFieldExpression></textField>
Link to comment
Share on other sites

  • Replies 1
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

AFAIK you would need to customize the exporter (changing the source code). then you could e. g. add custom properties in the JRXML and handle these while exporting.

 

background: while generating the JRXML it gets filled with data and all expression get evaluated. The resulting object is JasperPrint which is the meta-output file. The standard customizer processes this file and writes it in the desired output format.

 

none of the standard exporters has the option to hide a specific element. You might want to raise a feature request in bugzilla for a export format specific property to hide elements.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...