public static string Transform(this Report report, string xml, ReportViewType view, int templateID)
        {
            if (view == ReportViewType.Xml)
            {
                return(Encoding.UTF8.GetString(Encoding.Convert(Encoding.Unicode, Encoding.UTF8, Encoding.Unicode.GetBytes(xml))));
            }
            if (view == ReportViewType.EMail)
            {
                xml = report.Transform(xml, ReportViewType.Html, templateID);
            }

            var xslt = report.GetXslTransform(view);

            if (xslt == null)
            {
                throw new InvalidOperationException("Xslt not found for type " + report.ReportType + " and view " + view);
            }

            using (var reader = XmlReader.Create(new StringReader(xml)))
                using (var writer = new StringWriter())
                    using (XmlWriter.Create(writer, new XmlWriterSettings {
                        Encoding = Encoding.UTF8
                    }))
                    {
                        xslt.Transform(reader, GetXslParameters(report, view, templateID), writer);
                        return(writer.ToString());
                    }
        }
        public static string Transform(this Report report, IList <object[]> reportData, ReportViewType view, int templateID)
        {
            var xml = new StringBuilder();

            if (reportData.Count != 0)
            {
                xml = xml.Append("<?xml version=\"1.0\" encoding=\"utf-8\"?>")
                      .Append("<reportResult>");
                foreach (var row in reportData)
                {
                    xml.Append("<r ");
                    for (var i = 0; i < row.Length; i++)
                    {
                        xml.AppendFormat("c{0}=\"{1}\" ", i, ToString(row[i], view));
                    }
                    xml.Append("/>");
                }
                xml.Append("</reportResult>");
            }
            else
            {
                xml = xml.Append(string.Format("<div class='noContentBlock'>{0}</div>", ProjectsCommonResource.NoData));
            }

            return(report.Transform(xml.ToString(), view, templateID));
        }