i using jasperreports , cannot find way create consecutive tables. when first 1 filled in, next 1 cover instead of being shifted.
did face problem before?
update
i using subreport 2 detail bands , 1 table each of detail bands.
so far generate page parent report subreport area blank.
this code interact reports:
try { hashmap param = new hashmap(); jrbeancollectiondatasource tablea = new jrbeancollectiondatasource(tableaitems); param.put("atabledatasource", tablea); jrbeancollectiondatasource tableb = new jrbeancollectiondatasource(tablebitems); param.put("btabledatasource", tableb); param.put("tableheada","table header"); param.put("column1ahead","a col 1"); param.put("column2ahead","a col 2"); param.put("column3ahead","a col 3"); param.put("header","sample report"); param.put("thedetails", "the details"); param.put("detail1label", "detail band 1"); param.put("detail2label", "detail band 2"); inputstream parent = main.class.getresourceasstream("/sample_parent.jasper"); jasperprint jpparent = jasperfillmanager.fillreport(parent, param, new jremptydatasource(1)); jasperexportmanager.exportreporttopdffile(jpparent, "c:\\reports\\samplereport.pdf"); } catch (jrexception e) { e.printstacktrace(); }
as usual, sample code uploaded github repo linked below.
github repo: https://github.com/michaelknight/jaspertest.git
your immediate problem frame containing jr:table
not have positiontype="float"
, have set jr:table
need set frame).
however better control , achieve desired layout (since have tables right), consider create 2 subreport.
pass subreport new jremptydatasource(1)
datasource generate 1 record detail band , parameter map, parameter $p{b3questionsdatasource}
etc. in subreport.
subreport, containing table a,b in image, either put them on below each other or use multiple detail band's
<detail> <band height="50"> ... table 1 .... </band> <band height="50"> ... table 2 .... </band> </detail>
sub report, table c , new table d (as in example above).
in main report included subreport's on next each other.
example
<subreport> <reportelement x="0" y="20" width="400" height="20" uuid="a7a89ebb-54d4-4b6e-8c9f-c107e8a40bbb"/> <parametersmapexpression><![cdata[$p{report_parameters_map}]]></parametersmapexpression> <datasourceexpression><![cdata[new net.sf.jasperreports.engine.jremptydatasource(1)]]></datasourceexpression> <subreportexpression><![cdata[$p{subreport_dir} + "subreport1.jasper"]]></subreportexpression> </subreport>
Comments
Post a Comment