3

TextFrames in MigraDoc are really handy but when i add paragraphs to the textframes that exceeds the boundary of the text frame, it simply overflows beyond the frame. But I dont want the text to go beyond the frame .

I have defined text frame boundaries

  TextFrame textFrame = new TextFrame();
        textFrame.RelativeHorizontal = RelativeHorizontal.Page;
        textFrame.RelativeVertical = RelativeVertical.Page;


        textFrame.WrapFormat.DistanceLeft = new Unit(_mContainer.dimension.X, UnitType.Point);
        textFrame.WrapFormat.DistanceTop = new Unit(_mContainer.dimension.Y, UnitType.Point);   


        textFrame.Width = new Unit(_mContainer.dimension.Width, UnitType.Point);
        textFrame.Height = new Unit(_mContainer.dimension.Height, UnitType.Point);  
Sabareesh Kkanan
  • 1,201
  • 1
  • 14
  • 22

2 Answers2

0

I'm afraid you cannot currently prevent the TextFrames from overflowing.

So make sure the texts fit - or truncate them before adding them to the TextFrame.

0

You may have already found this from here: http://forum.pdfsharp.net/viewtopic.php?f=2&t=682

The solution is embed a Table inside the TextFrame. The Table only contains one row, one column, but it expands to the content, as the TextFrame expands to the Table.

Alan McBee
  • 4,202
  • 3
  • 33
  • 38
  • Ah. You want to clip the content. That wasn't as clear. I read your question as complaining that the frame wasn't expanding to surround the text. – Alan McBee Dec 04 '13 at 03:39
  • I'm not a full-on expert on MigraDoc -- but reading through the MigraDoc source code, I don't see built-in clipping support. My guess is that you would need to extend the source code yourself, or directly manipulate the XGraphics objects yourself. – Alan McBee Dec 04 '13 at 03:40