I have a JasperReports's report with some data and a table. The problem is when the table splits on 2 pages sometimes on the first one is only the header of the table. I want it to split (can't use Prevent), but only if it is at least one line of detail (if not, all should move to the next page).
Bad Here:
Good Here:
On the first example (the bad one) first header should not be printed.
Ideas?
Put your table header into a group header, then follow the advice on the question:
In jasperreports how to force page break before a group title if there is no room for any subsequent rows
Related
I am working with jasper report where some tables i am using to show data as usual. I want to repeat my table's header in every page. I know column header will resolve my requirement but still i want to repeat table header instead of column header. is that possible?
I need to show two header i mean first two row will be header of that table. i was thinking if i can use table header and column header both and can repeat both in every page.. Plz help if anyone already face same things
Actually i got a way which meet my requirements. jaspersoft studio has a option to create group header which is available under table's dataset. there i have created a group and got an property "Reprint header on each page" check mark that option then added columns under that group in table section.
And finally its working properly as i was expecting.. thanks for your time
My institution is using BI Publisher (Ms.Word add on) with Peoplesoft.
Now, I'm doing a report that will print a name and it's description in table format repeatedly. In some cases, the first and second row of the table will be separated in different page. I already tried to check the "Keep Lines Together" and deselect "allow row to break across pages" setting, but only worked with static table, not with table contains BI Publisher fields.
This is the screen shot (look at the red arrow).
First and second row of table are separated in different page
Anyone able to solve this issue? Thanks.
it was done..just create 1x1 table and set it to not allow break across pages. Then, put the the main table into that 1x1 table. Place the repeating tags outside the 1x1 table.
I solve this problem by this way.
Insert any filed into the bottom of the table,then change the filed property as
<?split-by-page-break:?>
I had search some relative question which had been asked, but seem not too much my condition.
My problem is simpler to this problem
Table in iTextSharp is not page breaking as desired?
The different between my problem and his is I need header in each extend page.
Currently I put a long table in one of cell, it make me has header in each page, but if the table to long, all table will shift to second page, and first page is empty.
I have tried table.KeepRowsTogether, but the 15 rows stay in second page and rest in third..
I determine what is the length of list. if number of items more than 15 then I separate list into 0 ~ 14 and 15th to the end, keep all content in the same table then there will having header in second page. Case close
Is there any way to find the current page is going to end in iTextSharp. For example,
say there are some 10 records which needs two pages to be written down at the end of the first page i wish to add '(contd on nex page'). IS there a way to do this. Will finding the end of page be an answer for this or is there a way to find the line number on which writing is done, so that i can make a calculation to decide whether to add a message of my choice and proceed to the next page.
any advise is much appreciated :)
Thanks a zillion
Usually, this is done by defining a footer for the table. When the table breaks automatically, iText will show that footer. Of course: you don't want this footer to show up on the last page (after the final row of the table). That's why there's also a method to skip the last row.
This example shows you how to create a table with headers and footers. This is the link to SkipLastFooter.
Note that saying that "finding the line number" would solve your problem is wrong for two reasons:
There is no such thing as a line number in a PDF file. You have a MediaBox and you draw content on the canvas defined by the MediaBox using coordinates.
There's a way to get the current Y-position on a page after adding an object to a document. You can get the Y-position before adding a table and after adding a table, but not while you're still creating the table.
An alternative solution to the one I suggested above, woult be to use table events.
If you really need to find the end of the page, and are not using a table with a footer row that will be printed at the end of each page, you can use the PdfWriter object as follows:
var remainingPageSpace = pdfWriter.GetVerticalPosition(false) - pdfDocument.BottomMargin;
This will give you the remaining space on the page, from which you can determine what you want to do next.
If you are using tabular data however, it is much preferred to use a PdfPTable and take advantage of the footer row feature.
I am looking for a way out in cross tab, so that if the columns exceed in cross tab, they shouldnt go on next page..rather a new cross-tab should repeat after the first one.
For example, two columns are displayed in a cross tab :
Now if a new column is added, and assuming that it could not be accomodated within the given page width limit, it will go to a page next to it in CR by default.
But in my report it is required to be shown below the first cross tab (and not on next page), which will look as follows:
Please do suggest me if there's a way out :)
Thanks in advance
Your question is perfectly reasonable, but I'm pretty sure that in CR-XI, there is no automatic way to do this. I recommend skipping the cross-tab designer completely and just making your own:
Make a new CR using a placeholder table that has exactly 1 record.
In this CR, suppress everything but the details section. Add a new details section so you will have Da and Db.
In Da, add a subreport. Use your real datasource and add Column1 and Column2.
In Db, add a subreport. Use your real datasource and add Column3 and Column4.
I don't have time to test this, but I think it will display all the columns as you requested.
(Instead of step 1, you can probably use a placegrouper group in your report that only has 1 group. Then, when you add the subreports, make sure to not add any links to the main report.)
Edit
A dynamic number of columns makes this request much more difficult to do in Crystal.
Maybe you could autogenerate the entire report from a script. I couldn't help you with that, but I'm sure someone else on StackOverflow will.
You can use MS Excel to achieve something similar. Use MS Access or something similar to set up a crosstab of your data. Open a new Excel workbook and import your crosstabbed datasource using Data->Import External Data->Import Data (this imports the entire table, regardless of number of rows). In Page Setup, change settings to Fit to (blank) pages wide by 1 pages tall. You can format the data however you like and the format will be retained. This Excel method will squeeze all your columns into a 1-page wide area. It's not quite what you're asking for, but it will work.
The number of columns may be dynamic, but do you know what the field names could be? For example, your columns include 0-50 US States, then you know what the column names will be, just not which ones or how many. If this is your situation, then use my first suggestion (check off the suppress if blank options to hide unneeded subreports). It won't be pretty (alot of white space), but it can get the job done.
A possible solution can be a multi column report. But it can be difficult to make the row labels and values in the same line.
If you can create an additional row grouping then you have the solution that you want. For example if your columns have number like in your sample. Then you can add a formula like:
columnId \ 2