Is it possible to change position of textField using JasperReports? - jasper-reports

I have created .jrxml by using iReport tool and have to dynamically set the x and y position of fields in .jrxml file. How should I do that?

I'm afraid thats not directly possible using reports made in iReport, creating the reports in runtime in Java will solve your issue.

Related

JasperReports' iReport - Passing Date parameter from iReport to Jasper Repository

The Date parameter I have set in iReport prompts for the date to use when generating a report. This prompt does not pass to the repository when I upload the report to it.
Can any one explain how to do this?
You need to explicitly create "input controls" in JasperReports Server. Once you realize that this is required, it's pretty easy to figure out how to do it.

What is the purpose of ireport.x and ireport.y property in iReport?

Can anyone let me know the purpose of property ireport.x and ireport.y in JasperReports .jrxml files?
Thanks in advance.
The parameters ireport.x, ireport.y and ireport.zoom are determine how to show report's template in iReport. Its just a settings for default displaying report in this designer (iReport).
The parameters ireport.x and ireport.y are determine the default position for template (after opening in designer).
The parameter ireport.zoom is determine the default zoom for template (after opening in designer).

Linking subreports in iReport so they also work in Jasper server

Using iReport v4.0.1 with Jasperserver v4.1.0 I'm trying to find a syntax for linking subreports to the main report that lets me test it in iReport then deploy to the server through the repository browser.
The default syntax for sub-reports in iReport for the subreport expression is something like
$P{SUBREPORT_DIR} + "mySubReport.jasper"
When you deploy this from iReport it's smart enough to pick this up and suggest changing it to
"repo:mySubReport.jrxml"
and to then deploy all subreports to the Resources folder of the main report.
That's great, but unfortunately it then edits the file in iReport to save this change which means you can no longer run the report in iReport without manually re-editing all the sub-report expressions - this makes the process of testing and deploying to the server really painful, particularly when there are multiple sub-reports in a report.
I thought I could at least set the value of $P{SUBREPORT} to be "repo:" or "My\local\filepath" so that at least I'd only have one place to change it, but the compiler doesn't like that.
Is there an alternative structure or an expression that will resolve to repo:*.jrxml or My\local\filepath*.jasper correctly depending on where you're running the report from?
The best solution to this is to add an additional parameter like $P{IsOnServer}. Set the default value to true. For your subreport expression use this:
$P{IsOnServer} ? "repo:mySubReport.jrxml" : "/local/path/to/mySubReport.jasper"
When you run the report in iReport, you'll be prompted for the value of IsOnServer. Make it false; the subreport expression will resolve to your local file. On the server, don't define an input control. The users will never be prompted for that parameter (they won't even know it exists), and it will result to the desired 'repo' syntax.
An even better solution would of course be for iReport to handle this automatically... but for now you need to do something like this.

How to create jrxml for sub reporting

I want create a complex jrxml file to create PDF.
I want to put another jrxml in my jrxml file.
So.. my question is how to put one jrxml to another jrxml
My jrxml files are: salesreport.jrxml, financialreport.jrxml and report.jrxml
I want to put salesreport.jrxml and financialreport.jrxml to report.jrxml.
Usually you develop reports with iReport.
iReport has facilities for including subreports within reports (by dragging the subreport icon onto the master report page).
Note that JasperReports uses absolute paths for file references. I would recommend you set up parameters to your reports as follows:
$P{ROOT_DIR}
$P{SUBREPORT_DIR}
Give $P{SUBREPORT_DIR} a default value of $P{ROOT_DIR} + "subreports/".
At that point, you can pass the absolute path as $P{ROOT_DIR} into your report and then the subreports will be stored in a subdirectory called subreports, which is located in $P{ROOT_DIR}.
Or use the JasperCompileManager class from within the master jrxml file to dynamically compile it.
<subreportExpression><![CDATA[JasperCompileManager.compileReport($P{SUBREPORT_DIR}+"/myFile.jrxml")]]></subreportExpression>

Crystal Reports - Accessing IGraphObject properties at runtime

I am using Visual Studio 2008 and Crystal Reports that is shipped with it. I would like to set certain properties of a chart such as Chart Title at Runtime. I have tried via ChartObject but there are only limited properties such as top, width, height etc. and not the properties I'm interested in. I included "craxddrt.dll" in my solution which provides IGraphObject but am obviously trying to cast the wrong class with it as it returns an invalid object reference...
(myReportDocument.ReportDefinition.ReportObjects[0] as IGraphObject).Title
Any help in retrieving the chart properties would be much appreciated...
thanks,
Paul
Instead of trying to set the chart title at runtime, set it to be blank and display a Crystal formula in the same place.