November 15, 2006 at 2:22 pm
Jereme,
here is my PrintObject string.....
Dim MyPrintObject As New TextPrint("<B>Equipment Agreement Form</B>" _
+ vbCrLf + vbCrLf + "<B>Name: </B>" + Trim(oEmployee.LastName) + ", " + Trim(oEmployee.FirstName) + vbCrLf + "<B>Title: </B>" + Trim(oEmployee.Title) + vbCrLf + "<B>Department: </B>" + Trim(oEmployee.Department) + vbCrLf + "<B>Site: </B>" + oEmployee.Site + vbCrLf + "<B>Floor: </B>" + Trim(oEmployee.Floor) + vbCrLf + "<B>Start Date: </B>" + Trim(oEmployee.StartDate) + vbCrLf + "<B>Transfer Date: </B>" + Trim(oEmployee.TransferDate) + vbCrLf + "<B>Termination date: </B>" + oEmployee.TermDate + vbCrLf + "________________________________________________________________________" + vbCrLf + "<B>Room Number: </B>" + Trim(oEmployee.RoomNumber) + vbCrLf + "<B>Telephone: </B>" + Trim(oEmployee.TelephoneLine) + "<B> Extension: </B>" + Trim(oEmployee.Extension) + vbCrLf + "<B>Long Distance Code: </B>" + Trim(oEmployee.LDcode) + vbCrLf + "<B>Meditech Access: </B>" + Trim(oEmployee.MedTechIssu) + "<B> Issue Date: </B>" + Trim(oEmployee.MedTechIssued) + vbCrLf + "<B>PC: </B>" + Trim(oEmployee.PcIssued) + "<B> Issue Date: </B>" + Trim(oEmployee.PCDate) + vbCrLf + "<B>Outlook: </B>" + Trim(oEmployee.EmailIssued) + "<B> Issue Date: </B>" + Trim(oEmployee.EmailIssueDate) + vbCrLf + "<B>Internet: </B>" + Trim(oEmployee.InternetIssued) + "<B> Issue Date: </B>" + Trim(oEmployee.InternetDate) + vbCrLf + "<B>Transcription: </B>" + Trim(oEmployee.TranscriptionID) + "<B> Issue Date: </B>" + Trim(oEmployee.TranscriptionDate) + vbCrLf + "<B>Pager: </B>" + Trim(oEmployee.PagerIssued) + "<B> Issue Date: </B>" + Trim(oEmployee.PagerDate) + vbCrLf + "<B>Cell Phone: </B>" + Trim(oEmployee.CellIssued) + "<B> Issue Date: </B>" + vbCrLf + "<B>Other Equipment: </B>" + vbCrLf + vbCrLf + "<B>Keys: </B>" + vbCrLf + vbCrLf + "<B>Parking Permit: </B>" + Trim(oEmployee.ParkingID) + " <B>Permit Number: </B>" + Trim(oEmployee.PermitNumber) + vbCrLf + "<B>Issue Date: </B>" + Trim(oEmployee.ParkingID) + vbCrLf + "<B>Handicap: </B>" + Trim(oEmployee.handicap) + "<B> Lot Assigned: </B>" + Trim(oEmployee.Lot) + vbCrLf + "<B>Badge: </B>" + Trim(oEmployee.BadgeID) + "<B> Issue Date: </B>" + Trim(oEmployee.BadgeID) + vbCrLf + vbCrLf + "<I>I agree to return items and equipmnet to my department manager at time of termination. Failure to return items or equipment will result in value of items to be withheld from final paychek or accrued leave.</I>" + vbCrLf + "<B>Employee Signature: </B>" + "____________________" + vbCrLf + "<B>Print Name: </B>" + "____________________" + vbCrLf + "<B>Date: </B>" + "______/_____/_________", defPrinter)
this code will print the Bolded line as ....( and in Italics too)
" ag ee o e u n ems an equ pmne o m epa men manage a me o e m na on. a u e o e u n ems o equ pmen esu n a ue o ems o be hh om na pa che o acc ue ea e."
November 15, 2006 at 5:06 pm
I'm sorry Colin, but I can't duplicate your problem. Using my code with the addin I gave you I was able to successfully print your problem code in italics with no missing letters. I would guess that you have made some other modification to the program to cause this.
November 16, 2006 at 10:57 am
Jereme, the only mod I made to your code is to add the Italics in the chekbold function,
hereis what i changed, let me know if this is what you had intended:
For
varPlace = 1 To varString.Length
If Mid(varString, varPlace, 3) = "<B>" Then
printStyle = FontStyle.Bold
varPlace += 2
ElseIf Mid(varString, varPlace, 4) = "</B>" Then
printStyle = FontStyle.Regular
varPlace += 3
ElseIf Mid(varString, varPlace, 4) = "<ST=" Then
varStartPlace =
CInt(Mid(varString, varPlace + 4, _
InStr(varPlace + 4, varString, ">") - (varPlace + 4)))
varPlace += 4 + varStartPlace.ToString.Length
ElseIf Mid(varString, varPlace, 3) = "<I>" Then
printStyle = FontStyle.Italic
varPlace += 2
ElseIf Mid(varString, varPlace, 4) = "</I>" Then
printStyle = FontStyle.Regular
varPlace += 3
Else
ReDim Preserve aryString(3, aryString.GetUpperBound(1) + 1)
aryString(0, aryString.GetUpperBound(1) - 1) = _
Mid(varString, varPlace, 1)
aryString(1, aryString.GetUpperBound(1) - 1) = printStyle
aryString(2, aryString.GetUpperBound(1) - 1) = _
varStartPlace
varStartPlace = -1
End If
November 16, 2006 at 11:12 am
Never mind I figured it out, sort of.
I tried the code without the tahoma font, and it works fine. I looked in my fonts directory and there was a tahoma and a tahoma Bold, but no Tahoma Italics.
November 16, 2006 at 11:35 am
Nice catch, I wouldn't have thought of that; but it makes perfect sense now that you mention it.
November 30, 2011 at 3:49 am
jereme,
How modify the layout margin (left, top)?
November 30, 2011 at 6:59 pm
I'm not in a position to be able to test this at the moment, i'm deployed to Afghanistan, but I believe you can manipulate this line to increase the left hand margin:
Dim xmin As Integer = e.MarginBounds.Left
December 3, 2011 at 7:12 am
Jereme Guenther (11/30/2011)
I'm not in a position to be able to test this at the moment, i'm deployed to Afghanistan, but I believe you can manipulate this line to increase the left hand margin:
Dim xmin As Integer = e.MarginBounds.Left
Thanks for reply...
I've modified it using 'e.MarginBounds.Left / 100' to put left margin to 0 and <ST=...>
One more question..
When I decrease the font size, the space between 'vbCrLf' s doesn't dynamically change. I means the smaller the font size the greater the space between 'vbCrLf' s.
Could you give me clue how to manipulate the code to make the spaces change dynamically to fit the font size?
thanks....
December 3, 2011 at 10:13 am
There are two different areas:
If you want to adjust the height of actual places try this line:
ymin += CInt(the_font.Height)
If you want to adjust the height of actual lines of text.
layout_rect = New RectangleF(xmin, ymin, e.MarginBounds.Right - xmin, the_font.Height)
and
If layout_rect.Height < 1 Then layout_rect.Height = 1
December 25, 2012 at 5:31 pm
If I may, you can add the following lines to allow the user to select any printer using the print dialog in vb.net. Thanks for the coding, by the way.
' provide the user a dialog with which to choose his weapon!
Dim sysPrinter As New PrintDialog()
sysPrinter.ShowDialog()
Dim myprinter As Object = sysPrinter.PrinterSettings.PrinterName 'carry over the user's choices
' Create object, passing in text
Dim MyPrintObject As New TextPrint(docDocument)
' Set font, defaults to times new roman, 12 if omitted
MyPrintObject.Font = New Font("Arial", 11)
MyPrintObject.DefaultPageSettings.PrinterSettings.PrinterName = myprinter 'effect the change from default printer to your choice
' Issue print command
MyPrintObject.Print()
That does it! The use of "docDocument" was a sub that created the formatted document from raw text before sending to the printer.
Viewing 10 posts - 31 through 39 (of 39 total)
You must be logged in to reply to this topic. Login to reply