Special space character

demo.docx (48.7 KB)

Background:

We use aspose word to generate tables. However sometimes, the image does not display normally in table cell.

Figure 1 right of picture is cut off. and position of some words is not correct


Figure 2 expected behavior
After some research, we found that there is special character in sentence.


Figure 3 specical space
The normal space is 32 whereas special one (non-breaking space) is 160. This makes display of word incorrect.

Query:
Why there is one special space character in word content? Any solution for this scenario? (Filter out this kind of space?)

@lkf77081 You can replace non-breaking spaces in your document with regular spaces using code like the following:

Document doc = new Document(@"C:\Temp\in.docx");
doc.Range.Replace(ControlChar.NonBreakingSpace, " ");
doc.Save(@"C:\Temp\out.docx");

when i print the document with aspose ,it look like well .
Does aspose relace the non break space by itself?
And can you teach me how to type a non break space ?

@lkf77081

No, Aspose.Words does not replace non-breaking spaces automatically. It looks like Aspose.Words differently interprets non-breaking space following by a picture. I have logged this issue as WORDSNET-24998.

You can type non-breaking space in MS Word by Ctrl+Shift+Space combination.