Created
July 7, 2019 19:06
-
-
Save vmussak/46ffdb88f36a02f0438b87a8574368f1 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
string caminho = @"C:\Users\Vinicius Mussak\Desktop\ReplaceDocxExample\ReplaceDocxExample\"; | |
static void Replace() | |
{ | |
using(var documento = DocX.Load(caminho + "documento.docx")) | |
{ | |
documento.ReplaceText("#nome", "Vinicius Mussak"); | |
string mes = DateTime.Now.ToString("MMMM", CultureInfo.CreateSpecificCulture("pt-br")); | |
documento.ReplaceText("#mes", mes); | |
documento.SaveAs(caminho + "novo-documento.docx"); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment