Results 1 to 2 of 2

Thread: Not Properly Exporting Report

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Apr 2002
    Posts
    94

    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:
    1. Dim rsStudent As New ADODB.Recordset
    2.     Dim sSQL As String
    3.     Dim sRepFileName As String
    4.     Dim sDiskFile As String
    5.            
    6.     Dim Report As Report
    7.    
    8.    
    9.     sRepFileName = "Enrol" & Format(Date, "ddmmyy") & Format(Time, "hhmm") & ".doc"
    10.     sDiskFile = App.Path & "\letters\" & txtStudentID.Text & "\" & sRepFileName
    11.  
    12.    
    13.     sSQL = "select * from tblStudent where studentid='" & txtStudentID.Text & "'"
    14.    
    15.     rsStudent.CursorLocation = adUseClient
    16.     rsStudent.Open sSQL, cn
    17.    
    18.     Set Report = New rptRegLetter
    19.    
    20.     With Report
    21.  
    22.         .ExportOptions.FormatType = crEFTWordForWindows
    23.         .ExportOptions.DiskFileName = sDiskFile
    24.         .ExportOptions.DestinationType = crEDTDiskFile
    25.  
    26.         .DiscardSavedData
    27.         .RecordSelectionFormula = "{tblStudent.studentid}='" & txtStudentID.Text & "'"
    28.         .EnableParameterPrompting = False
    29.         .ParameterFields(1).AddCurrentValue sName
    30.         .Database.SetDataSource rsStudent
    31.         '.PrintOut
    32.         .Export False
    33.        
    34.     End With
    ]

  2. #2
    Junior Member
    Join Date
    Nov 2004
    Location
    Laredo, TX.
    Posts
    29

    Exclamation 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:
    1. Private Sub genera_rtf()
    2.     CrystalReport1.ReportFileName = "f:\casachapa\billcasachapa.rpt"
    3.     CrystalReport1.SelectionFormula = "{BLGeneral.BLnumero}=" & Trim(FormSalidas.Text1.Text)
    4.     CrystalReport1.Destination = crptToFile
    5.     CrystalReport1.PrintFileType = crptRTF
    6.     CrystalReport1.PrintFileName = "c:\casachapa\casa.doc"
    7.     CrystalReport1.Action = 1
    8. 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
  •  



Click Here to Expand Forum to Full Width