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

ReplaceText throwing and error

Sep 10, 2009 at 9:00 PM

I just found your project after a few days of trying to do this myself.   I've got a template document that our client wants to replace queue points with values for our system.

 

We have something like   [500] that we’ll replace with a value specified by our application.  When I do ( as an example)

document.ReplaceText(“[500]”, “17.50”, true, RegexOptions.IgnoreCase);

 

I get the following error: Specified argument was out of the range of valid values.

Any ideas?

 

Thanks,

-Jason

Coordinator
Sep 11, 2009 at 8:02 AM
Hello jcavaliere,

it is possible that you have found a new bug. Can you please send me both the document and a code snippet so that I can debug this?

If at all possible, I would suggest changing your approach to this problem. Custom Properties are a much better way of inserting custom values into a document. They are far cleaner and easier to manage than replacing text. I have posted about using CustomProperties with DocX before, you can find this post here scroll down to the text

2) Set custom properties

kind regards,
Cathal