Tab control when printing  
Author Message

PostPosted: Visual C# General, Tab control when printing Top

I have the following stringbuilder text with a tab between the words.

for (int i = 0; i < readercounter; i++)


text.Append(resultsArray[i, 0] + "\t").Append(resultsArray[i, 1] + "\t").Append("\r\n");

} // end of for loop


Here are the printer settings.  When the message box displays, I see a tab between the array elements, but when it prints out, there are not any tabs.  Actually, there is no space at all between the two array elements.  How do I get the printer to recognize my tabs   Thanks!


private void printPage(object sender, System.Drawing.Printing.PrintPageEventArgs e)


float leftMargin = e.MarginBounds.Left;

float topMargin = e.MarginBounds.Top;

float yPos = 0;

Font printFont = new Font("Arial", 10);

yPos = topMargin + printFont.GetHeight(e.Graphics);

e.HasMorePages = false;


e.Graphics.DrawString(text.ToString(), printFont, Brushes.Black, leftMargin, yPos, new StringFormat());


Visual C#20  

PostPosted: Visual C# General, Tab control when printing Top

Try doing a replace, just putting the amount of spaces you want for the tabs in the string.

text = text.Replace("\t"," ");