How can I replace the nonbreaking hyphen character in a Word document with the normal hyphen character (ASCII hex 2D)? I understand that Word does not actually store the nonbreaking hyphen character (Unicode 2011) but rather stores internal information that tells Word to display a hyphen and not to break across a line. If so, is it possible through Aspose.Words to remove this information and insert a hyphen in its place?
In fact MS Word does not use hyphen break characters from Unicode. The following special characters are used instead - 001E for nonbreaking hyphen and 001F for soft hyphen.
So all you need is search and replace nonbreaking hyphen character with normal hyphen character using Document.Range.Replace method.
Hope this helps,
This works. Thanks very much.
I couldn’t find the 001E and 001F codes in any of the Aspose online documentation (e.g., ControlChar class, etc). Are these special character codes documented anywhere on the Aspose Web site? If not, can you point me to another site that might have this kind of information? It would be very useful for me. Thanks.
We discovered hyphen break chars during DOC binary format research not far ago. They are now implemented as non-public members of ControlChar class. Hence, they are not exposed in documentation yet. I think we can make them public in the next hotfix.
The only info about hyphen break chars in MS Word that I was able to find on the internet is
http://www.cs.tut.fi/~jkorpela/dashes.html
and you have probably already seen it.
That is all I currently have on the issue. Hope this information helps.
Best regards,
I added these constants in the next release of Aspose.Words.
Great. What is the code for the nonbreaking space in Word? I’m looking for that right now.
Hi,
It’s (char)160, you can use the ControlChar.NonBreakingSpaceChar constant.