public ActionResult GetXSLTbyPattern(string pattern) { Company currentComp = ((EInvoiceContext)FX.Context.FXContext.Current).CurrentCompany; RegisterTemp temp = InvServiceFactory.GetRegister(pattern, currentComp.id); InvTemplate invTemp = InvServiceFactory.GetTemplateByPattern(pattern, currentComp.id); string xslt = invTemp.XsltFile; string tmp = "<style type=\"text/css\">"; StringBuilder sb = new StringBuilder(); if (!xslt.Contains(tmp)) { tmp = "<style type=\"text/css\" rel=\"stylesheet\">"; } if (xslt.Contains(tmp)) { string head = xslt.Substring(0, xslt.IndexOf(tmp) + tmp.Length); string foot = xslt.Substring(xslt.IndexOf("</style>")); if (!string.IsNullOrWhiteSpace(temp.CssData)) { sb.AppendFormat("{0}{1}{2}{3}{4}", head, temp.CssData, temp.CssLogo, temp.CssBackgr, foot); } else { sb.AppendFormat("{0}{1}{2}{3}{4}", head, invTemp.CssData, invTemp.CssLogo, invTemp.CssBackgr, foot); } } //InvTemplate temp = src.GetByName(tempname); byte[] xsltData = System.Text.Encoding.UTF8.GetBytes(sb.ToString()); return(File(xsltData, "text/xsl")); }
public ActionResult GetXSLT(string pattern) { Company currentComp = ((EInvoiceContext)FX.Context.FXContext.Current).CurrentCompany; byte[] xsltData; InvTemplate temp = new InvTemplate(); temp = InvServiceFactory.GetTemplateByPattern(pattern, currentComp.id); xsltData = System.Text.Encoding.UTF8.GetBytes(temp.XsltFile); return(File(xsltData, "text/xsl")); }