Monday, December 17, 2018

Find and Replace string in Word


       Find and Replace string in Word

       using Microsoft.Office.Interop.Word;

           var doc = new   Microsoft.Office.Interop.Word.Application().Documents.Open(
                       @"C:\Users\sureshkumar.d\Desktop\PDFMerge\S2\Test1.docx");

            doc.Content.Find.Execute("{id}", false, true, false, false, false, true, 1, false, "12345", 2,
            false, false, false, false);
            doc.SaveAs2(@"C:\Users\sureshkumar.d\Desktop\PDFMerge\S2\Test2.docx");
            doc.Close();

No comments:

Post a Comment