JasperReports - stretch report band to fit all columns in one row - jasper-reports

I am developing report which is not going to be put on paper - just export it into xlsx format.
I have ability to set width of band with data to high number, but i would like to have ability to make this band stretch horizontally to fit all cells from one results row in single line. How I can do that?
PS: I am using iReport to build jrxml file, but I am comfortable with directly editing the jrxml file.

Have you tried using Dynamic Jasper. I think the example here may solve your problem. It can create the you the jrxml file if you don't want to have the DJ code in your application.

Related

Bad Jasper Studio chart size in Excel ("fit to cell size" and not in "original size")

I use Jaspersoft Studio 6.11.0 and when I export my report in excel (.xlsx) the charts size appear to be in "fit to cell size" and not "in original size".
I spend a lot of time to find hacks and parameters but I can't find a solution. I want to ensure that chart appear in it's original size in excel. The original size of the chart is 640x480.
I put a screen capture as you can easily see the problem
Thanks in advance.

How do you auto size columns of a grid for PDF format in Birt reporting

I am working on a report in Birt reporting using Birt 4.5 in eclipse.
I have a grid that has 3 columns and inside each column is a label with some hard coded value to give you a test scenario,I also set the "Can shrink" property to true, and I did change the layout Preference to auto-Layout, see pic bellow.
Now when I run this example as a Html out of eclipse I get the following and it works exactly like I want it to. It auto sizes the columns so the first column size has increased and the last 2 decreased.
Html pic :
Now I actually want it as a PDF format but the columns doesn't auto resize.
PDF pic :
I want this functionality because my report is going to be dynamic.
Is it possible to get the same result in the pdf format as html? If it is what properties should I set or how do I accomplish this?
No, this is not possible.
Those columns with no width specified (in your example: all three) take the remaining width (after considering the columns with a specified width) to equal parts.

Crosstab report overlap

I am using Jaspersoft studio 6.2. In my report, only one summary band, two crosstabs are placed vertically. The issue is the two crosstabs will overlap if I don't leave enough space for the top crosstab. But the truth is the row group is from a query so is dynamic, I will never know what height is enough (or too much) for the top crosstab. I am from other reporting tools (ssrs, crystal), this never been an issue, just wondering what's the best practice to deal with it in Jasper?
EDIT: added screenshots
The report definition in jaspersoft studio. There are two crosstabs in summary band. There is not much space between two crosstabs.
The result: you can see two crosstabs overlap.
The only solution I have is to put huge space between the two like this: The only problem is next time there may be more data and crosstab 1 may grow and will overlap again.
Set position type = Float of second crosstab.
You can find it in properties - > appearance tab.

JasperServer - how to stop horizontal line in report from stretching across screen

I created this report in iReport Professional 4.5.1 and deployed it to JasperReports Server today. The total page width is 792 pixels. In my report I have some horizontal lines that are 752 pixels wide. When I run the report in JR Server the horizontal lines stretch all the way over to the right side of my monitor. This happens when I schedule the report and ask JR Server to save it as an HTML file, but when I schedule the report and save the output as a PDF the lines are the correct size.
How can I keep the horizontal lines from stretching? The stretch type for each line is set to "no stretch." My other report elements are managing to hold their position.
Thanks,
Lisa
Try using cell borders to draw those lines instead of a static "horizontal lines."
Thanks, Sam! Your answer helped me solve this. My report is a 6-column report and I have labels that I only print in the first column. Cell borders wouldn't work because there would be lots of gaps. However, I realized that my horizontal line did not need to be 752px wide; it only needs to be slightly wider than the width of the first column and the report will take care of copying it into the subsequent columns for me. I set the horizontal lines to 127px wide and now I have an unbroken horizontal line that runs through all of my columns. I can't believe that didn't occur to me when I was creating the report in iReport.

Jasper Reports image and text mix

I want to write a jasper reports application. It has to arrange an image and a text such that they will be appropriately placed. This is what I want.
I get images and texts from a web service, so I can fetch image size on runtime. If its width is bigger the text should be below, and vice versa. I tried setting width option by a parameter, but it did not work.
How can i do it?
Correct: You cannot set the image width using a parameter.
The quickest solution is probably like this:
Determine what your maximum width is. Then use a 'Print when expression' to display either the picture-next-to-text layout or the picture-above-text layout. Your report will have 2 image elements and 2 text elements, but you'll choose which one to display based on the image size.
An alternative would be to investigate something like Dynamic Jasper. That's a project designed to dynamically generate the .jrxml on the fly, so it has the ability to modify the width similar to what you're describing.