Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Skipping and dups when printing fillable pdfs
Message
 
 
À
23/03/2010 10:29:10
Information générale
Forum:
Visual FoxPro
Catégorie:
Gestionnaire de rapports & Rapports
Versions des environnements
Visual FoxPro:
VFP 9 SP2
OS:
Windows XP SP2
Network:
Windows 2000 Server
Database:
Visual FoxPro
Application:
Desktop
Divers
Thread ID:
01456159
Message ID:
01456537
Vues:
48
Debra,

You may want to test the return value of ShellExecute as well. In addition, you may add a do while loop right after ShellExecute to test for the file being created.

>
>LOCAL lcfile
>
>lcfile = m.pcfile
>
>if vartype(lcfile) <> "C" OR empty(ALLTRIM(lcfile)) 
>	messagebox("No parameters passed to printpdf.", 0+16+0,"Error")
>	return .f.
>endif
>
>**ShellExecute API declaration
>DECLARE INTEGER ShellExecute ;
>	IN SHELL32.DLL ;
>	INTEGER nWinHandle,;
>	STRING cOperation,;   
>	STRING cFileName,;
>	STRING cParameters,;
>	STRING cDirectory,;
>	INTEGER nShowWindow
>
>* Open.
>* ShellExecute(0, "Open", lcfile, "", "", 1)
>
>* Print.
>ShellExecute(0, "Print", lcfile, "", "", 0)
>
>return .t.
>
>
>
>
>
>
>>Can you post code for PrintPDF() method?
>>
>>>
>>>I just put the code in to check if STRTOFILE returns successfully. It does, every time.
>>>
>>> I filled three reports and printed them. The first one printed, it skipped the second one, and printed the third one twice. Do you see anything else in my code that could be causing this?
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>>You should check if operation completed successfully
>>>>
>>>>lnBytesWritten = STRTOFILE(lcstring, trim(goapp.cpathshared) + "w2\" + ALLTRIM(lcyear) + '\8655out.xfdf', 0)
>>>>
>>>>IF lnBytesWritten = 0
>>>>  * Cannot write to the file
>>>>  * Do whatever
>>>>  ...
>>>>ENDIF
>>>>
>>>>
>>>>
>>>>>No. Here's the code.
>>>>>
>>>>>* Update the xfdf file.
>>>>>lccurdir = CURDIR()
>>>>>CD trim(goapp.cpathshared) + "w2\" + ALLTRIM(lcyear)
>>>>>DELETE file '8655out.xfdf'
>>>>>CD &lccurdir
>>>>>
>>>>>STRTOFILE(lcstring, trim(goapp.cpathshared) + "w2\" + ALLTRIM(lcyear) + '\8655out.xfdf', 0)
>>>>>
>>>>>lcxfdf = trim(goapp.cpathshared) + "w2\" + ALLTRIM(lcyear) + '\8655out.xfdf'
>>>>>
>>>>>* Print the populated form.
>>>>>SET CONSOLE OFF
>>>>>SET HEADINGS OFF
>>>>>
>>>>>thisform.printpdf(lcxfdf)
>>>>>
>>>>>* Wait 10 seconds.
>>>>> WAIT 'Printing the 8655 form...' window timeout 10
>>>>> WAIT CLEAR
>>>>>
>>>>>SET HEADINGS ON
>>>>>SET CONSOLE ON
>>>>>
>>>>>
>>>>>>When you write back to the .xfdf file, do you check if operation completed successfully or failed?
>>>>>>
If it's not broken, fix it until it is.


My Blog
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform