spraveenk90 Posted December 1, 2016 Share Posted December 1, 2016 JAVA Code generating report : final Map<String, Object> params = new HashMap<>();final com.pojos.jasper.ReportDataExport obj = new com. pojos.jasper.ReportDataExport(Export); params.put(DETAIL_REPORT, obj);[/code]final InputStream inputStream = loadFolderTemplate(TEMPLATE); final JasperPrint jasperPrint = JasperFillManager.fillReport(inputStream, params);final byte[] exportedReport = JasperExportManager.exportReportToPdf(jasperPrint);[/code]Code in java bean: ReportDataExport.Javapublic List<String> getdetails() {List<String> datalist = new ArrayList<>();final int size1 = Export.getdetails().getdata().getdata().size(); for (int i = 0; i <= size1; i++) [/code]{final String data = Export.getdetails().getdata().getdata().get(i).getLongName();datalist.add(data); } return datalist; }[/code]public getname() { final com.export.pojos.jasper.DataExport names = Export.getdetails().getdata().getdata(); return names; }[/code]Soruce code:Mailreport.jrxml<parameter name="DETAIL_REPORT" class="com.pojos.jasper.ReportDataExport"/>[/code]<textFieldExpression><![CDATA["Display " +$P{ DETAIL_REPORT }. getdetails () +”Names” +$P{ DETAIL_REPORT }.getname()]]></textFieldExpression> </textField>[/code]<componentElement><reportElement x="235" y="602" width="200" height="200" uuid="3034abb7-4b3b-4cc5-aa0e-bbdfc1575d10"> [/code]property name="com.jaspersoft.studio.layout" value="com.jaspersoft.studio.editor.layout.VerticalRowLayout"/> <property name="com.jaspersoft.studio.table.style.table_header" value="Table_TH"/> [/code]<property name="com.jaspersoft.studio.table.style.column_header" value="Table_CH"/><property name="com.jaspersoft.studio.table.style.detail" value="Table_TD"/> </reportElement>[/code]<jr:table xmlns:jr="http://jasperreports.sourceforge.net/jasperreports/components" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports/components http://jasperreports.sourceforge.net/xsd/components.xsd"> [/code]<datasetRun subDataset="ExportData" uuid="cbbcef17-97bf-4037-b18b-82720b679991"> <dataSourceExpression><![CDATA[new net.sf.jasperreports.engine.JREmptyDataSource()]]></dataSourceExpression> [/code]</datasetRun> <jr:column width="40" uuid="9146baba-0612-4aaf-91be-5ff91456a1cb"> <jr:tableHeader style="Table_TH" height="30"/><jr:tableFooter style="Table_TH" height="30"/> r:columnHeader style="Table_CH" height="30"/> [/code]<jr:columnFooter style="Table_CH" height="30"/><jr:detailCell style="Table_TD" height="30"/> </jr:column> </jr:table> </componentElement> </band> </title></jasperReport>[/code] I got a output as Data [xxx,yyy] Names[Thomas,Riche]I need to return the datalist() and getname() in table format with column name “DATA” and “NAME” and Table needs to be adjusted automatically if datalist() and getname() returns large value.I droped a table icon inside report and 1. Create new datasource with name Dataset1. Next it showed empty dataset without any field. Don’t know how to proceed with. Please help me out.I saw some tutorail but its for ireport to create beandatasoruce. Appreciate your early response. 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