I have some code to replace text inside a word 2010 docx.
object fileName = Path.Combine(System.Windows.Forms.Application.StartupPath, \"document.doc
A method that divides a string if the string contains more than 255 characters.
void FindAndReplace(Microsoft.Office.Interop.Word.Application doc, string findText, string replaceWithText)
{
if (replaceWithText.Length > 255)
{
FindAndReplace(doc, findText, findText + replaceWithText.Substring(255));
replaceWithText = replaceWithText.Substring(0, 255);
}
//options
object matchCase = false;
object matchWholeWord = true;
object matchWildCards = false;
object matchSoundsLike = false;
object matchAllWordForms = false;
object forward = true;
object format = false;
object matchKashida = false;
object matchDiacritics = false;
object matchAlefHamza = false;
object matchControl = false;
object read_only = false;
object visible = true;
object replace = 2;
object wrap = 1;
//execute find and replace
doc.Selection.Find.Execute(findText, ref matchCase, ref matchWholeWord,
ref matchWildCards, ref matchSoundsLike, ref matchAllWordForms, ref forward, ref wrap, ref format, replaceWithText, ref replace,
ref matchKashida, ref matchDiacritics, ref matchAlefHamza, ref matchControl);
}