Words split across lines when using tables

I’m seeing an issue where words are occasionally spilling onto the next line. See the attached PDF, which has been generated with the code below, in which the word “living” is split across two different lines.


Apologies for the amount of code involved, but this has issue has been difficult to replicate.

Document pdf = new Document();
Page page = pdf.Pages.Add();
page.PageInfo.Width = 612.0;
page.PageInfo.Height = 792.0;
page.PageInfo.Margin.Top = .6666 * 72;
page.PageInfo.Margin.Bottom = .6666 * 72;
page.PageInfo.Margin.Left = .5 * 72;
page.PageInfo.Margin.Right = .5 * 72;

Table table = new Table();
table.ColumnWidths = “7% 93%”;
table.Border = new BorderInfo(BorderSide.Top, 0.5f, Color.LightGray);

Row row = table.Rows.Add();
row.DefaultCellPadding = new MarginInfo(0, 8, 0, 16);

Cell citeNumCell = row.Cells.Add();
TextFragment citeNumFragment = new TextFragment();
TextSegment citeNumSegment = new TextSegment(“22.”);
citeNumSegment.TextState.FontSize = 14;
citeNumSegment.TextState.LineSpacing = 3;
citeNumSegment.TextState.Font = FontRepository.FindFont(“Arial”);
citeNumFragment.Segments.Add(citeNumSegment);
citeNumCell.Paragraphs.Add(citeNumFragment);
citeNumCell.VerticalAlignment = VerticalAlignment.Top;

Cell articleCell = row.Cells.Add();
TextFragment titleFragment = new TextFragment();
TextSegment titleSegment = new TextSegment(“Lawsuit involving mistreatment of Mrs. Miller by Assisted Living facility " +
“(U.S. District Court, Middle District of Alabama, Northern Division)”);
titleSegment.TextState.FontSize = 14;
titleSegment.TextState.LineSpacing = 3;
titleSegment.TextState.ForegroundColor = Color.DodgerBlue;
titleSegment.TextState.Font = FontRepository.FindFont(“Arial”);
titleFragment.Segments.Add(titleSegment);
articleCell.Paragraphs.Add(titleFragment);
articleCell.VerticalAlignment = VerticalAlignment.Top;

Table subTable = new Table();
subTable.ColumnWidths = “80% 20%”;

Row subRow = subTable.Rows.Add();

Cell subArticleCell = subRow.Cells.Add();
subArticleCell.Margin = new MarginInfo(0, 8, 12, 6);
subArticleCell.VerticalAlignment = VerticalAlignment.Top;
TextFragment subArticleFragment = new TextFragment();
TextSegment subArticleSegment1 = new TextSegment(”… dementia. Sadly, it was a battle she could not win. By the fall of 2000, Miller 's " +
"condition had progressed to the point that she had become incompetent. On 11-1-00, Miller " +
“moved into The Terrace at Grove Park (hereinafter, “Terrace”), an “);
TextSegment subArticleSegment2 = new TextSegment(“assisted”);
TextSegment subArticleSegment3 = new TextSegment(” living facility in Dothan .”);

subArticleSegment1.TextState.Font = FontRepository.FindFont(“Arial”);
subArticleSegment1.TextState.FontSize = 10;
subArticleSegment1.TextState.LineSpacing = 4;
subArticleSegment2.TextState.ApplyChangesFrom(subArticleSegment1.TextState);
subArticleSegment2.TextState.FontStyle = FontStyles.Bold | FontStyles.Italic;
subArticleSegment2.TextState.Underline = true;
subArticleSegment3.TextState.ApplyChangesFrom(subArticleSegment1.TextState);

subArticleFragment.Segments.Add(subArticleSegment1);
subArticleFragment.Segments.Add(subArticleSegment2);
subArticleFragment.Segments.Add(subArticleSegment3);
subArticleCell.Paragraphs.Add(subArticleFragment);

Cell subListCell = subRow.Cells.Add();
subListCell.VerticalAlignment = VerticalAlignment.Top;
subListCell.Margin = new MarginInfo(0, 8, 0, 6);

TextFragment subListFragment1 = new TextFragment();
TextSegment subListSegment1 = new TextSegment(“Jurisdiction”);
subListSegment1.TextState.ApplyChangesFrom(subArticleSegment1.TextState);
subListSegment1.TextState.FontStyle = FontStyles.Bold;
subListFragment1.Segments.Add(subListSegment1);

TextFragment subListFragment2 = new TextFragment();
TextSegment subListSegment2 = new TextSegment(“Alabama”);
subListSegment2.TextState.ApplyChangesFrom(subArticleSegment1.TextState);
subListFragment2.Segments.Add(subListSegment2);

subListCell.Paragraphs.Add(subListFragment1);
subListCell.Paragraphs.Add(subListFragment2);

articleCell.Paragraphs.Add(subTable);
page.Paragraphs.Add(table);

pdf.Save(@“c:\pdf-test\out.pdf”);

Hi Keith,

Thanks for your inquiry. I have tested your scenario with Aspose.Pdf for .NET 10.6.0 and managed to observe the reported issue. For further investigation, I have logged an issue in our issue tracking system as PDFNEWNET-39119 and also linked your request to it. We will keep you updated via this thread regarding the issue status.

Please feel free to contact us for any further assistance.

Best Regards,

The issues you have found earlier (filed as PDFNEWNET-39119) have been fixed in Aspose.Pdf for .NET 10.8.0.


This message was posted using Notification2Forum from Downloads module by Aspose Notifier.