Page 1 of 1

Repeat the Header in each page

Posted: Sun Jul 18, 2010 7:40 pm
by NingImport
Repeat the Header in each page

Posted by Josep M on January 9, 2010 at 11:23am

Hi,

I have some questions:

How repeat the header in each page? Only I get the first but nothing in the next ones.

Also I like to put the number o pages that have the report, like "Page" X "of" Y.

Salut,
Josep

=====

Reply by Jan Schenkel on January 10, 2010 at 10:45pm

Hi Josep,

The 'Header' band will automatically appear on each page - the optional 'Title' band will only appear on the first page. If for some reason your 'Header' band is only shown on the first page, that is not the intended behaviour - feel free to email it to me and I'll take a look.

As for page numbering, that's a tricky problem. The library cannot know beforehand how many pages it will take to print all the data, and each data field expression is evaluated right away as the report is built. So there is currently no solution for printing the total number of pages.
But you can print the current page number by adding a data field with expression:
"Page" && qrtReports_GetCurrentPage()

HTH,

Jan Schenkel
--
Quartam Reports & PDF Library for Revolution
www.quartam.com

=====

Reply by Josep M on January 29, 2010 at 4:13pm

Hi,

I need show the footer in the first or in the last page if the report have more than one page. It's posible?
By default the the footer is showed in each page.


Salut,
Josep

=====

Reply by Jan Schenkel on February 1, 2010 at 9:23pm

Hi Josep,

There is currently no FirstPageHeader or LastPageFooter band. This is on the shortlist for the next major release of Quartam Reports. So right now, Header and Footer bands appear on each page.
The closest you can get to this behavior right now, is by removing the Footer band, and using a Summary band to hold the items instead; the problem is that the Summary band is not printed at the bottom of the page, but directly after the last detail line or group footer.

Jan Schenkel
--
Quartam Reports & PDF Library for Revolution
www.quartam.com

=====

Reply by Josep M on February 1, 2010 at 10:07pm

Hi Jan,

If it must be showed it's posible to fill the data of the footer only in the last page?

Salut,
Josep

=====

Reply by Jan Schenkel on February 2, 2010 at 6:28am

Hi Josep,

As the library during the building process doesn't know if it's on the last page or not, you can't use a printing condition to make items hide or disappear. The only proper solution is new FirstPageHeader and LastPageFooter bands, but that is not something I plan to add in the Quartam Reports 1.1.x cycle.

Sorry,

Jan Schenkel
--
Quartam Reports & PDF Library for Revolution
www.quartam.com

=====

Reply by Josep M on February 2, 2010 at 9:25am

Hi Jan,

I understand you. In my case I printing invoices, if the invoice have more of one page, the total amount will be printed only in the last page, and not in each page, this can confuse the user, and printed at the end of the last page.

I guess that I can I know the number of pages previously to print the report, so hidden some field that the report uses isn't posible to condition the print?

It's very important show correctly the invoices.

Salut,
Josep

=====

Reply by Jan Schenkel on February 2, 2010 at 7:34pm

Hi Josep,

Assuming for a minute that you're printing a report for a database cursor, you could have a script like:
##
global gPageCount
on mouseUp
-- get your connection id and sql query here
put revdb_query(theConnectionId, theSqlQuery) into theCursorId
put revdb_recordcount(theCursorId) into theRecordCount
put theRecordCount div theNumberOfRecordsPerPage into gPageCount
if theRecordCount mod theNumberOfRecordsPerPage > 0 then
add 1 to gPageCount
end if
-- also determine the path to the .qrl file as well as the preview flag (true/false)
qrtReports_PrintReportForCursor theLayoutPath, theCursorId, thePreviewFlag, "all", "gPageCount"
-- clean up afterwards
get revdb_closecursor(theCursorId)
end mouseUp
##

And then the items in your Footer band can have a printing condition that compares the current page and the page count that you stored in that global variable gPageCount:
## --> for items that should only be printed on the last page
qrtReports_GetCurrentPage() = gPageCount
## --> for items that should be printed on all other pages
qrtReports_GetCurrentPage() < gPageCount
##

Note that the Footer band will have the same height, regardless of the page you're printing - Header and Footer bands cannot stretch.

HTH,

Jan Schenkel
--
Quartam Reports & PDF Library for Revolution
www.quartam.com

=====

Reply by Josep M on February 2, 2010 at 8:45pm

Hi Jan,

I use your invoice sample as base, reading from the stack, so the stack already have the records retriebed from the db. I move from the datagrid to one table field like you use in you invoce sample.

Its not a problem to show the Footer band.
The printing conditions are inside the field conditions, isn't?


Salut,
Josep

=====

Reply by Jan Schenkel on February 3, 2010 at 7:40am

Hi Josep,

The technique works regardless of the type of data source: divide the number of detail lines by the number of detail bands that will fit one one page, to determine the actual page count.
Every item in your report layout can have a printing condition attached to it (select it and go to the Properties palette, switch to the tab 'Printing condition', where you can enter an expression - you just need to make sure evaluating it returns "true" in order for the item to be actually printed)

By the way, please stick with a data grid - the table field approach that is part of the examples set, is only there because that's all we had at the time :-)

Cheers,

Jan Schenkel
--
Quartam Reports & PDF Library for Revolution
www.quartam.com

=====

Reply by Josep M on February 3, 2010 at 8:35am

Hi Jan,

Thanks for your help, I will try it and post the results.

Any date for the next release of Reports?

Salut,
Josep

=====

Reply by Josep M on February 2, 2010 at 9:35am

Hi again Jan,

And using the PDF library? Can be posible print only the footer in the last page?

=====

Reply by Jan Schenkel on February 2, 2010 at 7:37pm

Hi Josep,

The PDF printing library is faced with the same problem: when it sends the qrtPDF_PrintFooter callback, it passes the current page number, but the callback handler doesn't know at that point if this would be the last page - unless you calculate a gPageCount variable beforehand, similar to the pprevious example for qrtReports.

HTH,

Jan Schenkel
--
Quartam Reports & PDF Library for Revolution
www.quartam.com