Discrepancy in Word/PDF outputs when unbreakable space is used

Dear Sir or Madam,

We have a client who used the unbreakable spaces in one of his reports (“Non-controlling” in the header of column 5). It makes the outputs look different (see the attached), is there a way to make PDF look like Word output?

Thank you in advance,Test Health Limited-Statement of changes in equity-31122016-Interim Report- 30 December 2016 Draft 2 (2).zip (86.4 KB)

Alex

@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");

The issues you have found earlier (filed as WORDSNET-23424) have been fixed in this Aspose.Words for .NET 22.3 update also available on NuGet.