So I have a C1TrueDBGrid on my form (which is a ComponentOne control), and I give the user the option to print the contents of the grid.
When printed, I include a header with some text. This is my code for printing:
Dim dlgPrint As New PrintDialog
dlgPrint.ShowDialog()
dgvList.PrintInfo.PrintEmptyGrid = False
dgvList.PrintInfo.PageHeader = txtDirectory.Text & Environment.NewLine & "Search Term: " & txtSearch.Text & Environment.NewLine
dgvList.PrintInfo.PageSettings.Landscape = True
dgvList.PrintInfo.WrapText = C1.Win.C1TrueDBGrid.PrintInfo.WrapTextEnum.Wrap
dgvList.PrintInfo.RepeatColumnHeaders = True
dgvList.PrintInfo.Print(dlgPrint.PrinterSettings)
dlgPrint.Dispose()
txtDirectory.Text as I'm sure you can imagine contains the path for a directory, which includes back-slashes \ . What actually got printed turned the instances of \S into 1.
For example: txtDirectory.Text = \\Server02\Users\Me\J\Star
page that got printed = \1erver02\Users\Me\J1tar
Is "\S" a printer command for "1" or something? Is there a list somewhere of what all such commands are, if that's the case? Either way, how do I get it to print the actual text?
Thank you!
Updates have been posted to this ComponentOne forum thread.
So what I did was to simply assign the string I want to print to a variable printText
and then replace those special characters accordingly:
printText.Replace("\t", "\\t")
printText.Replace("\p", "\\p")
printText.Replace("\P", "\\P")
printText.Replace("\g", "\\g")
printText.Replace("\G", "\\G")
printText.Replace("\s", "\\s")
printText.Replace("\S", "\\S")
Just note that the "\\t" is not yet working like the others...they are looking into it.
Thanks @DonBoitnott for the original link!