We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Remove Nonbreaking Space Characters

I am inspecting the text of a paragraph node by doing node.getText().

I am then looking at the individual characters of that string. If I come across a character that is non breaking space character, by doing (int) ch == 160… How can I remove that character from that node?


Hi Steven,

Thanks for your inquiry. Please use the latest version of Aspose.Words for Java 16.12.0 and try following code example. Hope this helps you.

Document doc = new Document("Your Document Name");
doc.getRange().replace(ControlChar.NON_BREAKING_SPACE, "", new FindReplaceOptions());

For more information please visit Find and Replace & Aspose.Words Document Object Model. If you still face problem, please share your input and expected output documents. We will then provide you more information on this.