This project has moved. For the latest updates, please go here.

Word Find&Replace with more than 255 characters

Mar 29, 2012 at 2:24 PM

the document.Content.Find.Execute() throws me an error when I try to pass a string with more than 255 characters as the replace value.

maybe I could replace the searchstring with an empty string and write my value directly to that position (while keeping font and style)...

But how would I do that? It's hard to figure all that out as I don't find any good documentation.

Thank you very much in advance

Coordinator
Mar 29, 2012 at 3:06 PM

this is a well known limitation in all the office products. (not a NetOffice mistake)
i have the same problems sometimes in excel with range and given address parameter string.
what i do in this situation is to split the string for multiple calls but this is not possible for search and replace maybe.

another way can looks like as follows:

find.Text = "searchText";
find.Replace.Text = "MyLongTextPartOne{1}";
find.Execute();

find.Text = "{1}";
find.Replace.Text = "MyLongTextPartTwo";
find.Execute();


Not realy funny i know :/

Mar 30, 2012 at 12:31 PM

Yes, it wasn't funny. But it works smoothly now.

Thank you very much, for everything!