21

This is the output i get when i use DrawString.

I=Smith,John II=Johnson,Mark III=Anderson,James IV=William,Craig V=Ford,He...

page is a float datatype which value is based on e.PageSettings.Margins.Left;

e.Graphics.DrawString(Text, new System.Drawing.Font("Arial", 8F, FontStyle.Regular), Brushes.Black, page, 30);

In the above example, it is

e.Graphics.DrawString(Text, new System.Drawing.Font("Arial", 8F, FontStyle.Regular), Brushes.Black, page, 30);

I tried using this

StringFormat format = new StringFormat();            
format.FormatFlags = StringFormatFlags.FitBlackBox;

 e.Graphics.DrawString(Text, new System.Drawing.Font("Arial", 8F, FontStyle.Regular), Brushes.Black, page, 30, format);

How do i expand/word wrap so that i can have the entire words instead of '...' at the end?

I=Smith,John II=Johnson,Mark III=Anderson,James IV=William,Craig V=Ford,Henry

Sharpeye500
  • 8,775
  • 25
  • 95
  • 143

1 Answers1

38

You can "word wrap" the text by using a bounding rectangle.

Use Graphics.DrawString Method (String, Font, Brush, RectangleF, StringFormat)

The RectangleF specifies the draw area and it will automatically "wrap" your text for you.

Sorean
  • 985
  • 16
  • 27