@AlexanderNovickov Thank you for reporting this problem to us. For a sake of correction it has been logged as WORDSNET-23424. We will keep you informed and let you know once it is resolved.
As a temporary workaround you can remove non-breaking spaces at the beginning and at the end of cells content. For example see the following code:
Document doc = new Document(@"C:\Temp\in\in.docx");
NodeCollection cells = doc.GetChildNodes(NodeType.Cell, true);
foreach (Cell c in cells)
{
if (c.FirstParagraph.IsEndOfCell && c.FirstParagraph.Runs.Count>0)
{
c.FirstParagraph.Runs[0].Text = c.FirstParagraph.Runs[0].Text.TrimStart(ControlChar.NonBreakingSpaceChar);
c.FirstParagraph.Runs[c.FirstParagraph.Runs.Count-1].Text = c.FirstParagraph.Runs[c.FirstParagraph.Runs.Count - 1].Text.TrimEnd(ControlChar.NonBreakingSpaceChar);
}
}
doc.Save(@"C:\Temp\out.pdf");