chetan Allipur

chetan Allipur

  • NA
  • 541
  • 166.5k

How to Remove the Instructions Text in word in VSTO

Jun 21 2017 8:04 AM
I strucked from the morning. please anyone help me.
 
here is my code.
 
Microsoft.Office.Interop.Word.Application app = Globals.ThisAddIn.Application;
Microsoft.Office.Interop.Word.Document doc1 = app.ActiveDocument;
Selection wordSelection = Globals.ThisAddIn.Application.Selection;
wordSelection.HomeKey(WdUnits.wdStory);
doc1.Content.Find.ClearFormatting();
doc1.Content.Find.Replacement.ClearFormatting();
doc1.Content.Find.set_Style(doc1.Styles["Instructions"]);
doc1.Content.Find.Text = "";
doc1.Content.Find.Replacement.Text = "";
doc1.Content.Find.Forward = true;
bInstructions = doc1.Content.Find.Execute(WdReplace.wdReplaceAll);
 

Answers (2)