Free Support Forum - aspose.com

Replace Problem

Error message : The replace string cannot contain special or break characters.

Please check attached document. Code is

Table.rows(1).cells(1).range.replace(Table.rows(1).cells(1).text, Table.rows(1).cells(1).text+”_newval”,false,false)

However there are no special chars or new line in this Cell.

Due to some limitations, we can not use RegEx.

Hi

Thanks for your request. Table.rows(1).cells(1).text contains special character “\a”. try to use the following code.

Document doc = new Document(@"241_97257_isrc\IsFeasibleTemplate.doc");

Table table = doc.FirstSection.Body.Tables[0];

table.Rows[1].Cells[1].Range.Replace(table.Rows[1].Cells[1].Range.Text.Replace("\a", ""), table.Rows[1].Cells[1].Range.Text.Replace("\a", "") + "_newval", false, false);

doc.Save(@"241_97257_isrc\out.doc");

I hope that it will help you.

Best regards.