Free Support Forum - aspose.com

Range.Replace Special Characters

I am working with the Document.Range.Replace (Find, Replace, MatchCase, ?).

This function is working great.

But, unfortunately, it throws an error with some text I pull from the database. Reading the documentation, it says it does not allow special characters in the NewString value. Okay, this is great, I can filter my input string to trim off the bad characters.

But, alas, what are the actual values of the special characters? Is there a one to one relationship between ASCII values? What are the translations?

Thanks so much for your help,

STL

Here is a complete list of characters that cannot be inserted:

(char)1
(char)2;
(char)3;
(char)4;
(char)5;
(char)7;
(char)8;
(char)13;
(char)19;
(char)20;
(char)21;

Just to clarify the above a little more.

The API reference says: An exception is thrown if a captured or replacement string contain one or more special characters: paragraph break, cell break, section break, field start, field separator, field end, inline picture, drawing object, footnote.

The constants for all control characters are defined in the ControlChar class http://www.aspose.com/Products/Aspose.Words/Api/Aspose.Words.ControlChar.html