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

jprohaska

Members
  • Posts

    17
  • Joined

  • Last visited

jprohaska's Achievements

Explorer

Explorer (4/14)

  • Week One Done
  • One Month Later
  • One Year In
  • First Post Rare
  • Collaborator Rare

Recent Badges

0

Reputation

  1. I've developed a report in Ireport that I fill by a viewbean, since I've insert the totals in the viewbean there is any way to chenge the last row of the report from normal to bold ?
  2. I have the same jrxml(ireport) and in PDF esporting it runs fine, but in XLS exporter title dont appears??? any idea why??????????? Xls code Code: File reportFile = new File(inputFileJasper); JasperReport jasperReport = (JasperReport)JRLoader.loadObject(reportFile.getPath()); JasperPrint jasperPrint = JasperFillManager.fillReport(jasperReport,parameters,ds); JRXlsExporter exporter = new JRXlsExporter(); exporter.setParameter(JRExporterParameter.JASPER_PRINT, jasperPrint); response.setContentType("application/vnd.ms-excel"«»); exporter.setParameter(JRExporterParameter.OUTPUT_STREAM, response.getOutputStream()); //exporter.setParameter(JRXlsExporterParameter.IS_ONE_PAGE_PER_SHEET, Boolean.FALSE); exporter.exportReport(); PDF code Code:[code] ServletOutputStream servletOutputStream = response.getOutputStream(); InputStream reportStream = getServlet().getServletConfig().getServletContext().getResourceAsStream( "/report/" request.getParameter("nomeFileJasper"«») ".jasper"«»); response.setContentType("application/pdf"«»); response.addHeader("Content-Disposition", "inline;"«»); //response.addHeader("Content-Disposition","attachment;filename=Report.pdf"«»); asperRunManager.runReportToPdfStream(reportStream, servletOutputStream, parameters, ds );
  3. Hallo to all. I have to following code that works great by generating PDF, how can i convert it to generate excel report ? John Code: ServletOutputStream servletOutputStream = response.getOutputStream(); InputStream reportStream = getServlet().getServletConfig().getServletContext().getResourceAsStream("/report/report.jasper"«»); response.setContentType("application/pdf"«»); response.addHeader("Content-Disposition","inline;"«»); JRBeanCollectionDataSource ds = new JRBeanCollectionDataSource(request.getSession().getAttribute("list"«»))); JasperRunManager.runReportToPdfStream(reportStream,servletOutputStream,parameters,ds);
  4. OK I answer me again: i've used a SCRIPTLET and a serialized object: Code: public class StatoReportScriptlet extends it.businesslogic.ireport.IReportScriptlet { monitor mI = new monitor(); int numElaborate = 0; public String contaSottoReport() throws JRScriptletException { ++numSchedeElaborate; mI.avanzamentoJob( XXXXXX,YYYYYY, numSchedeElaborate); return STRINGA_RITORNO ; } }
  5. Hallo to all I have the following code that launches a report and X sub reports: JasperRunManager.runReportToPdfFile(template.jasper,output.pdf,parameters,ds); I'm running the class in Tomcat, how can I have in tomcat a counter as "generated 4 of 999 sub reports" Thanks John
  6. Hallo to all Jasper people.... I have a report with the following SQL statement, and I pass parameter N SELECT * FROM DB2ADMIN Q1 WHERE Q1.ID_SK = $P{N} I would like to have on the same PDF more of this report . How can I do this? :unsure: :blink: I was thinking of having an empty report that contains this reports but then if i send the connection from the main to the subreport, and I also pass a collection of objects(whit the N) as parameter, but then I cant figure out how to cycle throe each N :blink: Thanks John Post edited by: jprohaska, at: 2007/09/14 15:11
  7. OK here is the answare to my question: This is the java code: java.util.Vector collection = new java.util.Vector(); for (Iterator itrSchede = idAmmList.iterator(); itrSchede.hasNext() ; ) { .................. collection.add(new percorsi(percorso)) ; } ................. parameters.put("dataSourceHash", new JRBeanCollectionDataSource(collection)); This is the java collection class: public class percorsi { private String percorsoFile = "" ; public percorsi(String percorsoFile) { this.percorsoFile = percorsoFile; } public String getPercorsoFile() { return percorsoFile; } public void setPercorsoFile(String percorsoFile) { this.percorsoFile = percorsoFile; } } in master report: on subreport properties -> tab SUBREPORT -> CONNECTION DATASOURCE EXPRESSION ->select USE DATASOURCE EXPRESSION in the bottom fiels put $P{dataSourceHash} tab SUBREPORT(OTHER) -> tab SUBREPORT PARAMETER add parameter dataSourceHash- expression $P{dataSourceHash} In subreport menu DATA -> CONNECTION/DATASOURCES --> new -> select Custom JRDataSource and delete all class stuff John Post edited by: jprohaska, at: 2007/04/19 10:14 Post edited by: jprohaska, at: 2007/04/19 10:15
  8. Hi to all, I have a report generated with a db2connection datasource and a subreport which I need to pass a list to it. in IREPORT how I can set up the subreport to accept a collection(recieved as parameter from main report) as datasource, in connection/data sources what I need to select? Thansk John .................. java.util.Vector collection = new java.util.Vector(); for (Iterator itrSchede = idAmmList.iterator(); itrSchede.hasNext() ; ) { .................. collection.add(new percorsi(percorso)) ; } ................. parameters.put("dataSource",collection) ; ................... JasperRunManager.runReportToPdfStream(reportStream, servletOutputStream, parameters, connection)
  9. Hi to All, I have a main report that uses a COM.ibm.db2.jdbc.app.DB2Driver connection, and a subreport which i need to pass a list (from my java code) to view as datasource. How can I pass a different datasource to a Subreport from my java code? Thanks John
  10. Finally I've made it to open this report in tomcat, but how is possible to: 1) print this report automaticly by showing only the printer to print to dialoge) 2) open the save as dialog the: response.addHeader("Content-Disposition","attachment;filename=Report.pdf"); is not good for me since it opens the save/open dialog InputStream reportStream = getServlet().getServletConfig().getServletContext().getResourceAsStream("/Reports/qdettaglioscheda_cat_op.jasper"); response.setContentType("application/pdf"); response.addHeader("Content-Disposition","attachment;filename=Report.pdf"); JasperRunManager.runReportToPdfStream(reportStream, servletOutputStream, parameters, connection);
  11. Problem FIXED by moving jasper*.jar from tomcat/lib to application/lib John
  12. Problem FIXED by moving jasper*.jar from tomcat/lib to application/lib John
  13. Hi to all, I build a report that worked fine in Ireport and in eclipse/tomcat, but as soon i've added a scriptlet in the group expression it does not work no more in eclipse/tomcat(but works OK in ireport) I've created a class qdettaglioscheda_cat_opScriptlet in eclipse, but it seems like class qdettaglioscheda_cat_opScriptlet could not be found in eclipse/tomcat ----------------------------------------- ------ This is the tomcat error log: ----------------------------------------- e.getStackTrace[Ljava.lang.StackTraceElement;@e73783 it.ssssss.bbbbbb.oooooo.segnalazione.JasperReportsIntro - <init> e.getMessage()Errors were encountered when compiling report expressions class file: 1. The method diverso() is undefined for the type JRAbstractScriptlet value = (java.lang.Object)(((net.sf.jasperreports.engine.JRAbstractScriptlet) parameter_REPORT_SCRIPTLET.getValue()).diverso()); <-----> 2. The method diverso() is undefined for the type JRAbstractScriptlet value = (java.lang.Object)(((net.sf.jasperreports.engine.JRAbstractScriptlet) parameter_REPORT_SCRIPTLET.getValue()).diverso()); <-----> 3. The method diverso() is undefined for the type JRAbstractScriptlet value = (java.lang.Object)(((net.sf.jasperreports.engine.JRAbstractScriptlet) parameter_REPORT_SCRIPTLET.getValue()).diverso()); <-----> ----------------------------------------------------- ---- Ireport Group expression ----------------------------------------------------- $P{REPORT_SCRIPTLET}.diverso() ------------------------------------------------- ------- This is the scriptlet (i have also created in eclipse in default package) ---------------------------------------------------- import net.sf.jasperreports.engine.*; public class qdettaglioscheda_cat_opScriptlet extends it.businesslogic.ireport.IReportScriptlet { String CODICE_PRECEDENTE = new String("CD"); /** Creates a new instance of JRIreportDefaultScriptlet */ public qdettaglioscheda_cat_opScriptlet() { } public Boolean diverso() throws JRScriptletException { String CODICE_PARAGRAFO_FIELD = (String)this.getFieldValue("CODICE_PARAGRAFO"); String STRINGA_RITORNO = new String(" "); if (CODICE_PRECEDENTE.equals(CODICE_PARAGRAFO_FIELD)) { CODICE_PRECEDENTE = CODICE_PARAGRAFO_FIELD; return Boolean.FALSE; } else { CODICE_PRECEDENTE = CODICE_PARAGRAFO_FIELD; return Boolean.TRUE; } } } ----------------------------------------- ----- JRXML file ----------------------------------------- <?xml version=1.0" encoding="UTF-8" ?> <!-- Created with iReport - A designer for JasperReports --> <!DOCTYPE jasperReport PUBLIC "//JasperReports//DTD Report Design//EN" "http://jasperreports.sourceforge.net/dtds/jasperreport.dtd"> <jasperReport name="qdettaglioscheda_cat_op" columnCount="1" printOrder="Vertical" orientation="Portrait" pageWidth="595" pageHeight="842" columnWidth="535" columnSpacing="0" leftMargin="30" rightMargin="30" topMargin="20" bottomMargin="20" whenNoDataType="NoPages" scriptletClass="qdettaglioscheda_cat_opScriptlet" isTitleNewPage="false" isSummaryNewPage="false"> <property name="ireport.scriptlethandling" value="1" /> <property name="ireport.encoding" value="UTF-8" /> <import value="java.util.*" /> <import value="net.sf.jasperreports.engine.*" /> <import value="net.sf.jasperreports.engine.data.*" /> <parameter name="SECONDO_IND" isForPrompting="false" class="java.lang.String"/> <parameter name="CODICE_DEL_PARAGRAFO_PRECEDENTE" isForPrompting="false" class="java.lang.String"/> <parameter name="CODICE_APPO" isForPrompting="false" class="java.lang.String"/> <parameter name="NumeroScheda" isForPrompting="false" class="java.lang.String"> <defaultValueExpression ><![CDATA["CROP4362]]></defaultValueExpression> </parameter> <queryString><![CDATA[sELECT * FROM XXXXXXXXX WHERE XXXXXXXXXXXXXXXXXXXXXXXXX ORDER BY XXXXXXXXXXXXXXXXXXXXXXXXXXXX ></queryString> XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX <group name="CODICE_DEL_CAMPO" isReprintHeaderOnEachPage="true" > <groupExpression><![CDATA[$P{REPORT_SCRIPTLET}.diverso()]]></groupExpression> <groupHeader> <band height="15" isSplitAllowed="true" > <textField isStretchWithOverflow="false" pattern="" isBlankWhenNull="false" evaluationTime="Now" hyperlinkType="None" hyperlinkTarget="Self" > <reportElement mode="Opaque" x="2" y="2" width="175" height="13" forecolor="#000000" backcolor="#CCCCCC" key="textField-1"/> <box topBorder="None" topBorderColor="#000000" leftBorder="None" leftBorderColor="#000000" rightBorder="None" rightBorderColor="#000000" bottomBorder="None" bottomBorderColor="#000000"/> <textElement> <font pdfFontName="Helvetica-BoldOblique" size="10" isBold="true" isItalic="true"/> </textElement> <textFieldExpression class="java.lang.String"><![CDATA[" " + $F{CODICE_PARAGRAFO}]]></textFieldExpression> </textField> <textField isStretchWithOverflow="false" pattern="" isBlankWhenNull="false" evaluationTime="Now" hyperlinkType="None" hyperlinkTarget="Self" > <reportElement mode="Opaque" x="178" y="2" width="354" height="13" forecolor="#000000" backcolor="#CCCCCC" key="textField-4"/> <box topBorder="None" topBorderColor="#000000" leftBorder="None" leftBorderColor="#000000" rightBorder="None" rightBorderColor="#000000" bottomBorder="None" bottomBorderColor="#000000"/> <textElement> <font pdfFontName="Helvetica-BoldOblique" size="10" isBold="true" isItalic="true"/> </textElement> <textFieldExpression class="java.lang.String"><![CDATA[" " + $F{DESCRIZIONEPARAGRAFO}]]></textFieldExpression> </textField> .................................................................................................... ......................................................................... .................................................................................................... ......................................................................... .................................................................................................... ......................................................................... .................................................................................................... Post edited by: jprohaska, at: 2007/03/20 11:45 Post edited by: jprohaska, at: 2007/03/20 11:48
  14. this is some the error more detailed: e.getStackTrace[Ljava.lang.StackTraceElement;@e73783 it.ssssss.bbbbbb.oooooo.segnalazione.JasperReportsIntro - <init> e.getMessage()Errors were encountered when compiling report expressions class file: 1. The method diverso() is undefined for the type JRAbstractScriptlet value = (java.lang.Object)(((net.sf.jasperreports.engine.JRAbstractScriptlet)parameter_REPORT_SCRIPTLET.getValue()).diverso()); <-----> 2. The method diverso() is undefined for the type JRAbstractScriptlet value = (java.lang.Object)(((net.sf.jasperreports.engine.JRAbstractScriptlet)parameter_REPORT_SCRIPTLET.getValue()).diverso()); <-----> 3. The method diverso() is undefined for the type JRAbstractScriptlet value = (java.lang.Object)(((net.sf.jasperreports.engine.JRAbstractScriptlet)parameter_REPORT_SCRIPTLET.getValue()).diverso()); <-----> Post edited by: jprohaska, at: 2007/03/20 10:19
  15. I've copied the compiled class qdettaglioscheda_cat_opScriptlet.class to C:/Programm/Apache Software Foundation/Tomcat 5.5/common/classes and it still does not work :blink: John . Post edited by: jprohaska, at: 2007/03/20 09:54 Post edited by: jprohaska, at: 2007/03/20 09:56
×
×
  • Create New...