本文整理汇总了C#中StiReport.ExportDocument方法的典型用法代码示例。如果您正苦于以下问题:C# StiReport.ExportDocument方法的具体用法?C# StiReport.ExportDocument怎么用?C# StiReport.ExportDocument使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类StiReport
的用法示例。
在下文中一共展示了StiReport.ExportDocument方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ExportInfo
public static void ExportInfo(byte exportType, StiReport report)
{
using (MemoryStream ms = new MemoryStream())
{
string fileName = "rep";
switch (exportType)
{
case 0:// "pdf"
report.ExportDocument(StiExportFormat.Pdf, HttpContext.Current.Server.MapPath(string.Format("~/App_Data/Report/Tmp/{0}.Pdf", fileName)));
report.ExportDocument(StiExportFormat.Pdf, ms);
HttpContext.Current.Response.Clear();
HttpContext.Current.Response.AddHeader("Content-Disposition", string.Format("attachment; filename={0}.pdf", fileName));
HttpContext.Current.Response.ContentType = "application/pdf";
break;
case 1:// "jpeg"
report.ExportDocument(StiExportFormat.ImageJpeg, HttpContext.Current.Server.MapPath(string.Format("~/App_Data/Report/Tmp/{0}.jpeg", fileName)));
report.ExportDocument(StiExportFormat.ImageJpeg, ms);
HttpContext.Current.Response.Clear();
HttpContext.Current.Response.AddHeader("Content-Disposition", string.Format("attachment; filename={0}.jpeg", fileName));
HttpContext.Current.Response.ContentType = "application/ImageJpeg";
break;
case 2: // "html":
report.ExportDocument(StiExportFormat.Html, HttpContext.Current.Server.MapPath(string.Format("~/App_Data/Report/Tmp/{0}.html", fileName)));
report.ExportDocument(StiExportFormat.Html, ms);
HttpContext.Current.Response.Clear();
HttpContext.Current.Response.AddHeader("Content-Disposition", string.Format("attachment; filename={0}.html", fileName));
HttpContext.Current.Response.ContentType = "application/html";
break;
case 3: // "xls":
report.ExportDocument(StiExportFormat.Excel, HttpContext.Current.Server.MapPath(string.Format("~/App_Data/Report/Tmp/{0}.xls", fileName)));
report.ExportDocument(StiExportFormat.Excel, ms);
HttpContext.Current.Response.Clear();
HttpContext.Current.Response.AddHeader("Content-Disposition", string.Format("attachment; filename={0}.xls", fileName));
HttpContext.Current.Response.ContentType = "application/xls";
break;
}
HttpContext.Current.Response.BinaryWrite(ms.ToArray());
HttpContext.Current.Response.End();
}
}
示例2: ShowReport
//.........这里部分代码省略.........
{
format = DbFileFormat.dBase5;
}
}
}
else
{
System.IO.MemoryStream stream3 = new System.IO.MemoryStream();
byte[] buffer = new byte[0x400];
while (true)
{
int num = stream2.Read(buffer, 0, 0x400);
if (num == 0)
{
break;
}
stream3.SetLength((long) (stream3.get_Length() + num));
stream3.Write(buffer, 0, num);
}
StiReport report2 = new StiReport();
stream3.set_Position((long) 0L);
report2.LoadDocument((System.IO.Stream) stream3);
if (report.IsExcel)
{
this.sfdExcel.set_FileName("Document " + ((long) report.Id).ToString());
this.sfdExcel.set_Filter("Excel Worksheets|*.xls");
this.sfdExcel.set_DefaultExt(".xls");
if (this.sfdExcel.ShowDialog(this) == System.Windows.Forms.DialogResult.OK)
{
StiExcelExportSettings settings = new StiExcelExportSettings {
ExportPageBreaks = false,
UseOnePageHeaderAndFooter = true
};
report2.ExportDocument(StiExportFormat.Excel, this.sfdExcel.get_FileName(), settings);
}
return;
}
if (isPrint)
{
report2.Print(false);
return;
}
report2.Show(false);
return;
}
string tableColumns = null;
if (ds.Tables.get_Item(0).Columns.Contains("columnlist"))
{
tableColumns = ds.Tables.get_Item(0).Rows.get_Item(0).get_Item("columnlist").ToString();
}
DBF.WriteToFile((System.Data.DataTable) ds.Tables.get_Item(1), info.get_DirectoryName(), ds.Tables.get_Item(1).get_TableName(), format, false, template.IsAppending, tableColumns);
if (info.get_Name().ToUpper().LastIndexOf(".DBF") >= 0)
{
str = str2 + info.get_Name();
}
else
{
str = str2 + info.get_Name() + ".DBF";
}
info = new System.IO.FileInfo(str2 + ds.Tables.get_Item(1).get_TableName() + ".DBF");
if (template.IsAppending)
{
info.MoveTo(str3);
}
else
{
示例3: ReportCreated
public void ReportCreated(StiReport rpt, AccountServicesJournalReportForm form, string xml)
{
string str;
using (System.IO.MemoryStream stream = new System.IO.MemoryStream())
{
rpt.ExportDocument(StiExportFormat.Pdf, (System.IO.Stream) stream);
str = System.Convert.ToBase64String(stream.ToArray());
}
ExchangeRequest objectWithId = (ExchangeRequest) base.ObjectWithId;
try
{
this.MakeResponse(objectWithId, "Получение справки об оплате для единого окна", string.Empty, str, xml);
}
catch (System.Exception exception)
{
AIS.SN.UI.Messages.ShowException(this, exception);
}
}
示例4: Generate
//.........这里部分代码省略.........
report2.Dispose();
}
report = new NoticeReport(renderedNotices);
this.m_GeneratedReport = report;
}
if ((this.m_ThreadExceptions.Count > 0) || this.m_IsCancelled)
{
ex = null;
this.m_ThreadExceptions.TryDequeue(out ex);
this.AbortOperation(asyncOp, ex, (System.TimeSpan) (System.DateTime.Now - now));
}
else
{
if ((this.m_NoticeCache.get_Count() > 0) && (this.m_Exporter != null))
{
logger.Info("Экспорт по домам управляющих компаний");
int num9 = (int) ((this.m_Exporter.MaxPageCount * this.m_Template.AccountsInTemplate) / this.m_Template.PageCount);
CachedNoticeInfoComparer comparer = new CachedNoticeInfoComparer();
try
{
foreach (string str in this.m_NoticeCache.Keys)
{
this.m_NoticeCache[str].Sort(comparer);
logger.Info("Экспорт домов УК " + str);
for (int n = 0; n < this.m_NoticeCache[str].get_Count(); n = (int) (n + num9))
{
System.Text.StringBuilder builder = new System.Text.StringBuilder();
int num11 = this.m_NoticeCache[str].get_Count();
if (num11 != 0)
{
int maxPageCount = this.m_Exporter.MaxPageCount;
int num13 = (int) (num11 - (n + maxPageCount));
num13 = (num13 < 1) ? ((int) 0) : num13;
using (StiReport report3 = new StiReport())
{
report3.IsRendered = true;
report3.NeedsCompiling = false;
report3.RenderedPages.Clear();
System.IO.DirectoryInfo info = new System.IO.DirectoryInfo(System.IO.Path.Combine(this.m_Exporter.DestinationPath, str));
if (!info.get_Exists())
{
info.Create();
}
string file = System.IO.Path.Combine(info.get_FullName(), string.Format("{0}_{1}.pdf", str, n / num9));
for (int num14 = n; num14 < (num11 - num13); num14 = (int) (num14 + 1))
{
System.IO.FileInfo info2 = new System.IO.FileInfo(this.m_NoticeCache[str].get_Item(num14).CacheFilePath);
if (info2.get_Exists())
{
byte[] bytes = System.IO.File.ReadAllBytes(info2.get_FullName());
StiReport report4 = new StiReport();
report4.LoadPackedDocument(bytes);
report4.ReportUnit = report3.ReportUnit;
foreach (StiPage page in report4.RenderedPages)
{
page.Report = report3;
page.Guid = System.Guid.NewGuid().ToString().Replace("-", "");
report3.RenderedPages.Add(page);
}
if (this.m_Exporter.DualPageExportMode && ((report4.RenderedPages.get_Count() % 2) != 0))
{
StiPage page2 = new StiPage(report3) {
IsRendered = true,
Orientation = report4.RenderedPages[0].Orientation,
Guid = System.Guid.NewGuid().ToString().Replace("-", "")
};
report3.RenderedPages.Add(page2);
}
builder.AppendLine(this.m_NoticeCache[str].get_Item(num14).FullAddress);
}
}
report3.ExportDocument(StiExportFormat.Pdf, file);
System.IO.File.WriteAllText(file + ".txt", builder.ToString());
}
}
}
}
logger.Info("Очистка дискового кэша");
System.IO.Directory.Delete(System.IO.Path.Combine(this.m_Exporter.DestinationPath, this.m_ExportCacheDirectoryName), true);
}
catch (System.Exception exception19)
{
ex = new NoticeGenerationException("Ошибка при экспорте извещений, сгруппированных по УК", exception19);
this.AbortOperation(asyncOp, ex, (System.TimeSpan) (System.DateTime.Now - now));
return;
}
}
System.TimeSpan timeSpent = (System.TimeSpan) (System.DateTime.Now - now);
logger.Info("Операция успешно завершена. Время выполнения " + timeSpent.ToString());
logger.Info("Всего отрендерено: " + ((int) this.m_TotalRendered));
if (asyncOp != null)
{
GenerationCompletedEventArgs args = new GenerationCompletedEventArgs(timeSpent, null, false, asyncOp.get_UserSuppliedState()) {
GeneratedReport = report
};
asyncOp.PostOperationCompleted(this.onCompletedDelegate, args);
}
this.Reset();
}
}