Recent

Author Topic: LazReport: Report Pages Count  (Read 6704 times)

InfoMan

  • New Member
  • *
  • Posts: 49
LazReport: Report Pages Count
« on: April 01, 2012, 08:26:55 pm »
Good afternoon, everyone!

I'm using LazReports to view the reports in my program. Everything is going very well, but how do I know the number of pages that the report will have when printed without viewing it first? I have a button that will print the report directly, but use it only prints the first page. How do I fix this? Thanks to all who respond.

JD

  • Hero Member
  • *****
  • Posts: 1758
Re: LazReport: Report Pages Count
« Reply #1 on: April 01, 2012, 09:14:40 pm »
Look at the sample programs in the Lazarus\components\lazreport\samples directory.

They'll show you how to print preview reports and how to print reports with many pages.
Windows (10, 7) - Lazarus 2.0RC3/FPC 3.2, NewPascal, Delphi

Indy 10.6 series; mORMot; Zeos 7.2.1; SQLite, Firebird, PostgreSQL & MariaDB; VirtualTreeView 5.5.3 R1

InfoMan

  • New Member
  • *
  • Posts: 49
Re: LazReport: Report Pages Count
« Reply #2 on: April 01, 2012, 09:58:01 pm »
I've done it and still not working. Still printed only one page.

JD

  • Hero Member
  • *****
  • Posts: 1758
Re: LazReport: Report Pages Count
« Reply #3 on: April 02, 2012, 12:07:19 am »
Can you post some of your code or a sample project here?
Windows (10, 7) - Lazarus 2.0RC3/FPC 3.2, NewPascal, Delphi

Indy 10.6 series; mORMot; Zeos 7.2.1; SQLite, Firebird, PostgreSQL & MariaDB; VirtualTreeView 5.5.3 R1

InfoMan

  • New Member
  • *
  • Posts: 49
Re: LazReport: Report Pages Count
« Reply #4 on: April 02, 2012, 02:15:35 am »
Unfortunately, I think there's no way it would have to post the entire program for that. It turns out that I am developing a program that reads DBF files exported by another program and from these DBFs I view various reports.

The access component Tdbf called DadosEsp. The component is called LazReport RelEsp. I have a button on the form that prints the form. Basically after specifying the required data such as: Name of the report, and others use the following code:

  DadosEsp.PrepareReport RelEsp.PrintPreparedReport then if ('1 ', 1);

I've tried changing the value ('1 ', 1) for other values ​​but it keeps printing only the first page, even putting eg ('100', 1).

Absolutely no way to solve this, but until now could not. Thanks to all who respond.

InfoMan

  • New Member
  • *
  • Posts: 49
Re: LazReport: Report Pages Count
« Reply #5 on: April 04, 2012, 05:01:36 am »
I managed to solve this: I declared a public variable called pages and put it on call and ready for printing. It worked.

What is strange to me that I had made a line of code like this: Pages: = IntToStr (RelEsp.pages.count), but this line just disappeared from my project. But it is working. Strange but okay.

mirce.vladimirov

  • Full Member
  • ***
  • Posts: 220
Re: LazReport: Report Pages Count
« Reply #6 on: April 04, 2012, 09:16:54 pm »
You should first prepare the report an then print it :
Code: [Select]
frReport1.PrepareReport;
frReport1.PrintPreparedReport('1-9999',1);
this works in my application. No preview, just printing

InfoMan

  • New Member
  • *
  • Posts: 49
Re: LazReport: Report Pages Count
« Reply #7 on: April 05, 2012, 02:25:05 am »
Thank you for the tip. I do it.