jang888 Posted January 21, 2010 Share Posted January 21, 2010 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 More sharing options...
mrcaffeine Posted January 22, 2010 Share Posted January 22, 2010 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 More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now