i want to Create and Manipulate Word Documents Programmatically Using DocX ! and create a word template InvoiceTemplate.docx
this is my code :
protected void CreateDoc_Click(object sender, EventArgs e)
{
//Createa docx File
DocX gDocument;
gDocument =
DocX.Load(@Server.MapPath("InvoiceTemplate.docx"));
gDocument =
CreateInvoiceFromTemplate(DocX.Load(@Server.MapPath("InvoiceTemplate.docx")));
gDocument.SaveAs(@Server.MapPath("~/DocX/NewLoadedShipment.docx"));
}
private static DocX CreateInvoiceFromTemplate(DocX template)
{
template.AddCustomProperty(
new CustomProperty("{rechnung}", "5"));
template.AddCustomProperty(
new CustomProperty("{name}", "Maziar"));
template.AddCustomProperty(
new CustomProperty("{date}", DateTime.Now.ToString("dd.MM.yyyy")));
template.AddCustomProperty(
new CustomProperty("{address}", "12345hamburg"));
template.AddCustomProperty(
new CustomProperty("{tell}", "2234543"));
template.AddCustomProperty(
new CustomProperty("{amount}", "1000"));
template.AddCustomProperty(
new CustomProperty("{rest}", "500"));
template.AddCustomProperty(
new CustomProperty("{tax}", "100"));
template.AddCustomProperty(
new CustomProperty("{total}", "600"));
return template;
}
but nothing happend to my NewLoadedShipment.docx
! can some one help please !