GenerateDocument() public method

Generates the Word Document and performs the Mail Merge
public GenerateDocument ( ) : TemplateGenerationResult
return TemplateGenerationResult
Ejemplo n.º 1
0
        public string GenerateTemplatePreview(int id, int templateType, string templateName, string templatePath, string documentPath)
        {
            //string templateName = string.Empty;

            var generator = new DocumentGenerator(templatePath, documentPath, GetTemplateData(templateType, id), GetTransactionDetails(id),_log);

            var result = generator.GenerateDocument();

            return result.Value ? result.ResultPath : string.Empty;
        }
Ejemplo n.º 2
0
        public string GenerateTemplate(int id, int templateType, string templateName)
        {
            //string templateName = string.Empty;

            string templatePath = HttpContext.Current.Server.MapPath(string.Format("~/Templates/{0}.dotx", templateName));
            string documentPath =
                HttpContext.Current.Server.MapPath(string.Format("~/Templates/{0}.docx", Guid.NewGuid().ToString()));

            var generator = new DocumentGenerator(templatePath, documentPath, GetTemplateData(templateType, id), GetTransactionDetails(id), _log);

            var result = generator.GenerateDocument();

            return result.Value ? result.ResultPath : string.Empty;
        }