public ActionResult Generate(JIUViewModel model) { //get temp name from reg expression plus lang plus symb string fname = model.tempname.ToString(); g_assembly = Assembly.GetExecutingAssembly(); // string source = Server.MapPath(Path.Combine("/", "IN/" + fname + ".docx")); // string Dest = Server.MapPath(Path.Combine("/", "OUT/" + fname + ".docx")); string source = Server.MapPath(Path.Combine("/", "GDGS/IN/" + fname + ".docx")); string Dest = Server.MapPath(Path.Combine("/", "GDGS/OUT/" + fname + ".docx")); string tempname = fname.Remove(fname.Length - 1); model.tempname = tempname; g_document = DocX.Load(source); g_document = CreateDocA(DocX.Load(source), model, source); g_document.SaveAs(Dest); g_document.AddCoreProperty("dc:title", model.Sym.ToString()); // g_document.AddCoreProperty("dc:author", model.Sym.ToString()); g_document.Save(); // Changegdoc(source); return(RedirectToAction("download", "JIU", new { name = fname })); }
public ActionResult Generate(SRViewModel model) { //get temp name from reg expression plus lang plus symb string fname = model.temp.ToString(); g_assembly = Assembly.GetExecutingAssembly(); //string source = Server.MapPath(Path.Combine("/" + "IN/CEDAW01SRE.docx")); //string Dest = Server.MapPath(Path.Combine("/" + "OUT/CEDAW01SRE.docx")); string source = Server.MapPath(Path.Combine("/", "GDGS/IN/" + fname + ".docx")); string Dest = Server.MapPath(Path.Combine("/", "GDGS/OUT/" + fname + ".docx")); //string tempname = fname.Remove(fname.Length - 1); //model.tempname = tempname; g_document = DocX.Load(source); g_document = CreateDocA(DocX.Load(source), model); g_document.SaveAs(Dest); if (!String.IsNullOrEmpty(model.author)) { g_document.AddCoreProperty("dc:creator", model.author.ToString()); g_document.Save(); } return(RedirectToAction("download", "Unog", new { name = fname })); }
public void addCoreProperties(DocX document, DocInfoOption option) { if (!string.IsNullOrWhiteSpace(option.Subject)) { document.AddCoreProperty("subject", option.Subject); } if (!string.IsNullOrWhiteSpace(option.Title)) { document.AddCoreProperty("title", option.Title); } if (!string.IsNullOrWhiteSpace(option.Creator)) { document.AddCoreProperty("creator", option.Creator); } if (!string.IsNullOrWhiteSpace(option.Description)) { document.AddCoreProperty("description", option.Description); } if (!string.IsNullOrWhiteSpace(option.Category)) { document.AddCoreProperty("category", option.Category); } if (!string.IsNullOrWhiteSpace(option.Version)) { document.AddCoreProperty("version", option.Version); } /* * document.AddCoreProperty("created", option.Created); * document.AddCoreProperty("modified", option.Modified); * document.AddCoreProperty("keywords", option.Keywords); * document.AddCoreProperty("lastModifiedBy", option.LastModifiedBy); * document.AddCoreProperty("revision", option.Revision);*/ }
public ActionResult Generate(ECEViewModel model) { string fname = TempName(model); bool cprvalue = false; if (model.cpr == true) { cprvalue = true; } if (fname == "Worng Template") { return(RedirectToAction("WrongTemp", "Ohchr")); } if (fname == "Worng Template crp") { return(RedirectToAction("WrongTemp", "Ohchr")); } else { // Store a global reference to the executing assembly. g_assembly = Assembly.GetExecutingAssembly(); string source = Server.MapPath(Path.Combine("/", "GDGS/IN/" + fname + ".docx")); string Dest = Server.MapPath(Path.Combine("/", "GDGS/OUT/" + fname + ".docx")); //string source = Server.MapPath(Path.Combine("/", "IN/" + fname + ".docx")); // string Dest = Server.MapPath(Path.Combine("/", "OUT/" + fname + ".docx")); g_document = DocX.Load(source); g_document = CreateDocA(DocX.Load(source), model, source, cprvalue); g_document.SaveAs(Dest); g_document.AddCoreProperty("dc:title", model.tsym.ToString()); g_document.Save(); return(RedirectToAction("download", "ECE", new { name = fname })); } }