Guest User

Untitled

a guest
Oct 19th, 2017
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.01 KB | None | 0 0
  1. public void PreencherporReplace(string CaminhoDocMatriz)
  2. {
  3. //Objeto a ser usado nos parâmetros opcionais
  4. object missing = System.Reflection.Missing.Value;
  5.  
  6. Word.Application oApp = new Word.Application();
  7.  
  8. object template = CaminhoDocMatriz;
  9.  
  10. Word.Document oDoc = oApp.Documents.Add(ref template, ref missing,
  11. ref missing, ref missing);
  12.  
  13. //Troca o conteúdo de alguns tags
  14. Word.Range oRng = oDoc.Range(ref missing, ref missing);
  15.  
  16. object FindText = "@var1";
  17. object ReplaceWith = "teste";
  18. object MatchWholeWord = true;
  19. object Forward = false;
  20.  
  21. oRng.Find.Execute( ref FindText, ref missing, ref MatchWholeWord,
  22. ref missing, ref missing, ref missing, ref Forward,
  23. ref missing, ref missing, ref ReplaceWith, ref missing,
  24. ref missing, ref missing, ref missing, ref missing);
  25.  
  26.  
  27. oApp.Visible = true;
  28. }
Add Comment
Please, Sign In to add comment