Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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
You can’t perform that action at this time.