Hi Folks,
That's why I created my own Word Wrapping class, so I was able to measure the height of the wrapped textblock. I'm using this class to add text to a table cell, and resize the height of the cell to fit the wrapped content.
Create an instance of the PdfWordWrapper (see attachment) and feed the class with textblocks by calling the Add method. For each call to this method you can supply a different font and/or brush. After all textblocks have been added, call the Process method.
After that you can read the Size property to check the Height of the wrapped text, and use the Draw method to finally draw the output to an XGraphics object.
Example:
Code:
PdfWrodWrapper wrapper = new PdfWordWrapper(g, XUnit.FromMillimeter(100));
wrapper.Add("Title", titleFont, XBrushes.Black);
wrapper.Add("Content sdflm sldkf smdlfk smdflk sdmflksdmflk sdlfm", contentFont, XBrushes.Black);
wrapper.Process();
double height = wrapper.Size.Height;
wrapper.Draw(g, XUnit.FromMillimeter(71), itemTop + XUnit.FromMillimeter(0.5), PdfWrodWrapper.Alignment.Left);
I hope this stuff is of any use
Grtz,
Wouter Huysentruit