private void ProcessReport(ReportDocument report, XmlWriter writer)
{
writer.WriteStartElement("Report");
writer.WriteAttributeString("Name", report.Name);
Trace.WriteLine("Writing report " + report.Name);
if (!report.IsSubreport)
{
Trace.WriteLine("Writing header info");
writer.WriteAttributeString("FileName", report.FileName.Replace("rassdk://", ""));
writer.WriteAttributeString("HasSavedData", report.HasSavedData.ToString());
if (_oleCompoundFile != null)
{
writer.WriteStartElement("Embedinfo");
_oleCompoundFile.RootStorage.VisitEntries(fileItem =>
{
if (fileItem.Name.Contains("Ole"))
{
writer.WriteStartElement("Embed");
writer.WriteAttributeString("Name", fileItem.Name);
var cfStream = fileItem as CFStream;
if (cfStream != null)
{
var streamBytes = cfStream.GetData();
writer.WriteAttributeString("Size", cfStream.Size.ToString("0"));
using (var md5Provider = new MD5CryptoServiceProvider())
{
byte[] md5Hash = md5Provider.ComputeHash(streamBytes);
writer.WriteAttributeString("MD5Hash", Convert.ToBase64String(md5Hash));
}
}
writer.WriteEndElement();
}
}, true);
writer.WriteEndElement();
}
GetSummaryinfo(report, writer);
GetReportOptions(report, writer);
GetPrintOptions(report, writer);
GetSubreports(report, writer); //recursion happens here.
}
GetDatabase(report, writer);
GetDataDefinition(report, writer);
GetReportDefinition(report, writer);
writer.WriteEndElement();
}