Reputation: 57
I have a table with a cell which contains a textframe which contains a table. In some of the cells inside the inside table, I have added a paragraph. Inside the paragraph I have placed text, via the addtext method, like "WordA WordB". The cell's size will cause a line break between "WordA" and "WordB".
The problem is that I am expecting:
WordA
WordB
What I am getting is:
WordA
WordB
Is there a setting somewhere to get what I expect or is this a bug in the renderer?
Upvotes: 1
Views: 924
Reputation: 57
It was a bug in the paragraph rederer (ParagraphRenderer.cs). There were actually 2 bugs I found. The first is if the current line doesn't fit and the next "Text" is a blank (" "). The second is if the current line is a blank (" ") and the next line doesn't fit.
The first bug was easy to fix, I changed the HandleNonFittingLine subroutine to keep advancing until it this.currentLeaf is not a blank (" ").
The second bug was harder to figure out and fix. I had to get the Format function to find the next leaf and pass the Current property, of the Next Leaf, to the FormatElement (if the next leaf exists). I then had to modify the FormatElement function to optionally take a second parameter. Then I modified the FormatElement function by returning FormatResult.Ignore if the current leaf is a blank (" ") and the next leaf doesn't fit on the current line with the blank (" ").
Upvotes: 0
Reputation: 21689
I think it's a bug - a bug that typically shows when words are longer than the column width allows.
For typical scenarios (short words in wide columns) this problem will not show up. With long words in narrow columns you sometimes get this bug. Hyphens or soft hyphens in long words will allow MigraDoc to break the words correctly.
Upvotes: 1