chetan Allipur

chetan Allipur

  • NA
  • 541
  • 167.7k

How to remove the Instruction Text in word using VSTO.

Jun 21 2017 3:34 AM
How to remove the Instruction Text in word using VSTO.
 
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;
Microsoft.Office.Interop.Word.Style style = wordSelection.Paragraphs.get_Style();
wordSelection.HomeKey(WdUnits.wdStory);
doc1.Content.Find.ClearFormatting();
doc1.Content.Find.Replacement.ClearFormatting();
doc1.Content.Find.set_Style(doc1.Styles["Instructions"]);
//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)