-
Mar 22nd, 2006, 08:11 AM
#1
Thread Starter
Lively Member
Export Crystal Report in DOC format
Hi Friends,
I've used Access, VB6 and Crystal Report8.5. Now My reports are working fine. But Now I want to add one more facility. I want to export my report in the DOC format. I've used crystal report control (ocx) file and following code to display reports which are stored in "reports" folder of my software.
VB Code:
With crRegistration
.Connect = strConn
.ReportFileName = App.Path & "\reports\RegistrationLetter.rpt"
.WindowTitle = "Registration Conmfirmation Letter"
.SelectionFormula = "{tblStudent.studentid}='" & sStudentId & "'"
.WindowState = crptMaximized
.Destination = crptToPrinter
.printReport
.Action = 1
End With
Plz help me to write a code which saves this report in the folder (folder name has to be entered by user.) . I am not using crystal report viewer control just crystal report activex control. plz help me.
-
Mar 22nd, 2006, 09:10 AM
#2
Thread Starter
Lively Member
Re: Export Crystal Report in DOC format
Hi tried as follows. It works fine but it is displaying all the records. But I want to display only selected one.
VB Code:
Dim rs As New ADODB.Recordset
Dim crystal As CRAXDDRT.Application
Dim Report As CRAXDDRT.Report
rs.CursorLocation = adUseClient
rs.Open "select * from tblStudent where studentid='S15'", cn
Set crystal = New CRAXDDRT.Application
Set Report = crystal.OpenReport("d:\damini\school\reports\RegistrationLetter.rpt")
Report.DiscardSavedData
Report.Database.SetDataSource rs
Report.ExportOptions.FormatType = crEFTWordForWindows
Report.ExportOptions.DiskFileName = "c:\test.doc"
Report.ExportOptions.DestinationType = crEDTDiskFile
Report.Export False
MsgBox "Exported"
so instread of exporting only one record it is exporting all records. also i tried same to view in crystal report viewer control but it is showing for all records and not of only one id.
plz reply ASAP.
thanks in advance
-
Mar 26th, 2006, 02:08 AM
#3
Junior Member
Re: Export Crystal Report in DOC format
In my applications this code works great:
VB Code:
Private Sub genera_rtf()
CrystalReport1.ReportFileName = "f:\casachapa\billcasachapa.rpt"
CrystalReport1.SelectionFormula = "{BLGeneral.BLnumero}=" & Trim(FormSalidas.Text1.Text)
CrystalReport1.Destination = crptToFile
CrystalReport1.PrintFileType = crptRTF
CrystalReport1.PrintFileName = "c:\casachapa\casa.doc"
CrystalReport1.Action = 1
End Sub
VB6 / SQL Server Express 2005.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|