FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour FASTREPORT how to export Report in “silent” mode
Posts: 6983
Joined: Fri Oct 07, 2005 07:07 PM
FASTREPORT how to export Report in “silent” mode
Posted: Sat Aug 29, 2009 10:02 AM

Does someone know how to export a Report in “silent” mode.
I try:
oFr:SetProperty("PDFExport", "FileName", "Myfile.pdf")
oFr:SetProperty("PDFExport", "OpenAfterExport", .f.)
oFr:PrepareReport()
oFr:DoExport("PDFExport")

But the dialog for inserting the number of pages and selecting the path and document are appearing.

Thanks in advance
Otto

Posts: 858
Joined: Fri Oct 07, 2005 12:00 PM
Re: FASTREPORT how to export Report in “silent” mode
Posted: Sat Aug 29, 2009 01:19 PM

Hi Otto,
I'm not sure this can help you but I had the same problem to send a report via email
and I solved using FrPrn:SetProperty("MailExport","ShowDialog",.f.) to hide the dialog.

Perhaps it runs also with the exports.

Best Regards,



Marco Turco

SOFTWARE XP LLP
Posts: 6983
Joined: Fri Oct 07, 2005 07:07 PM
Re: FASTREPORT how to export Report in “silent” mode
Posted: Sat Aug 29, 2009 01:51 PM
Hello Marco,

thank you very much. Yes this is working with PDFExport, too.

Code (fw): Select all Collapse
oFr:SetProperty("PDFExport", "FileName", "\Myfile.pdf")
oFr:SetProperty("PDFExport", "OpenAfterExport", .f.)
oFr:SetProperty("PDFExport", "ShowDialog",.f.)
oFr:PrepareReport()
oFr:DoExport("PDFExport") .


BTW, are you aware if you can create a password – protected pdf?

Best regards,
Otto
Posts: 6983
Joined: Fri Oct 07, 2005 07:07 PM
Re: FASTREPORT how to export Report in “silent” mode
Posted: Sun Jun 20, 2010 09:50 AM
I found out how to use password with FastReport and PDF export.

oFr:SetProperty("PDFExport", "UserPassword", "PW…" )
oFr:SetProperty("PDFExport", "OwnerPassword", "PW…" )

I tried a „Brute Force“ attack on the protected PDF with
Advanced PDF Password Recovery with no success.

Best regards,
Otto
Posts: 1467
Joined: Mon Oct 10, 2005 11:26 AM
Re: FASTREPORT how to export Report in “silent” mode
Posted: Sun Jun 20, 2010 12:13 PM

Otto,
Marco,

Is it possible for you both to put an complete example of your report, including building a PDF-file or an E-mail ?

I am very interested in these solutions.

Thank you both very much in advance.

Regards,

Michel D.
Genk (Belgium)


_____________________________________________________________________________________________

I use : FiveWin for (x)Harbour v. 25.12 - Harbour 3.2.0 (May 2025) - xHarbour Builder (January 2020) - Bcc773

Posts: 6983
Joined: Fri Oct 07, 2005 07:07 PM
Re: FASTREPORT how to export Report in “silent” mode
Posted: Sun Jun 20, 2010 02:26 PM
Hello Michel,
here is one:

