Diese Seite mit anderen teilen ...

Informationen zum Thema:
Forum:
WinDev Forum
Beiträge im Thema:
6
Erster Beitrag:
vor 1 Jahr, 4 Monaten
Letzter Beitrag:
vor 1 Jahr, 4 Monaten
Beteiligte Autoren:
steve erts, Arie, Fabrice Harari, GuenterP

Print preview export to PDF issues

Startbeitrag von steve erts am 12.07.2016 22:06

Hi,

I have a Windev 20 application that my client is reporting strange occurrences with the export function in Print Preview window. I can not duplicate this but my clients swears that occasionally the application exports a previous version of report not related to the current record.

Has anyone ever seen anything like this?

Any insight into how the export function works? I pulled the Preview window into my app but can't see any code or actions behind the button or any way to access it.

Thanks!

Steve

Antworten:

Hi Steve,

yes, this is possible and here is why and how:

When exporting to pdf (or any other export, or even printing), the code of the report is executed AGAIN...
This means that if it is based on a query with parameters, on a global variable, on the current record in a table or in a file, and if, between the moment when the preview was started and the moment the second report is printed, this "thing"" has changed, then you'll get another report content...

Of course, even if the report has NO parameter, and the content of the DB has changed between the preview and the second operation, then you may have the same problem.

This is why it is good practice to base your report on something that wont change (by example, you execute a query BEFORE you start your preview, and your report just read it (ie does NOT execute it)... this way, when executed a second time, it will read the same content, as the query was not executed again.

Best regards

von Fabrice Harari - am 12.07.2016 23:27
Hi, our problems with printing / print preview are that format changes are sometimes not recognized. For instance printing on same papersize in portrait and if we change the format to landscape within the same printing, the paper is correctly shown in landscape but the right margin is like portrait. I sent a simple demo using iPrint dcommands to PC Soft and they confirmed this as being a problem. Like Fabrice says, for all printing a dependable source is essential.

von GuenterP - am 13.07.2016 09:30
Quote
Fabrice Harari
Hi Steve,

yes, this is possible and here is why and how:

When exporting to pdf (or any other export, or even printing), the code of the report is executed AGAIN...
This means that if it is based on a query with parameters, on a global variable, on the current record in a table or in a file, and if, between the moment when the preview was started and the moment the second report is printed, this "thing"" has changed, then you'll get another report content...

Of course, even if the report has NO parameter, and the content of the DB has changed between the preview and the second operation, then you may have the same problem.

This is why it is good practice to base your report on something that wont change (by example, you execute a query BEFORE you start your preview, and your report just read it (ie does NOT execute it)... this way, when executed a second time, it will read the same content, as the query was not executed again.

Best regards


Fabrice,

Thanks for the response. I'm using variables local to the screen that the print job is being run from and as the print preview window is modal in nature and the user is unable to make any changes to any data in calling window it still seems odd to me that this could happen. I just don;t see how those variables could be changed.

Do you think the user having multiple sessions of software running concurrently could cause Preview to get mixed up?

On you point about how the calls are made are you suggesting that I put the code for iPreview() AFTER iInitReportQuery ?

This is what call looks like now.

iPreview()
iInitReportQuery(RPT_Trip_Manifest,gnDepartureID,gnTripID)
iPrintReport(RPT_Trip_Manifest,EDT_Report_Vendor,sCheckIn,sCheckOut,sGroupManager,sGroupManagerEmail)

Thanks so much for your help!

steve

von steve erts - am 14.07.2016 21:47
Hi Steve,

maybe the user is misleaded for whatever reason and opens an old file?
Try adding iParameterExport() to pre-define the map+filename of the PDF. Maybe even adding date+time to it.
Have a look at the help for more options.
So it will be more clear to them which of the PDF files (I suppose there are more in the export-map?) is the right one.

von Arie - am 15.07.2016 08:06
Quote
Arie
Hi Steve,

maybe the user is misleaded for whatever reason and opens an old file?
Try adding iParameterExport() to pre-define the map+filename of the PDF. Maybe even adding date+time to it.
Have a look at the help for more options.
So it will be more clear to them which of the PDF files (I suppose there are more in the export-map?) is the right one.


Hi Arie,

That was my first thought as well but the user who reported this is pretty savvy so I'm trying to give her the benefit of the doubt.

I like your suggestion (and Fabrice's) and will give those a try.

Thanks!
steve

von steve erts - am 18.07.2016 16:21
Zur Information:
MySnip.de hat keinen Einfluss auf die Inhalte der Beiträge. Bitte kontaktieren Sie den Administrator des Forums bei Problemen oder Löschforderungen über die Kontaktseite.
Falls die Kontaktaufnahme mit dem Administrator des Forums fehlschlägt, kontaktieren Sie uns bitte über die in unserem Impressum angegebenen Daten.