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

rsilverns.sympatico.ca

Members
  • Posts

    151
  • Joined

  • Last visited

 Content Type 

Profiles

Forum

Events

Featured Visualizations

Knowledge Base

Documentation (PDF Downloads)

Blog

Documentation (Test Area)

Documentation

Dr. Jaspersoft Webinar Series

Downloads

Everything posted by rsilverns.sympatico.ca

  1. Sounds interesting, will definitely be checking out the latest SVN version! A thought... what about a forum area for announcements etc. to post all of these notices, and also a "working on" thread for the features we can expect in upcoming releases? How do you connect to the SVN repos? I see a post that says to use http://scm.jasperforge.org/svn/repos/jasperreports as the repository, but what should the user/pass be? Thanks a lot for the great work guys, keep it up! Robin Post edited by: rsilver@bfm.bm, at: 2006/11/21 16:36
  2. Is the eclipse plugin just a method by which you can launch the external iReports editor? I installed it in my Eclipse but the only option I have found thus-far is the option to launch the external editor. Thx, Robin
  3. If arraylist is an array of properly formatted beans, then you just refer to each field in the bean as a field in the report. i.e. public class Test { private String myTestString; public void setMyTestString(String s) {myTestString = s;} public String getMyTestString() {return myTestString;} } The field in this instance would be $F{myTestString}. HTH, Robin
  4. Just wondering if anyone knows of a clean way to do a page numbering in format of "Page X of Y"? I am able to do it currently by having two expressions, "Page X of" which gets evaluated at "now" and then "Y" which gets evaulated once at the end to calculate each page. Code:<textField> <reportElement x="390" y="6" width="99" height="20"/> <textElement textAlignment="Right"/> <textFieldExpression class="java.lang.String"><![CDATA["Page " + $V{PAGE_NUMBER} + " of "]]></textFieldExpression> </textField> <textField evaluationTime="Report"> <reportElement x="489" y="6" width="15" height="20"/> <textElement textAlignment="Left"/> <textFieldExpression class="java.lang.Integer"><![CDATA[$V{PAGE_NUMBER}]]></textFieldExpression> </textField> The problem is that it really makes aligning the page numbering hard since they are two text fields and the total page count could grow considerably depending on the data set. I would like to know if anyone knows of tricks for how to best create this page numbering? I would like to have a smooth spacing and alignment of "Page X of Y" so that I could right align the entire thing on the right side of my page at the right margin... and have it grow to the left as needed (i.e. Page XX of YYY etc.) Thx, Robin
  5. 1. There are two ways to do this... A. place the field twice in the same position, one field is bold, the other isn't. Then use a printWhenExpression on each field that is a reciprocal of the other. (i.e. field1: new Boolean($F{campo}.equals("nonbold")) and field2: new Boolean(!$F{campo}.equals("nonbold")) B. Use conditional styles. TO use these, set the flag on the element isStyledText = true. And then place xml inline in the field to denote the styling. Example: $F{campo}.equals("boldvalue")?("<style isBold="true">" + ($F{camp}) + "</style>"):$F{campo} 2. Not too sure on this one, but try moving the call to the group header, if its called with every record, its probably related to the detail band, the header would only be present once for each time the group changes. HTH, Robin Post edited by: rsilver@bfm.bm, at: 2006/11/21 12:24
  6. As a follow-up... the fields in your report would be the field names in the bean objects. As well, if you have a sub-report you can pass a collection/array of beans field to the sub-report as its own datasource by using the datasource expression of "new JRBeanCollectionDataSource($F{someBeanList}). HTH, Robin
  7. To use java beans is fairly straight forward. Just create either a collection or an array of the bean object and encapsulate that in either a JRBeanArrayDataSource or JRBeanCollectionDataSource. Just make sure the object your encapsulating adheres to the beans standard... 1. No public visibility fields 2. Properly named getter/setter methods. 3. Default no-args c-tor To fill your report, you would have something like... Code: ArrayList al = new ArrayList(); al.add(new SomeBean("SomeParam"«»)); al.add(new SomeBean("SomeParam"«»)); al.add(new SomeBean("SomeParam"«»)); al.add(new SomeBean("SomeParam"«»)); al.add(new SomeBean("SomeParam"«»)); al.add(new SomeBean("SomeParam"«»)); al.add(new SomeBean("SomeParam"«»)); JRBeanCollectionDataSource ds = new JRBeanCollectionDataSource(al); JasperReport jasperReport; JasperPrint jasperPrint; try { jasperReport = JasperCompileManager.compileReport(ROOT_DIR + "myReport.jrxml"«»); Map customParameters = new HashMap(); jasperPrint = JasperFillManager.fillReport( jasperReport, customParameters, ds); JasperExportManager.exportReportToPdfFile( jasperPrint, "c:\test_output.pdf"«»); } catch (JRException e) { e.printStackTrace(); } HTH, Robin
  8. Are there particular bands that you would like to see on the summary page? Title and Summary bands have a very specific purpose in mind, so you will need to either re-create structure in the summary band or move the "summary" to other bands as need permits and work some magic with the printWhenExpression. HTH, Robin
  9. Why don't you just delete the summary band? Set it's height to 0 or remove it from your structure all together (depending on the IDE your developing your reports with).
  10. Can you elaborate a bit on your design? I am not quite sure what you mean by info A and info B. Is info B a field/subset of data from info A? Typicially you cannot pass $P{REPORT_DATA_SOURCE} to a subreport effectively. If you outline a bit more about the data structure I will try to suggest something productive :). Edit: I read the code that you posted again, it looks like you are passing a unique datasource to the report in the parameters map which is intended to be the datasource for the subreport. In that case, pass it as a unique parameter name (e.g. "SUB_DATASOURCE") and then pass the parameter to the sub-report in the datasource expression. As well, you shouldn't pass REPORT_DATA_SOURCE to the report as that parameter is automaticially created when you fill the report with the datasource passed to that method. HTH, Robin Post edited by: rsilver@bfm.bm, at: 2006/11/20 16:06 Post edited by: rsilver@bfm.bm, at: 2006/11/20 16:07
  11. You can also just stream the file directly to the browser. I do something similar with a CSV file, modify as needed for other formats.... Code: private void returnCSVExport(String xmlFile, String compiledFile, String dwnloadFN, Map customParams, HttpServletResponse response, Connection c) throws IOException { ServletContext context = getServletContext(); // Specify a default folder for storing // compiled XML templates System.setProperty("jasper.reports.compile.temp", context .getRealPath("/reports/"«»)); try { JasperCompileManager.compileReportToFile(getServletContext() .getRealPath(xmlFile), getServletContext().getRealPath( compiledFile)); File reportFile = new File(getServletContext().getRealPath( compiledFile)); JasperReport jasperReport = (JasperReport) JRLoader .loadObject(reportFile.getPath()); JasperPrint jasperPrint = JasperFillManager.fillReport( jasperReport, customParams, c); JRCsvExporter csvExporter = new JRCsvExporter(); csvExporter.setParameter(JRCsvExporterParameter.FIELD_DELIMITER, "|"«»); csvExporter.setParameter(JRCsvExporterParameter.RECORD_DELIMITER, "n"«»); csvExporter.setParameter(JRCsvExporterParameter.JASPER_PRINT, jasperPrint); csvExporter.setParameter(JRCsvExporterParameter.OUTPUT_STREAM, response.getOutputStream()); //This lets the stream be downloaded as a file rather than sent to browser.. change to application/pdf for inline viewing. response.setContentType("application/x-download"«»); //remove this line for inline viewing. response.setHeader("Content-Disposition", "attachment; filename="+ dwnloadFN); csvExporter.exportReport(); } catch (JRException e) { } } Post edited by: rsilver@bfm.bm, at: 2006/11/20 12:21
  12. I don't believe that is possible, most of the logic for growing or whatnot is for vertical growth. You could always implement a custom routine with scriptlets etc. but FontMetrics can be a bit annoying to deal with. HTH, Robin
  13. No problem Andrew, feel free to drop me a line if you have any specific questions. Thx, Robin
  14. As in two copies of the same page? In these instances I like to create a custom datasource which will return the same record twice before advancing to the next record. This allows me to have 1 report to edit/maintain yet end up with 2 complete versions when produced to pdf. HTH, Robin
  15. Create a subreport parameter (for the sub-report from the main report) called "paramA" and pass it the value you wish by setting the report expression as needed. If the value is in a field try using $F{myField} as the expression, if its a parameter that was passed to the main report, use $P{myParam} etc. etc. Then in the sub-report create a parameter called "paramA" which will receive this parameter.
  16. Concerning the watermarks, you could overlay a series of watermarks on top of each other, and just set each watermark's "printWhenExpression" to be new Boolean($V{PAGE_NUMBER}.intValue() == 1) for page 1, == 2 for page 2.. etc. etc. If I am understanding your goal correctly then you could indeed use JasperReports. It would probably be best to create a simple program to input the desired fields into a datastore then run your report to extract the fields from the datastore and insert them into the appropriate position in your report. For the best appearance on the printed page, i would recommend looking into Optical Character Recognition (OCR) scanning, and hopefully be able to produce a report file whose design is a precise representation of your original document. This would drasticially increase maintainance and enhancement ability. HTH, Robin
  17. Could you post the exception you are seeing? I ran your code and it seemed to work fine with a few notes: 1. I added a ".pdf" to "simple_report" so that I could open it easier under windows. 2. Your "JasperFillManager.fillReport(jasperReport, new HashMap())" method should have a 3rd argument, the datasource. if you don't specify the third argument your report will be a blank page. Try adding a third argument "new JREmptyDataSource(3)" to see the difference between the two. This will cause 3 detail bands to be "stamped" out, so you should see three a's showing up on the page. 3. Be sure you are adding all supporting libraries to the classpath before you run this code. You need the jasperreports-X.Y.Z.jar file (jasperreports-1.2.7.jar for my test) as well as the supporting jar files in the lib folder of the jasper reports download. Without these supporting files, you would receive an error similar to: * Exception in thread "main" java.lang.NoClassDefFoundError: * org/apache/commons/digester/Digester at * net.sf.jasperreports.engine.JasperCompileManager.compileReport(JasperCompileManager.java:142) * at my.test.ExceptionTest.main(ExceptionTest.java:36) HTH, Robin Post edited by: rsilver@bfm.bm, at: 2006/11/16 12:24
  18. You can encapsulate the objects within a JRBeanArrayDataSource or JRBeanCollectionDataSource and access the elements of the objects as fields. The inner contactList is best suited for being used in a sub-report (just off top of my head, this may not be the case depending on your report design), you would pass the sub-report a datasource expression of "new JRBeanCollectionDataSource($F{contactList})" HTH, Robin
  19. *cough* bump *cough* Has there been any further consideration of this or similar feature requests? Thx, Robin
  20. I created a quick test and it seems to include my page footer right after my column footer in the sub-report. Could you elaborate on the report? Perhaps it is an option you have set on either sub-report or the master report. HTH, Robin
  21. Look at JasperIntelligence and it's webservices functionality. That may be what you are looking for. HTH, Robin
  22. The "fieldDescription" is used for some data sources to contain some extra information needed to extract the value of the field. e.g. for an XML data source this element is used to map the field name with the appropriate element in an XML file.
  23. Can't you just have a field "user" and then access its objects with $F{user}.getEmail()? Not withstanding that, check that the class follows proper bean syntax rules with the appropriate getter and setter methods for that variable and that it has private visibility. What type of error are you getting? If the above doesn't solve the issue, post some sample code and report info if possible. HTH, Robin
  24. I have done this same thing and have been able to implement it using groups and placing each "page" into the group header of the group. So for 3 pages, I would have 3 groups, each with a Start New page = true option turned on. The expression for each group would be [$V{REPORT_COUNT} + "Page1"] (page2, 3 etc). HTH, Robin
  25. Review iText if your exporting to pdf. You can parse the pages of your report and extract the pages you want to show. Perhaps filter the report through iReports and stream it to a browser if your filling your report online, or filter it to a file if your doing it local. HTH, Robin
×
×
  • Create New...