当前位置: 首页>>代码示例>>C#>>正文


C# ReportViewer.Initialize方法代码示例

本文整理汇总了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);
        }
开发者ID:postjuan,项目名称:MvcReportViewer,代码行数:52,代码来源:ReportRunner.cs

示例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);
        }
开发者ID:jv9,项目名称:MvcReportViewer,代码行数:63,代码来源:ReportRunner.cs

示例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);
        }
开发者ID:harroot,项目名称:MvcReportViewer,代码行数:17,代码来源:ReportRunner.cs


注:本文中的ReportViewer.Initialize方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。