943,868 Members | Top Members by Rank

Ad:
  • VB.NET Discussion Thread
  • Unsolved
  • Views: 786
  • VB.NET RSS
Sep 11th, 2008
0

not properly printing RTF document

Expand Post »
printing RTF document in VB was OK. After converting to VB.NET, the RTF file being printed is placed wrongly on the paper and there is next page problem
the code is like that
Public Function Yaz(ByRef argFileName As String, ByRef argValues As Dictionary(Of String, String), Optional ByRef argPreview As Boolean = True, Optional ByRef argFormCaption As String = "Yazdırma Ekranı", Optional ByRef argDeviceName As String = "", Optional ByRef argReadOnly As Boolean = False) As Boolean
Dim lcRTFText As String
Dim lcTextFile As Boolean
Dim lcPrinter As String

Yaz = False

Try
mErrorCode = 0
mReason = ""
'ali-
mPrinted = False

If Not argDeviceName = String.Empty Then
mPreviewForm.PrintDocument1.PrinterSettings.PrinterName = String.Empty
End If

If Not argDeviceName = String.Empty Then
For Each lcPrinter In PrinterSettings.InstalledPrinters
If lcPrinter.ToLower = argDeviceName.ToLower Or _
lcPrinter.ToLower.IndexOf(argDeviceName.ToLower) > 0 Then
mPreviewForm.PrintDocument1.PrinterSettings.PrinterName = lcPrinter
Exit For
End If
Next
End If

If mPreviewForm.PrintDocument1.PrinterSettings.PrinterName = String.Empty Then
mErrorCode = -2
mReason = "Uygun yazıcı bulunamadı! (Aranılan Yazıcı Adı = " + argDeviceName + ")" + Environment.NewLine + "Lütfen yazıcınızı kontrol edip tekrar deneyiniz..."
Exit Function
End If

lcTextFile = argFileName.Substring(argFileName.Length - 3, 3).ToLower = "log" Or argFileName.Substring(argFileName.Length - 3, 3).ToLower = "txt"
If File.Exists(argFileName) Then
lcRTFText = File.ReadAllText(argFileName) 'open rtf file
Else
lcRTFText = File.ReadAllText(argFileName.Substring(0, argFileName.Length - 3) & "txt")
End If

If lcTextFile Then
lcRTFText = mConvertKeys(lcRTFText, argValues, False) 'convert
If argPreview Then
'ali-
If argReadOnly Then
mPreviewForm.cmdPrint.Enabled = False
Else
mPreviewForm.cmdPrint.Enabled = True
End If
'form gösterilecek
mPreviewForm.Text = argFormCaption
mPreviewForm.rtxt.Rtf = lcRTFText
mPreviewForm.ShowDialog()
Else
mPreviewForm.rtxt.Rtf = lcRTFText
mPreviewForm.PrintDocument1.Print()
End If
Else
mFontOnEk = mFind_FontOnek(lcRTFText) 'font oneklerini bulur
lcRTFText = mConvertKeys(lcRTFText, argValues) 'convert
If argPreview Then
'ali-
If argReadOnly Then
mPreviewForm.cmdPrint.Enabled = False
Else
mPreviewForm.cmdPrint.Enabled = True
End If
'form gösterilecek
mPreviewForm.Text = argFormCaption
mPreviewForm.rtxt.Rtf = lcRTFText
mPreviewForm.ShowDialog()
Else
mPreviewForm.rtxt.Rtf = lcRTFText
mPreviewForm.PrintDocument1.Print()
End If

End If

Yaz = True

Catch ex As Exception
mErrorCode = -1
mReason = ex.Message()
End Try
End Function

help me !!!!!
Reputation Points: 10
Solved Threads: 0
Newbie Poster
neslihan is offline Offline
1 posts
since Sep 2008

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in VB.NET Forum Timeline: Help creating Reports using Vb.net 2008 build in Reporting tool.
Next Thread in VB.NET Forum Timeline: Connecting VB .NET with SQL Dbase





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC