String.Format not working while sending to printer.

G

Guest

Hi

I am trying to print a string with a fixed format usin

StreamReader streamToPrint = new StreamReader(formattedString) ;//("PrintMe.Txt")
try

//Assumes the default printe
TextFilePrintDocument pd = new TextFilePrintDocument(streamToPrint)

PrintDialog dlg = new PrintDialog()
dlg.Document = pd
DialogResult result = dlg.ShowDialog()

if (result == DialogResult.OK)

pd.Print()


}
catch {
finally

tr


streamToPrint.Close()

catch{


I use String.Format to format string as grid. Hopping the printout will always be the same length regardless the value. However, it seems ok for COnsole.Writeline but not working is I sent it to printer as the way above
Any suggestions
Thanks a lo

Chris
 
R

Ron Allen

Chris,
What Font are you doing the output with? To use fixed lengh formatting
it will have to be something like Courier New that has fixed-width
characters.

Ron Allen
chrisben said:
Hi,

I am trying to print a string with a fixed format using

StreamReader streamToPrint = new StreamReader(formattedString) ;//("PrintMe.Txt");
try
{
//Assumes the default printer
TextFilePrintDocument pd = new TextFilePrintDocument(streamToPrint);

PrintDialog dlg = new PrintDialog() ;
dlg.Document = pd;
DialogResult result = dlg.ShowDialog();

if (result == DialogResult.OK)
{
pd.Print();
}

}
catch {}
finally
{
try
{

streamToPrint.Close() ;
}
catch{}
}

I use String.Format to format string as grid. Hopping the printout will
always be the same length regardless the value. However, it seems ok for
COnsole.Writeline but not working is I sent it to printer as the way above.
 
G

Guest

Hi Ron

Thank you for the response. I used Courier and it seems not recognizable by the printer through .NET interface. Courier New is working
Thank

Chris
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top