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

Alexander Merz

  • Posts

  • Joined

  • Last visited

Alexander Merz's Achievements


Explorer (4/14)

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

Recent Badges



  1. Parameters are a way to pass arbitrary data into the report, where the data does not come from the data source. For example in your application you want to include the name of the user who is currently logged in and wants to get a report. Code: String userName = ... ... HashMap params = new HashMap(); params.put("user", userName); ... JasperPrint jp = JasperFillManager.fillReport(report, params, datasource); In the JRXML: Code:[code] <parameter name="user" class="java.lang.String"/> ... <textField> ... <textExpression><![CDATA[$P{user}]]></textExpression> </textField>
  2. The second parameter is a Map object for parameters. Parameters are defined in the report via <parameter>. See the Tag reference and API docs for more information.
  3. Code:parameters.put("condition",condition); Code:[code]<parameter name="cond" class="java.lang.String"> Code:[code]<queryString> ... $P!{cond} order by Issuedate;]]> </queryString> BTW: I hope the java code is only a demo/reduced and will not run under a public avaible service... Post edited by: Alexander Merz, at: 2006/09/10 23:50
  4. Check the API-Doc of JRHtmlExporterParameter and take care of the correct URI to the images.
  5. If your column names could change, you should may be implement you own data source and add a flexible mapping of fixed field names to variable column names. But, i did not really understand why column names are a subject to change. As long as your data model isn't stable, it isn't a good idea to start with a report implementation.
  6. Via JRParameter.REPORT_LOCALE. But this parameter is relevant for the export only AFAIK. I would agree with Barry, there seems to be a problem in the underlying enviroment. You say in iReport, everything is ok, but at the stage/developer deployment level the error occurs. Do you run the processing of the report under the application server? They often use some "strange" settings and come with their own libs.
  7. Note: I'm from Germany, so i'm familiar with the problem of special chars. Not only in having correct encodings in JRXML files. And my experience with Eclipse related to encoding stuff is: it's ugly, it's intransparent. Never use Eclipse to change or repair encodings in texts. (That's not Eclipse specific, the most IDEs seem to be the wrong tools for this task) Use a relativ simple editor (i use ConText). Open the file in the editor and remove the CDATA sections and texts in the static text boxes. Save the file and try to compile it. If it works, go back to the editor and add the texts again. ConText stores the file in ISO-8859-1 by default, so take care of setting <?xml version='1.0' encoding='ISO-8859-1' ?> Compile again, if it works, be happy and be careful, if you touch the JRXML in the future again. If it does not compile with empty text boxes, then you may have unusal chars somewhere in the file. You could enable ConText feature to show you unprintable chars in the file and look over it. But i guess (seeing the file size) this would require pratically more time then setting up a new report template from scratch.
  8. AFAIK JasperReport tries to analyse the pattern and checks if it contains some of the constants like hide or short. If the detection fails, the pattern is passed to SimpleDateFormat directly. The error message is generated by SimpleDateFormat, if the pattern contains characters not known by the parser. So the detection of the constants must have failed. I don't not know when the "style"-feature was introduced, but I could imagine, that the feature isn't avaible in older releases. Another possibility would be just a typing mistake like "nedium,hide". Post edited by: Alexander Merz, at: 2006/09/02 08:54
  9. Look at this staticText element: Code:<staticText> <reportElement ... key="element-90"/> <box ... /> <textElement> <font fontName="" size="12"/> </textElement> <text><![CDATA[identificación]]></text> </staticText> The text is encoded in UTF-8, not ISO-8859-1! Could it be possible, that you used several editors to edit the file? Maybe one of them is setted to store in UTF-8 by default. I can remember at least one editor that changes and stores the file content to UTF-8 automatically by default in such a case, independent of the encoding before. The result is just a mangled file, in the worst case you have a mix of encodings for special chars in the file.
  10. Do you want to iterate over the HashMap or do you have a list of HashMaps? To iterate you would need to implement your own datasource class. If you have list, you should take a look on JRMapCollectionDataSource.
  11. Be careful, if you manually change the encoding in the JRXML, for example to ISO-8859-1: <?xml version="1.0" encoding="ISO-8859-1" ?> and then load the file again in iReport, it is changed to UTF-8 again. But it only changes the encoding attribute, not the encoding of the file itself! I don't know if this is really bug of iReport or just a result of how the file and the XML is processed in some underlying layers/libraries.
  12. I'm not sure, but according to the docs, you can use JRExporterParameter.OFFSET_X and JRExporterParameter.OFFSET_Y as parameters for the export class to move the page content while exporting. So you could change the report xml template to have no margins and add margins via the parameters for all cases of export, which are not Xls and Text. But i never used it actually. So i don't know if this would really work like i imagine.
  13. Look for the <group> tag in the tag reference (docs/reference). There are also many examples in the demo/samples and doc/samples directory using the tag.
  14. Make sure that there is no space or blank line before <?xml version="1.0" encoding="UTF-8" ?> And there should be no space or Non-XML-data after the line and before the <jasperReport>-tag.
  • Create New...