469,602 Members | 1,818 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,602 developers. It's quick & easy.

Crystal Reports: Margins problem

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

Jul 21 '05 #1
0 2316

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

13 posts views Thread by kristoff plasun | last post: by
3 posts views Thread by Gheaci Maschl | last post: by
7 posts views Thread by p | last post: by
17 posts views Thread by Peter Proost | last post: by
reply views Thread by Wayne Wengert | last post: by
reply views Thread by Ioannis Demetriades | last post: by
reply views Thread by devrayhaan | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.