Skip to content

Instantly share code, notes, and snippets.

Created July 7, 2019 19:06
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