Link to home
Start Free TrialLog in
Avatar of srikotesh
srikotesh

asked on

How to pass the SHEET_NAMES dynamically for XLS in jasper reports

Hi Experts,

there are two approached to pass sheet names vaue
1st approach:

JRXlsExporter exporter = new JRXlsExporter(); exporter.setParameter( JRXlsAbstractExporterParameter.SHEET_NAMES, new String[] {"first","second","third"} ); 

Open in new window


cant we pass this value as parameter in java?

this way(1st approach) i am unable to follow because i am sheduling report for a specificdate. and passing few parameter inputs as well for the same report.

sample:
Util.getParamString(stringBuilder, "GENERATEDON", Date);//similarly few more params i am passing

Open in new window


2nd approach:

iam setting in the report properties like below(2nd approach): Property Name = "net.sf.jasperreports.export.xls.sheet.names.all"

 Property Value = "first/second/third"

is there any chance to pass this property value as dynamic.?

I have tried like below as not works for me

<line> 
<reportElement x="0" y="-1" width="1" height="1"> 
<propertyExpression name="net.sf.jasperreports.export.xls.sheet.name"><![CDATA[$F{course_name}]]></propertyExpression> 
</reportElement> 
</line>

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of Jan Louwerens
Jan Louwerens
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial