FASTREPORT how to export Report in “silent” mode

FASTREPORT how to export Report in “silent” mode

Postby Otto » 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
********************************************************************
mod harbour - Vamos a la conquista de la Web
modharbour.org
https://www.facebook.com/groups/modharbour.club
********************************************************************
User avatar
Otto
 
Posts: 6364
Joined: Fri Oct 07, 2005 7:07 pm

Re: FASTREPORT how to export Report in “silent” mode

Postby Marco Turco » Sat Aug 29, 2009 1: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
User avatar
Marco Turco
 
Posts: 858
Joined: Fri Oct 07, 2005 12:00 pm
Location: London

Re: FASTREPORT how to export Report in “silent” mode

Postby Otto » Sat Aug 29, 2009 1:51 pm

Hello Marco,

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

Code: Select all  Expand view  RUN
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
********************************************************************
mod harbour - Vamos a la conquista de la Web
modharbour.org
https://www.facebook.com/groups/modharbour.club
********************************************************************
User avatar
Otto
 
Posts: 6364
Joined: Fri Oct 07, 2005 7:07 pm

Re: FASTREPORT how to export Report in “silent” mode

Postby Otto » Sun Jun 20, 2010 9: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
********************************************************************
mod harbour - Vamos a la conquista de la Web
modharbour.org
https://www.facebook.com/groups/modharbour.club
********************************************************************
User avatar
Otto
 
Posts: 6364
Joined: Fri Oct 07, 2005 7:07 pm

Re: FASTREPORT how to export Report in “silent” mode

Postby driessen » 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. 24.07 - Harbour 3.2.0 (February 2024) - xHarbour Builder (January 2020) - Bcc773
User avatar
driessen
 
Posts: 1422
Joined: Mon Oct 10, 2005 11:26 am
Location: Genk, Belgium

Re: FASTREPORT how to export Report in “silent” mode

Postby Otto » Sun Jun 20, 2010 2:26 pm

Hello Michel,
here is one:

Code: Select all  Expand view  RUN
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
********************************************************************
mod harbour - Vamos a la conquista de la Web
modharbour.org
https://www.facebook.com/groups/modharbour.club
********************************************************************
User avatar
Otto
 
Posts: 6364
Joined: Fri Oct 07, 2005 7:07 pm

Re: FASTREPORT how to export Report in “silent” mode

Postby driessen » Sun Jun 20, 2010 9:30 pm

Otto,

Thanks a lot for the example.
Regards,

Michel D.
Genk (Belgium)
_____________________________________________________________________________________________
I use : FiveWin for (x)Harbour v. 24.07 - Harbour 3.2.0 (February 2024) - xHarbour Builder (January 2020) - Bcc773
User avatar
driessen
 
Posts: 1422
Joined: Mon Oct 10, 2005 11:26 am
Location: Genk, Belgium

Re: FASTREPORT how to export Report in “silent” mode

Postby amnunez » Tue Jun 22, 2010 3: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
amnunez
 
Posts: 24
Joined: Mon Jan 11, 2010 8:18 am

Re: FASTREPORT how to export Report in “silent” mode

Postby Otto » Tue Jun 22, 2010 6: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
********************************************************************
mod harbour - Vamos a la conquista de la Web
modharbour.org
https://www.facebook.com/groups/modharbour.club
********************************************************************
User avatar
Otto
 
Posts: 6364
Joined: Fri Oct 07, 2005 7:07 pm

Re: FASTREPORT how to export Report in “silent” mode

Postby amnunez » Tue Jun 22, 2010 6: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
amnunez
 
Posts: 24
Joined: Mon Jan 11, 2010 8:18 am


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 69 guests