Jump to content
We've recently updated our Privacy Statement, available here ×

giulio.carlacci

Members
  • Posts

    4
  • Joined

  • Last visited

giulio.carlacci's Achievements

Rookie

Rookie (2/14)

  • Week One Done
  • One Month Later
  • One Year In
  • First Post Rare
  • Conversation Starter Rare

Recent Badges

0

Reputation

  1. yes, but why? Seeing the jrxml it seems to use columngroup, but when I try to do the same thing with java code, I can't find a way to put together the StandardTable object and the StandardColumnGroup object.
  2. I have something like this, dynamically generated from java code : headerheaderheader footerfooterfooter and I have to generated something like this: headerheaderheader footerObviusly I have to do that only using java.
  3. I have to merge footer's cell in one cell, having the same width of the table, and I have to do this from java code. Some examples?
  4. I need to generate a report using JasperReports API only, and I can't find a way to create a JasperReport's table object from Java code. Seems that not exists a way to create a table using JRDesign classes. Maybe I am just searching in the wrong place. I can't use a designer like iReport or JasperStudio due to project requirement. Some help? I've made some progress, but it still not works... here's my code: private static JasperDesign getJasperDesign() throws JRException { JasperDesign jasperDesign = JRXmlLoader.load(new File("Template.jrxml")); JRDesignParameter parameter = new JRDesignParameter(); parameter.setName("parameter"); parameter.setValueClassName("net.sf.jasperreports.engine.JRDataSource"); jasperDesign.addParameter(parameter); JRDesignDataset subDataset = new JRDesignDataset(false); subDataset.setName("subDataSet"); JRDesignField field = new JRDesignField(); field.setName("field"); field.setValueClass(java.lang.String.class); subDataset.addField(field); jasperDesign.addDataset(subDataset); // datasource JRDesignDatasetParameter param = new JRDesignDatasetParameter(); param.setName("REPORT_DATA_SOURCE"); JRDesignExpression exp = new JRDesignExpression("$P{parameter}"); param.setExpression(exp); // datasetrun JRDesignDatasetRun dsr = new JRDesignDatasetRun(); dsr.setDatasetName(subDataset.getName()); dsr.addParameter(param); // table JRDesignStaticText staticText = new JRDesignStaticText(); staticText.setText("static"); DesignCell columnHeader = new DesignCell(); columnHeader.setHeight(80); columnHeader.addElement(staticText); StandardColumn column = new StandardColumn(); column.setDetailCell(columnHeader); column.setWidth(100); StandardTable table = new StandardTable(); table.addColumn(column); table.setDatasetRun(dsr); // reportElement JRDesignComponentElement reportElement = new JRDesignComponentElement(); reportElement.setComponentKey(new ComponentKey("http://jasperreports.sourceforge.net/jasperreports/components","jr", "table")); reportElement.setHeight(200); reportElement.setWidth(200); reportElement.setX(140); reportElement.setY(40); reportElement.setComponent(table); JRDesignBand band = new JRDesignBand(); band.addElement(reportElement); band.setSplitType(SplitTypeEnum.PREVENT); band.setHeight(250); ((JRDesignSection) jasperDesign.getDetailSection()).addBand(band); return jasperDesign; }[/code]
×
×
  • Create New...