本文整理汇总了C#中ReportViewer.Initialize方法的典型用法代码示例。如果您正苦于以下问题:C# ReportViewer.Initialize方法的具体用法?C# ReportViewer.Initialize怎么用?C# ReportViewer.Initialize使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ReportViewer
的用法示例。
在下文中一共展示了ReportViewer.Initialize方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Run
public FileStreamResult Run()
{
Validate();
var reportViewer = new ReportViewer();
reportViewer.Initialize(_viewerParameters);
string mimeType;
Stream output;
if (_viewerParameters.ProcessingMode == ProcessingMode.Remote)
{
string extension;
output = reportViewer.ServerReport.Render(
ReportFormat.ToString(),
"<DeviceInfo></DeviceInfo>",
null,
out mimeType,
out extension);
}
else
{
var localReport = reportViewer.LocalReport;
if (_viewerParameters.LocalReportDataSources != null)
{
foreach(var dataSource in _viewerParameters.LocalReportDataSources)
{
var reportDataSource = new ReportDataSource(dataSource.Key, dataSource.Value);
localReport.DataSources.Add(reportDataSource);
}
}
Warning[] warnings;
string[] streamids;
string encoding;
string extension;
var report = localReport.Render(
ReportFormat.ToString(),
null,
out mimeType,
out encoding,
out extension,
out streamids,
out warnings);
output = new MemoryStream(report);
}
return new FileStreamResult(output, mimeType);
}
示例2: Run
public FileStreamResult Run()
{
Validate();
var reportViewer = new ReportViewer();
reportViewer.Initialize(_viewerParameters);
ValidateReportFormat(reportViewer);
string mimeType;
Stream output;
if (_viewerParameters.ProcessingMode == ProcessingMode.Remote)
{
string extension;
var format = ReportFormat2String(ReportFormat);
output = reportViewer.ServerReport.Render(
format,
"<DeviceInfo></DeviceInfo>",
null,
out mimeType,
out extension);
}
else
{
var localReport = reportViewer.LocalReport;
if (_viewerParameters.LocalReportDataSources != null)
{
foreach(var dataSource in _viewerParameters.LocalReportDataSources)
{
var reportDataSource = new ReportDataSource(dataSource.Key, dataSource.Value);
localReport.DataSources.Add(reportDataSource);
}
}
Warning[] warnings;
string[] streamids;
string encoding;
string extension;
var format = ReportFormat2String(ReportFormat);
var report = localReport.Render(
format,
null,
out mimeType,
out encoding,
out extension,
out streamids,
out warnings);
output = new MemoryStream(report);
}
if (!string.IsNullOrEmpty(_filename))
{
var response = HttpContext.Current.Response;
response.ContentType = mimeType;
response.AddHeader("Content-Disposition", $"attachment; filename={_filename}");
}
return new FileStreamResult(output, mimeType);
}
示例3: Run
public FileStreamResult Run()
{
Validate();
var reportViewer = new ReportViewer();
reportViewer.Initialize(_viewerParameters);
string mimeType, fileExt;
var output = reportViewer.ServerReport.Render(
ReportFormat.ToString(),
"<DeviceInfo></DeviceInfo>",
null,
out mimeType,
out fileExt);
return new FileStreamResult(output, mimeType);
}