本文整理汇总了C#中StiReport.SaveDocumentToByteArray方法的典型用法代码示例。如果您正苦于以下问题:C# StiReport.SaveDocumentToByteArray方法的具体用法?C# StiReport.SaveDocumentToByteArray怎么用?C# StiReport.SaveDocumentToByteArray使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类StiReport
的用法示例。
在下文中一共展示了StiReport.SaveDocumentToByteArray方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Generate
public static void Generate(ref RepReport report)
{
if ((((report.PlannedDate == Constants.NullDate) || (((System.DateTime.Now.get_Hour() <= 6) || (System.DateTime.Now.get_Hour() >= 20)) && (countWorkedHeavyReports <= 3))) || !RepHeavyReport.AllHeavyReports().Contains(report.ReportTemplateId)) && ((report != null) && (report != RepReport.Null)))
{
if ((report.Status != 0) || (report.ReportTemplateId == 0L))
{
throw new System.ApplicationException("Отчет непригоден для выполнения");
}
RepReportTemplate withTemplate = RepReportTemplate.GetWithTemplate(report.ReportTemplateId);
if ((withTemplate == null) || (withTemplate.Sql == string.Empty))
{
throw new System.ApplicationException("Отчет непригоден для выполнения");
}
report.Status = 1;
report.StartTime = System.DateTime.Now;
report.SaveChanges();
countWorkedHeavyReports = (int) (countWorkedHeavyReports + 1);
try
{
System.Data.DataSet set = Mappers.RepReportMapper.GenerateReportDataSet(withTemplate.Sql, report.Id);
report.FinishTime = System.DateTime.Now;
System.IO.MemoryStream stream = new System.IO.MemoryStream();
System.IO.MemoryStream stream2 = new System.IO.MemoryStream();
lock (LockRepObject)
{
try
{
if (withTemplate.IsSimpleTable || withTemplate.IsTxt)
{
report.ds = set;
if (report.PlannedDate != Constants.NullDate)
{
new System.Runtime.Serialization.Formatters.Binary.BinaryFormatter().Serialize(stream, set);
}
}
else
{
StiReport report2 = new StiReport();
report2.LoadFromString(withTemplate.Template);
report2.ReportCacheMode = StiReportCacheMode.Off;
report2.Compile();
report2.RegData((System.Data.DataSet) set);
report2.Render(false);
stream = new System.IO.MemoryStream(report2.SaveDocumentToByteArray());
}
if (stream.get_Length() != 0L)
{
stream2 = new System.IO.MemoryStream();
GZipStream stream3 = new GZipStream(stream2, CompressionMode.Compress, true);
stream3.Write(stream.ToArray(), 0, (int) ((int) stream.get_Length()));
stream3.Close();
report.PackedResult = stream2.ToArray();
}
}
catch (System.Exception exception)
{
System.Windows.Forms.MessageBox.Show(exception.get_Message());
}
}
report.Status = 2;
report.SaveChanges();
report.PackedResult = stream2.ToArray();
}
catch (System.Exception)
{
report.Status = 0;
report.SaveChanges();
throw;
}
countWorkedHeavyReports = (int) (countWorkedHeavyReports - 1);
currentWorkedThread = null;
}
}