Example #1
0
        public static string RenderToXml(ReportResult result, string outputPath, string transform, string nameFormat)
        {
            if (result == null)
            {
                throw new ArgumentNullException("result");
            }
            if (nameFormat == null)
            {
                throw new ArgumentNullException("nameFormat");
            }
            if (nameFormat.Length == 0)
            {
                throw new ArgumentException("Length is zero", "nameFormat");
            }

            XmlReport xmlReport = new XmlReport();

            if (transform != null)
            {
                if (!File.Exists(transform))
                {
                    throw new ArgumentException("Transform does not exist.", "transform");
                }
                XslTransform xsl = new XslTransform();
                xsl.Load(transform);
                xmlReport.Transform = xsl;
            }
            return(xmlReport.Render(result, outputPath, nameFormat));
        }
Example #2
0
        public static string RenderToXml(ReportResult result, string outputPath, string transform, string nameFormat)
        {
            if (result == null)
                throw new ArgumentNullException("result");
            if (nameFormat == null)
                throw new ArgumentNullException("nameFormat");
            if (nameFormat.Length == 0)
                throw new ArgumentException("Length is zero", "nameFormat");

            XmlReport xmlReport = new XmlReport();
            if (transform != null)
            {
                if (!File.Exists(transform))
                    throw new ArgumentException("Transform does not exist.", "transform");
                XslTransform xsl = new XslTransform();
                xsl.Load(transform);
                xmlReport.Transform = xsl;
            }
            return xmlReport.Render(result, outputPath, nameFormat);
        }
Example #3
0
        public static void RenderToXml(ReportResult result, TextWriter writer)
        {
            XmlReport xmlReport = new XmlReport();

            xmlReport.Render(result, writer);
        }
Example #4
0
        public static string RenderToXml(ReportResult result)
        {
            XmlReport xmlReport = new XmlReport();

            return(xmlReport.Render(result));
        }
Example #5
0
 public static void RenderToXml(ReportResult result, TextWriter writer)
 {
     XmlReport xmlReport = new XmlReport();
     xmlReport.Render(result, writer);
 }
Example #6
0
		public static string RenderToXml(ReportResult result)
		{
			XmlReport xmlReport = new XmlReport();
			return xmlReport.Render(result);
		}
        public override void Render(ReportResult result, TextWriter writer)
        {
            if (this.transform==null) throw new ApplicationException("Transform property cannot be null");
            // create xml report and render
            using (StringWriter xmlWriter = new StringWriter())
            {
                XmlReport report = new XmlReport();
                report.Render(result, xmlWriter);

                // load xslt
                XmlDocument doc = new XmlDocument();
                XsltArgumentList args = new XsltArgumentList();

                XmlTextWriter owriter = new XmlTextWriter(writer);
                owriter.Formatting = Formatting.Indented;

                    doc.LoadXml(xmlWriter.ToString());
                    this.transform.Transform(
                        doc,
                        args,
                        owriter
                        );
                    owriter.Flush();
                    owriter.Close();
            }
        }