Code (fw): Select all Collapse
function testreport()
   local oFr

   oFr := frReportManager():New()
   oFr:LoadLangRes( "German.xml" )
   oFr:SetIcon( 1 )

   // zimaed is my dbf file and it is in use 
   oFr:SetWorkArea("zimaed", SELECT("zimaed"))

   oFr:SetTitle( "Zimmermaedchenliste" )

   //I use this trick so I can handle individual report templates for different clients.
   //If there is an individual template this is used otherwise the standard one.
   if file( ".\REPS_MY\zimmermaedchenquer.FR3" ) = .t.
      oFr:LoadFromFile( ".\REPS_MY\zimmermaedchenquer.FR3" )
   else
      oFr:LoadFromFile( ".\REPS\zimmermaedchenquer.FR3" )
   endif

   oFr:AddVariable( "FIRMA", "CompanyReport"     , "'" + setup():LizenzNehmer +"'" )
   oFr:AddVariable( "FIRMA", "cCompany"     , "'" + cCompany +"'" )
   oFr:AddVariable( "FIRMA", "cAddr1"       , "'" + cAddr1   +"'" )
   oFr:AddVariable( "FIRMA", "cAddr2"       , "'" + cAddr2   +"'" )
   oFr:AddVariable( "FIRMA", "cAddr3"       , "'" + cAddr3   +"'" )
   oFr:AddVariable( "FIRMA", "cTelefon"     , "'" + cTelefon +"'" )
   oFr:AddVariable( "FIRMA", "cFax"         , "'" + cFax     +"'" )
   oFr:AddVariable( "FIRMA", "cEmail"       , "'" + cEmail   +"'" )
   oFr:AddVariable( "FIRMA", "ComputerNr" , "' PC-Nr: " + cComputerNr +"'" )

   oFr:AddVariable( "FIRMA", "Rooms", Setup():nRooms )
   oFr:AddVariable( "FIRMA", "Beds",  Setup():nBeds )

   oFr:AddVariable( "FIRMA", "Rooms", Setup():nRooms )
   oFr:AddVariable( "FIRMA", "Beds",  Setup():nBeds )

   oFr:AddVariable("Zeitraum", "VonBis", "'" +  left( num2day( dow( ::dDay  ) ),2 ) + " " +  dtoc(  ::dDay  ) + "'")

   //you can call scripts in your report  - depending on the value I for example print a header or not
   if ::lGruppenKopf = .t.
      oFr:AddVariable("Einstellungen", "Gruppenkopf", "'JA'")
   else
      oFr:AddVariable("Einstellungen", "Gruppenkopf", "'NEIN'")
   endif

   oFr:AddVariable("Einstellungen", "TestLogischeVariable", .T. )
   oFr:AddVariable("Einstellungen", "Sortierung", "'" + cSortierung + "'" )

   //for calculating of sums, average etc. I prefer to use Fivewin and pass the results to the report.
   //Errorhandling in FastReport (division through zero, etc.) is not that easy
   oFr:AddVariable("Liste", "Erwachsene", sumerwachsene )
   oFr:AddVariable("Liste", "Kinder", sumkinder )
   oFr:AddVariable("Liste", "Zimmer", ZiSum )
   oFr:AddVariable("Liste", "Anreisen", AnSum )
   oFr:AddVariable("Liste", "Abreisen", AbSum )
   // oFr:AddVariable("My Lovely Vars", "test", 100.25)
   //oFr:AddVariable("My Lovely Vars", "test1", "'Test'")
   //oFr:AddVariable("My Lovely Vars", "test2", ctod("01/01/2007"))
 /*
aadd(adaten,{"name1","strasse1","ort1"})
aadd(adaten,{"name2","strasse2","ort2"})
aadd(adaten,{"name3","strasse3","ort3"})

oFr:SetUserDataSet("aDaten", "name;strasse;ort" , ;
                        {|| x := 1}, ;          //--> bGoTop
                        {|| x := x + 1}, ;      //--> bSkipPlus
                        {|| x := x - 1}, ;      //--> bSkipMinus
                        {|| x > Len(aDaten)}  , ;  //--> bCheckEOF
                        {|aField| nCol := IIF( aField == "name",  1, (IIF( aField == "strasse", 2, 3 ))   ),   aDaten[x, nCol] } )
*/


   //this is a trick I read in our forum.
   //If you press the Control –key during execution of the report the report starts in design mode
   if GETKEYSTATE(VK_CONTROL)
      oFr:DesignReport()
   else

      ****************************************************************************
      //now the report is ready
      ****************************************************************************

      //here you can use export
      oFr:SetProperty("PDFExport", "FileName", ".\Myfile.pdf")
      oFr:SetProperty("PDFExport", "UserPassword", "PW…" ) 
      oFr:SetProperty("PDFExport", "OwnerPassword", "PW…" )
      oFr:SetProperty("PDFExport", "OpenAfterExport", .f.)
      oFr:SetProperty("PDFExport", "UserPassword", "test")
      oFr:SetProperty("PDFExport", "ShowDialog",.f.)
      oFr:PrepareReport()
      oFr:DoExport("PDFExport")

      and/or  you can show the report on screen
      oFr:ShowReport()

   endif

   oFr:DestroyFr()
return


Best regards,
Otto
Posts: 1467
Joined: Mon Oct 10, 2005 11:26 AM
Re: FASTREPORT how to export Report in “silent” mode
Posted: Sun Jun 20, 2010 09:30 PM

Otto,

Thanks a lot for the example.

Regards,

Michel D.
Genk (Belgium)


_____________________________________________________________________________________________

I use : FiveWin for (x)Harbour v. 25.12 - Harbour 3.2.0 (May 2025) - xHarbour Builder (January 2020) - Bcc773

Posts: 24
Joined: Mon Jan 11, 2010 08:18 AM
Re: FASTREPORT how to export Report in “silent” mode
Posted: Tue Jun 22, 2010 03:26 AM

Sir Otto,

Good Day!

   I have this errors: 
             Unresolved external '_HB_FUN_FRREPORTMANAGER' referenced from 'obj....'
             Unresolved external '_HB_FUN_SETUP' referenced from 'obj....'

    Im new fastreport, could you help me to fix the above errors...  tnx a lot.

apollo

FWH10.6|BCC5.82|PELLEC|XMATE
Posts: 6983
Joined: Fri Oct 07, 2005 07:07 PM
Re: FASTREPORT how to export Report in “silent” mode
Posted: Tue Jun 22, 2010 06:01 AM
apollo,
setup():LizenzNehmer
You can remove this line. This is my own function.

Have you linked in FastRepH.prg from FastReport and you need FrSystH.dll to run the programs?

Best regards,
Otto
Posts: 24
Joined: Mon Jan 11, 2010 08:18 AM
Re: FASTREPORT how to export Report in “silent” mode
Posted: Tue Jun 22, 2010 06:14 AM

Dear Sir Otto,

             When I linked the FastRepH.prg to my program, i received duplicate variables errors.  The FrSystH.dll is already present to my exe-folder and system32 folder to make it sure it will accessible anywhere. tnx

apollo

FWH10.6|BCC5.82|PELLEC|XMATE

Continue the discussion