prosvet Posted July 17, 2012 Share Posted July 17, 2012 Sorry if the a similar question was already answered, but I have not found the answer.I have main report with many subreports that should be reordered at print time according to user preferences.What is missing between ellipses (cf. code), are lines that would allow me to access subreports and whether change their source path, or move inside reportSource before compilation.Thanks in advanceIgor Code: Post Edited by prosvet at 07/17/2012 15:45 Link to comment Share on other sites More sharing options...
prosvet Posted August 8, 2012 Author Share Posted August 8, 2012 Finally, I have managed to do what I want. In case if someone later has the same problem, here's the code (just to give an idea):Code:String sourceLocation = "main_report_location"JasperDesign reportSource = JRXmlLoader.load(sourceLocation);JRDesignSubreport subReportDesign = null;JRExpression jrExpression = null;JRElement[] jrElements = ((JRDesignBand) reportSource.getDetailSection().getBands()[0]).getElements();for (JRElement jrElement : jrElements) { if (jrElement instanceof JRDesignSubreport) { subReportDesign = (JRDesignSubreport) jrElement; jrExpression = subReportDesign.getExpression(); [...handle expression contents here...] subReportDesign.setExpression(); }}ByteArrayOutputStream reportOutStream = new ByteArrayOutputStream();JasperCompileManager.compileReportToStream(reportSource, reportOutStream);returnStream = new ByteArrayInputStream(reportOutStream.toByteArray()); 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