Hi,
I have a crystal report that prints OK when I send the report directly to
the printer. If i display the report on the screen and then click on the
print icon I get the first couple of characters of each line chopped off on
the printout.
(I am always printing on the same printer and using the same printer driver)
PS: I am using VS.NET 2003 and the version of crystal that ships along with
vs.net 2003
Thanks
Ioannis Demetriades
===== CODE ========
Friend Sub ShowReport(ByVal ReportName As String, ByVal ds As DataSet, ByVal
ParentForm As Form, ByVal ReportCaption As String, ByVal
SendToPrinterDirectly As Boolean, Optional ByVal PrinterName As String = "",
Optional ByVal Parent_AS_Owner As Boolean = False)
Dim StrMsg As String = " ** Unable to Print ** "
Dim Flag As Boolean = False
Try
Dim r As New
CrystalDecisions.CrystalReports.Engine.ReportDocum ent
Dim FileName As String
'All the reports are expected to be located in
'in a subdir called \Reports within the
'current working directory
'FileName = Application.StartupPath & "\Reports\" & ReportName
FileName = Application.StartupPath & "\Reports\" & ReportName
'Filename = application.
r.Load(FileName)
Flag = True
If PrinterName <> "" Then
'Make sure the specified printer is valid
'IsValidPrinter: Sets PrinterName to the default printer
'if the specified printername is not a valid printer
If IsValidPrinter(PrinterName) Then
r.PrintOptions.PrinterName = PrinterName
End If
End If
r.SetDataSource(ds)
ds.Dispose()
If SendToPrinterDirectly Then
r.PrintToPrinter(1, False, 0, 0)
Else
Dim CrystalForm As New CrystalReportForm
If Parent_AS_Owner Then
CrystalForm.Owner = ParentForm
Else
CrystalForm.MdiParent = ParentForm
End If
CrystalForm.Text = "Report: " & ReportCaption
CrystalForm.CrystalViewer.ReportSource = r
CrystalForm.Show()
CrystalForm.BringToFront()
End If
Catch err As Exception
If Flag Then
ShowException(err, StrMsg)
Else
ShowException(err)
End If
End Try
End Sub