Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Reporting with Crystal Reports 7
Message
From
26/10/1999 09:47:41
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
 
 
To
26/10/1999 09:15:57
Antonio Gubaira
Ingenieria Y Sistemas
Valencia, Venezuela
General information
Forum:
Visual FoxPro
Category:
Reports & Report designer
Miscellaneous
Thread ID:
00281461
Message ID:
00281476
Views:
25
>Hi,
>
>I have just purchased Crystal Reports 7.0 because I need to include in my application reports with .RTF or .DOC format in order to attach these to emails. I do not have any previous experience with this software, but according to some messages received in this forum, CR is right for the job.
>
>For those of you with experience using CR, which would be the path to follow (in general terms) to generate a report with any of the above formats and incorporate it to my application ?


You should first create an .RPT (say myTest.RPT) with some table - (say myTable in "c:\myCR_RPT_Files\" ). Then this code might help you as a starter :
Select * from myTable where Something into cursor myCursor
_CRReport("myCursor","c:\myCR_RPT_Files\", "myTest.RPT", "myTable")

Function _CRReport
  Lparameters tcCursorName, tcPath, tcRPTName, tcTableName

  lcAlias = alias()
  Select (tcCursorName)
  lcTemp = sys(2015)
  Copy to (tcPath+lcTemp) type fox2x
  oCrystal=CreateObject("Crystal.CRPE.Application")
  #Define WS_MAXIMIZE  29949952
  Declare integer GetForegroundWindow in WIN32API
  Declare short IsWindow in WIN32API integer


  oRpt = oCrystal.OpenReport(tcRPTName)
  With oRpt
    With .Database.Tables(tcTableName)
      .Location = tcPath+lcTemp+".dbf"
    Endwith
    With .PrintWindowOptions
      .CanDrillDown = .t.
      .HasCancelButton = .t.
      .HasCloseButton = .t.
      .HasExportButton = .t.
      .HasGroupTree = .t.
      .HasNavigationControls = .t.
      .HasPrintButton = .t.
      .HasPrintSetupButton =.t.
      .HasProgressControls  =.t.
      .HasRefreshButton  =.f.
      .HasSearchButton  =.t.
      .HasZoomControl  =.t.
    Endwith
    .preview ("Report Preview "+"by Cet",,,,,WS_MAXIMIZE,0)
  Endwith
  lnHwndActiveX = GetForegroundWindow()	&& Save window handle
  Do while IsWindow(lnHwndActiveX) # 0  && Wait while Activex Alive
  Enddo
  Clear dlls

  Erase (tcPath+lcTemp+".*")
  If !empty(lcAlias) and used(lcAlias)
    Select (lcAlias)
  Endif
Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform