Ejemplo n.º 1
0
        public string InvoiceToHTML(InvoiceType invoice, string alternativeXslt)
        {
            string r = "";

            var xslt = string.Empty;

            var doc = XSLT_EmbeddedDocumentBinaryObject(invoice);

            if (doc != null)
            {
                using (var stream = new MemoryStream(doc))
                {
                    stream.Seek(0, SeekOrigin.Begin);
                    using (var reader = new StreamReader(stream))
                    {
                        xslt = reader.ReadToEnd();
                    }
                }
            }
            else
            {
                xslt = alternativeXslt;
            }

            if (string.IsNullOrWhiteSpace(xslt))
            {
                r = invoice.CreateXml();
            }
            else
            {
                r = invoice.CreateXml();
                r = TransformXMLToHTML(r, xslt);
            }

            return(r);
        }