OfficeDev / Open-Xml-PowerTools

MIT License
692 stars 26 forks source link

search and replace with string.empty as the replace throws exception #240

Closed pmcquay closed 5 years ago

pmcquay commented 6 years ago

index out of bounds exception.

Pretty sure its because of this line in textreplacer:

if (textValue[0] == ' ' || textValue[textValue.Length - 1] == ' ')

I haven't actually debugged this using this library, but I was getting the same exception with this library, and tried something else using this: http://www.ericwhite.com/blog/search-and-replace-text-in-an-open-xml-wordprocessingml-document/ code, which I am thinking is related. There is a very similar line there that was at fault as well.

tomjebo commented 5 years ago

Closing all issues as this repo is being archived and will no longer be maintained by Microsoft. The project is licensed for continued use and development by forking to your own repo.