if (jrDetailObj instanceof JRDesignSubreport) {
\\codes
}
can anyone please tell me how to get the instance of sub report from jasper
if (jrDetailObj instanceof JRDesignSubreport) {
\\codes
}
can anyone please tell me how to get the instance of sub report from jasper
Assuming from the code in your question that you have already found the JrDesignSubreport
object, you just need to call getExpression()
to get the path to the file and then load it into a JasperDesign
object.
I think the code below should do it, provided that your subreport expression is just a simple path to the design and not an expression that needs to be evaluated.
if (jrDetailObj instanceof JRDesignSubreport) {
String subReportExpression = ((JRDesignSubreport)jrDetailObj).getExpression().getText();
JasperDesign subReport = JRXmlLoader.load(subReportExpression);
}
Yes GenericJon , but when in trying to print the details in Excel sheet where we are trying to get the instance of JRDesignSubreport its not returing the instance of it only so its not printing the value fro subreport