PDFsharp & MigraDoc Forum https://forum.pdfsharp.net/ |
|
Line breaks within table cell not rendering correctly when u https://forum.pdfsharp.net/viewtopic.php?f=2&t=4856 |
Page 1 of 1 |
Author: | sarey [ Mon Jun 02, 2025 2:08 pm ] |
Post subject: | Line breaks within table cell not rendering correctly when u |
Hi all, I’m using MigraDoc to render formatted text into a PDF, and I’ve encountered an issue with line breaks inside table cells. In our WPF application, we use MigraDoc to generate PDFs from rich text input. Users often press Shift+Enter to insert a line break (without starting a new paragraph). We’re seeing unexpected behavior in the generated PDF: line breaks added via Shift+Enter seem to be collapsed or ignored — but only when they occur without text directly before them. Input in the app (typed in a table cell): Quote: abc <Shift+Enter> def <Shift+Enter> <Shift+Enter> <Shift+Enter> ghi Expected output in pdf: Quote: abc def ghi Actual output: Quote: abc def ghi The three AddLineBreak() calls between def and ghi seem to be collapsed (only one line shown). It appears that if the paragraph has no text content, MigraDoc silently skips the line break. Is this the intended behavior in MigraDoc? Is there official documentation or a GitHub issue explaining why line breaks are ignored unless the paragraph already contains content? Any confirmation or workaround recommendations would be greatly appreciated. Thanks! |
Author: | Thomas Hoevel [ Wed Jun 04, 2025 11:05 am ] |
Post subject: | Re: Line breaks within table cell not rendering correctly wh |
Hi! You mention Shift+Enter at the top and AddLineBreak at the bottom of your post. Line breaks added with AddLineBreak should not be ignored. Whitespace may be trimmed from strings and it is not recommend to use "\r" or "\n" in strings. You can use the IssueSubmissionTemplate to submit a project that allows us to replicate the issue. https://docs.pdfsharp.net/General/Issue ... About.html |
Page 1 of 1 | All times are UTC |
Powered by phpBB® Forum Software © phpBB Group https://www.phpbb.com/ |