|
-
Mar 23rd, 2006, 09:09 AM
#1
Thread Starter
Lively Member
Not Properly Exporting Report
Hello Friends,
I've used vb6.crystal report8.5 and access in my software. when i print report it's printing fine but when i export that into windows for word format, it is not exactly exporting as it is printing. it's changing bit formatting. plz is there any way to export it in the same manner as it prints. i used following code:
VB Code:
Dim rsStudent As New ADODB.Recordset
Dim sSQL As String
Dim sRepFileName As String
Dim sDiskFile As String
Dim Report As Report
sRepFileName = "Enrol" & Format(Date, "ddmmyy") & Format(Time, "hhmm") & ".doc"
sDiskFile = App.Path & "\letters\" & txtStudentID.Text & "\" & sRepFileName
sSQL = "select * from tblStudent where studentid='" & txtStudentID.Text & "'"
rsStudent.CursorLocation = adUseClient
rsStudent.Open sSQL, cn
Set Report = New rptRegLetter
With Report
.ExportOptions.FormatType = crEFTWordForWindows
.ExportOptions.DiskFileName = sDiskFile
.ExportOptions.DestinationType = crEDTDiskFile
.DiscardSavedData
.RecordSelectionFormula = "{tblStudent.studentid}='" & txtStudentID.Text & "'"
.EnableParameterPrompting = False
.ParameterFields(1).AddCurrentValue sName
.Database.SetDataSource rsStudent
'.PrintOut
.Export False
End With
]
-
Mar 26th, 2006, 02:04 AM
#2
Junior Member
Re: Not Properly Exporting Report
I'm using this code on one of my applications with wonderful results, you may give it a try:
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
|