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


C# LocalReport.LoadReportDefinition方法代码示例

本文整理汇总了C#中LocalReport.LoadReportDefinition方法的典型用法代码示例。如果您正苦于以下问题:C# LocalReport.LoadReportDefinition方法的具体用法?C# LocalReport.LoadReportDefinition怎么用?C# LocalReport.LoadReportDefinition使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在LocalReport的用法示例。


在下文中一共展示了LocalReport.LoadReportDefinition方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Render

        public void Render(string reportDesign, ReportDataSource[] dataSources, string destFile, IEnumerable<ReportParameter> parameters = null)
        {
            var localReport = new LocalReport();

            using (var reportDesignStream = System.IO.File.OpenRead(reportDesign))
            {
                localReport.LoadReportDefinition(reportDesignStream);
            }
            localReport.EnableExternalImages = true;
            localReport.EnableHyperlinks = true;

            if (parameters != null)
            {
                localReport.SetParameters(parameters);
            }
            foreach (var reportDataSource in dataSources)
            {
                localReport.DataSources.Add(reportDataSource);
            }

            //Export to PDF
            string mimeType;
            string encoding;
            string fileNameExtension;
            string[] streams;
            Warning[] warnings;
            var content = localReport.Render("PDF", null, out mimeType, out encoding, out fileNameExtension, out streams, out warnings);

            System.IO.File.WriteAllBytes(destFile, content);
        }
开发者ID:MySmallfish,项目名称:Simple.ReDoc,代码行数:30,代码来源:HomeController.cs

示例2: executeReport_click

        protected void executeReport_click(object sender, EventArgs e)
        {
            if (reportSelector.SelectedIndex == 9)
                executeReportInAppDomain_click(sender, e);
            else
            {
                LocalReport rpt = new LocalReport();
                rpt.EnableExternalImages = true;
                rpt.ReportPath = String.Concat(Path.GetDirectoryName(Request.PhysicalPath), "\\Reports\\", reportSelector.SelectedValue);
                string orientation = (rpt.GetDefaultPageSettings().IsLandscape) ? "landscape" : "portrait";
                StringReader formattedReport = Business.reportHelper.FormatReportForTerritory(rpt.ReportPath, orientation, cultureSelector.SelectedValue);
                rpt.LoadReportDefinition(formattedReport);

                // Add Data Source
                rpt.DataSources.Add(new ReportDataSource("InvoiceDataTable", dt));

                // Internationlisation: Add uiCulture and Translation Labels
                if (reportSelector.SelectedIndex >= 3)
                {
                    Dictionary<string, string> reportLabels = Reports.reportTranslation.translateInvoice(cultureSelector.SelectedValue);
                    ReportParameterCollection reportParams = new ReportParameterCollection();

                    reportParams.Add(new ReportParameter("uiCulture", cultureSelector.SelectedValue));
                    foreach (string key in reportLabels.Keys)
                        reportParams.Add(new ReportParameter(key, reportLabels[key]));

                    rpt.SetParameters(reportParams);
                }

                // Render To Browser
                renderPDFToBrowser(rpt.Render("PDF", Business.reportHelper.GetDeviceInfoFromReport(rpt, cultureSelector.SelectedValue, "PDF")));
            }
        }
开发者ID:taigum,项目名称:ssrs-non-native-functions,代码行数:33,代码来源:SalesInvoiceDemo.aspx.cs

示例3: CreateReport

        public FileContentResult CreateReport(SqlReportType type, string reportName, string area, string datasetName,
            IEnumerable dataList)
        {
            string mimeType;
            var report = new LocalReport();

            report.LoadReportDefinition(AssetResolver.GetEmbeddedResourceStream(reportName, area));

            var reportDataSource = new ReportDataSource(datasetName, dataList);
            report.DataSources.Add(reportDataSource);
            byte[] reportBytes = GenerateReport(type, report, out mimeType);
            return new FileContentResult(reportBytes, mimeType);
        }
开发者ID:Exclr8,项目名称:CloudCore,代码行数:13,代码来源:SQLReport.cs

示例4: PrintDataSource

 // Create a local report for Report.rdlc, load the data,
 //    export the report to an .emf file, and print it.
 public void PrintDataSource(DataTable dt, IEnumerable<ReportParameter> param, System.Drawing.Printing.PrinterSettings ps, ref System.IO.MemoryStream ReportDefinition)
 {
     LocalReport report = new LocalReport();
     this.ps = ps;
     //report.ReportPath = @"Examine.rdlc";
     ReportDefinition.Seek(0, SeekOrigin.Begin);
     report.LoadReportDefinition(ReportDefinition);
     report.DataSources.Add(new ReportDataSource("BossCom_RecordPatient", dt));
     report.SetParameters(param);
     Export(report);
     m_currentPageIndex = 0;
     Print();
 }
开发者ID:VinhNT,项目名称:MedicineCenter,代码行数:15,代码来源:ReportPrinter.cs

示例5: Execute

 public string Execute(PrinterSettings printerSetting, PrintEventHandler end_print, Stream stream, Dictionary<string, object> reportDataSources)
 {
     string msg = string.Empty;
     PrintDocument printDoc = this.CreatePrintDocument(printerSetting, ref msg);
     if (!string.IsNullOrEmpty(msg))
     {
         return msg;
     }
     LoggingService.Debug("检查打印模板文件是否存在...");
     if ((stream == null) || (stream.Length == 0L))
     {
         LoggingService.Warn("模板是空值或无内容");
         return "报表模板不存在!";
     }
     LoggingService.Debug("准备生成打印流...");
     LocalReport report = new LocalReport();
     report.LoadReportDefinition(stream);
     return this.InternalExecute(printDoc, report, end_print, reportDataSources);
 }
开发者ID:vanloc0301,项目名称:mychongchong,代码行数:19,代码来源:RDLCPrint.cs

示例6: SetXml2Report

        /// <summary>
        /// 
        /// </summary>
        /// <param name="localReport">要操作的报表控件</param>
        /// <param name="xmldoc">rdlc内容</param>
        /// <returns></returns>
        public bool SetXml2Report ( ref LocalReport localReport , XmlDocument xmldoc )
        {
            //XmlDocument=>MemoryStream, 以便载入LocalReport中。
            MemoryStream ms = new MemoryStream ();
            xmldoc.Save ( ms );

            if ( ms == null )
                return false;

            ms.Seek ( 0 , SeekOrigin.Begin );

            //装载报表rdlc
            localReport.LoadReportDefinition ( ms );

            //释放
            ms.Close ();

            return true;
        }
开发者ID:cheng521yun,项目名称:https---github.com-frontflag-FTMZ_CY,代码行数:25,代码来源:Report.cs

示例7: BindHostingSpaceBandwidthOverusageDetailsReport

		protected void BindHostingSpaceBandwidthOverusageDetailsReport(string reportName, LocalReport localReport)
		{
			// 1. Localize report
			localReport.DisplayName = reportName;
			localReport.LoadReportDefinition(
					ReportingServicesUtils.LoadReportFromFile(
						  GetReportFullPath(reportName)
						, reportName
						, this
					)
				);

			// 2. Update parameters
			//    Note: here we are always in Drill-through mode.
			localReport.SetParameters(localReport.OriginalParametersToDrillthrough);
			string hostingSpaceId = localReport.GetParameters()["HostingSpaceId"].Values[0];

			List<ReportParameter> parameters = new List<ReportParameter>();
			parameters.Add(
					new ReportParameter(
						  ParameterBandwidthStartDate
						, startDateCalendar.SelectedDate.ToString()
					)
				);
			parameters.Add(
					new ReportParameter(
						  ParameterBandwidthEndDate
						, endDateCalendar.SelectedDate.ToString()
					)
				);

			localReport.SetParameters(parameters);

			//3. Update data
			DataSet ds = ES.Services.Packages
						 .GetBandwidthOverusageDetailsReport(
							  PanelSecurity.SelectedUserId
							, int.Parse(hostingSpaceId)
							, startDateCalendar.SelectedDate
							, endDateCalendar.SelectedDate
						 );

			localReport.DataSources.Clear();

			TranslateStatusField(ds.Tables["HostingSpace"]);

			BindDataTableToReport(localReport, "OverusageReport_HostingSpace", ds.Tables["HostingSpace"]);
			BindDataTableToReport(localReport, "OverusageReport_BandwidthOverusage", ds.Tables["BandwidthOverusage"]);
			BindDataTableToReport(localReport, "OverusageReport_OverusageDetails", ds.Tables["OverusageDetails"]);

			localReport.Refresh();
		}
开发者ID:jordan49,项目名称:websitepanel,代码行数:52,代码来源:OverusageReport.ascx.cs

示例8: BindHostingSpaceDiskspaceOverusageDetailsReport

		/// <summary>
		/// Load a detailed diskspace report.
		/// </summary>
		/// <param name="reportName">Name of detailed diskspace report.</param>
		/// <param name="localReport">
		/// Instance or <see cref="LocalReport"/> class. 
		/// This instance serves as a container for report being loaded.
		/// </param>
		protected void BindHostingSpaceDiskspaceOverusageDetailsReport(string reportName, LocalReport localReport)
		{
			// 1. Localize report
			localReport.DisplayName = reportName;
			localReport.LoadReportDefinition(
					ReportingServicesUtils.LoadReportFromFile(
						  GetReportFullPath(reportName)
						, reportName
						, this
					)
				);

			// 2. Update parameters
			//    Note: here we are always in Drill-through mode.
			localReport.SetParameters(localReport.OriginalParametersToDrillthrough);
			string hostingSpaceId = localReport.GetParameters()["HostingSpaceId"].Values[0];


			// 3. Update DataSet
			DataSet report = ES.Services.Packages
							 .GetDiskspaceOverusageDetailsReport(
								  PanelSecurity.SelectedUserId
								, int.Parse(hostingSpaceId)
							 );

			localReport.DataSources.Clear();

			TranslateStatusField(report.Tables["HostingSpace"]);

			BindDataTableToReport(localReport, "OverusageReport_HostingSpace", report.Tables["HostingSpace"]);
			BindDataTableToReport(localReport, "OverusageReport_DiskspaceOverusage", report.Tables["DiskspaceOverusage"]);
			BindDataTableToReport(localReport, "OverusageReport_OverusageDetails", report.Tables["OverusageDetails"]);

			localReport.Refresh();
		}
开发者ID:jordan49,项目名称:websitepanel,代码行数:43,代码来源:OverusageReport.ascx.cs

示例9: BindOverusageSummaryReport

		/// <summary>
		/// Loads Overusage summary report.
		/// </summary>
		/// <param name="reportName">Name of overusage summary report.</param>
		/// <param name="localReport">
		/// Instance or <see cref="LocalReport"/> class. 
		/// This instance serves as a container for report being loaded.
		/// </param>
		protected void BindOverusageSummaryReport(string reportName, LocalReport localReport)
		{
			// 1. Localize report
			localReport.DisplayName = reportName;
			localReport.LoadReportDefinition(
					ReportingServicesUtils.LoadReportFromFile(
						  GetReportFullPath(reportName)
						, reportName
						, this
					)
				);

			// 2. Update parameters
			List<ReportParameter> parameters = new List<ReportParameter>();
			parameters.Add(
					new ReportParameter(
						  ParameterBandwidthStartDate
						, startDateCalendar.SelectedDate.ToString()
					)
				);
			parameters.Add(
					new ReportParameter(
						  ParameterBandwidthEndDate
						, endDateCalendar.SelectedDate.ToString()
					)
				);

			localReport.SetParameters(parameters);

			// 3. Update DataSet
			DataSet report = ES.Services.Packages
							 .GetOverusageSummaryReport(
								  PanelSecurity.SelectedUserId
								, PanelSecurity.PackageId
								, startDateCalendar.SelectedDate
								, endDateCalendar.SelectedDate
							 );

			localReport.DataSources.Clear();

			TranslateStatusField(report.Tables["HostingSpace"]);

			// If you open reports DataSet file in XML and file <DataSets> node
			// you will see the same names as applied to ReportDataSource(name, value) instances below
			LoadDiskspaceOverusageData(report.Tables["HostingSpace"], report.Tables["DiskspaceOverusage"]);
			LoadBandwidthOverusageData(report.Tables["HostingSpace"], report.Tables["BandwidthOverusage"]);
			//
			BindDataTableToReport(localReport, "OverusageReport_HostingSpace", report.Tables["HostingSpace"]);
			BindDataTableToReport(localReport, "OverusageReport_DiskspaceOverusage", report.Tables["DiskspaceOverusage"]);
			BindDataTableToReport(localReport, "OverusageReport_BandwidthOverusage", report.Tables["BandwidthOverusage"]);
			BindDataTableToReport(localReport, "OverusageReport_OverusageDetails", report.Tables["OverusageDetails"]);

			localReport.Refresh();
		}
开发者ID:jordan49,项目名称:websitepanel,代码行数:62,代码来源:OverusageReport.ascx.cs

示例10: reportViewer1_Drillthrough

        /// <summary>
        /// Handles drilldown report events
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void reportViewer1_Drillthrough(object sender, DrillthroughEventArgs e)
        {
            _localReport = (LocalReport)e.Report;

            OnReportDrilledThrough(e);

            byte[] rdlBytes = Encoding.UTF8.GetBytes(_reportInfo.ReportDefinition);
            System.IO.MemoryStream stream = new System.IO.MemoryStream(rdlBytes);
            _localReport.LoadReportDefinition(stream);

            RunReport();

            if (!_bDisplayedError)
                _localReport.Refresh();
        }
开发者ID:ChrisH4rding,项目名称:xenadmin,代码行数:20,代码来源:WlbReportView.cs

示例11: ReporteLoadReportDefinition

        /// <summary>
        /// Carga la definicion del reporte cambiando namesapces y secciones 
        /// </summary>
        /// <param name="localReport">Instancia de LocalReport</param>
        /// <param name="reportePathCompleto">Path del reporte completo para acceder</param>
        public static void ReporteLoadReportDefinition(LocalReport localReport, string reportePathCompleto, IDictionary<string, string> imagenes)
        {
            string strReport = System.IO.File.ReadAllText(reportePathCompleto, System.Text.Encoding.Default);
            if (strReport.Contains("http://schemas.microsoft.com/sqlserver/reporting/2010/01/reportdefinition"))
            {
                strReport =
                    strReport.Replace(
                        "<Report xmlns:rd=\"http://schemas.microsoft.com/SQLServer/reporting/reportdesigner\" xmlns:cl=\"http://schemas.microsoft.com/sqlserver/reporting/2010/01/componentdefinition\" xmlns=\"http://schemas.microsoft.com/sqlserver/reporting/2010/01/reportdefinition\">",
                        "<Report xmlns:rd=\"http://schemas.microsoft.com/SQLServer/reporting/reportdesigner\" xmlns=\"http://schemas.microsoft.com/sqlserver/reporting/2008/01/reportdefinition\">");
                strReport =
                    strReport.Replace("<ReportSections>", "").Replace("<ReportSection>", "").Replace(
                        "</ReportSection>", "").Replace("</ReportSections>", "");
            }

            if (imagenes != null)
            {
                foreach (var imagenNombre in imagenes.Keys)
                {
                    strReport = CambiarEmbeddedImages(strReport, imagenNombre, imagenes[imagenNombre]);
                }
            }

            byte[] bytReport = System.Text.Encoding.UTF8.GetBytes(strReport);
            localReport.LoadReportDefinition(new MemoryStream(bytReport));
        }
开发者ID:pragmasolutions,项目名称:avicola,代码行数:30,代码来源:ReportHelper.cs

示例12: GenerateFromRDLTemplate

        /// <summary>
        /// Generates an Excel or PDF output given a RDL template and a DataSet.
        /// </summary>
        /// <param name="templateFileBytes"></param>
        /// <param name="ds"></param>
        /// <param name="outputFormat"></param>
        /// <returns></returns>
        public static byte[] GenerateFromRDLTemplate(byte[] templateFileBytes, DataSet ds, int? outputFormat)
        {
            // Load the report from the document template.
            //
            LocalReport localReport = new LocalReport();
            MemoryStream mem = new MemoryStream(templateFileBytes);
            StreamReader sr = new StreamReader(mem);
            localReport.LoadReportDefinition(sr);
            sr.Close();
            mem.Close();

            // Add the data tables to the report.
            //
            if (ds != null)
                foreach (DataTable dt in ds.Tables)
                {
                    ReportDataSource reportDataSource = new ReportDataSource(dt.TableName, dt);
                    localReport.DataSources.Add(reportDataSource);
                }

            // Generate the output.
            // 
            Warning[] warnings = null;
            string mimeType = null, encoding = null, fileNameExtension = null;
            string[] streams = null;
            string format = "";
            if (outputFormat == DocumentOutputFormat.AcrobatPDF)
                format = "PDF";
            if (outputFormat == DocumentOutputFormat.MicrosoftExcel)
                format = "Excel";
            if (outputFormat == DocumentOutputFormat.Image)
                format = "Image";

            return localReport.Render(format, "", out mimeType, out encoding, out fileNameExtension, out streams, out warnings);
        }
开发者ID:vinhdoan,项目名称:Angroup.demo,代码行数:42,代码来源:DocumentGenerator.cs

示例13: LoadReportFromStream

 private static LocalReport LoadReportFromStream(Stream stream)
 {
     var report = new LocalReport();
     report.LoadReportDefinition(stream);
     return report;
 }
开发者ID:Exclr8,项目名称:CloudCore,代码行数:6,代码来源:SQLReport.cs

示例14: ExportRDLC

        private MemoryStream ExportRDLC(BaseDeviceInfoSettings exportTypeSetting, string deviceInfoXml, DataTable _dataSet, out IReportExporter winFormsReportExporter, out LocalReport localReport)
        {
            if (_dataSet != null)
            {
                this.m_dataSet = _dataSet;
            }

            GetColumns();
            DateTime startTime = DateTime.Now;
            localReport = new LocalReport();
            localReport.DisplayName = string.IsNullOrEmpty(Rdl.PageHeaderText) ? "Report" : Rdl.PageHeaderText;
            localReport.LoadReportDefinition(m_rdl);
            localReport.DataSources.Add(new ReportDataSource("MyData", m_dataSet));
            winFormsReportExporter = new WinFormsReportExporter(localReport);
            MemoryStream content;

            if (exportTypeSetting is ExcelDeviceInfoSettings)
            {
                content = winFormsReportExporter.ExportToXls(deviceInfoXml);
            }
            else if (exportTypeSetting is PdfDeviceInfoSettings)
            {
                content = winFormsReportExporter.ExportToPdf(deviceInfoXml);
            }
            else if (exportTypeSetting is ImageDeviceInfoSettings)
            {
                content = winFormsReportExporter.ExportToImage(deviceInfoXml);
            }
            else if (exportTypeSetting is WordDeviceInfoSettings)
            {
                content = winFormsReportExporter.ExportToWord(deviceInfoXml);
            }
            else
            {
                throw new ApplicationException("Unknown export type format");
            }

            TimeSpan totalTime = DateTime.Now - startTime;
            return content;
        }
开发者ID:carlosgilf,项目名称:prettyjs,代码行数:40,代码来源:DynamicReport.cs

示例15: Print

        public void Print()
        {
            HttpContext context = HttpContext.Current;
            //Warning[] warnings = null;
            //string[] streamids = null;
            //string mimeType = null;
            //string encoding = null;
            //string extension = null;
            Warning[] warningArray;
            HttpResponse response = context.Response;
            response.StatusCode = 200;
            MemoryStream lastMemoryStream = null;
            context.Response.BufferOutput = false;
            context.Response.ContentType = null;
            context.Response.Expires = -1;
            HttpContext.Current.Response.Clear();
            GetColumns();
            LocalReport localReport = new LocalReport();
            localReport.DisplayName = string.IsNullOrEmpty(Rdl.PageHeaderText) ? "Report" : Rdl.PageHeaderText;

            localReport.LoadReportDefinition(m_rdl);
            localReport.DataSources.Add(new ReportDataSource("MyData", m_dataSet));
            var winFormsReportExporter = new WinFormsReportExporter(localReport);

            StringBuilder builder = new StringBuilder("<DeviceInfo>");
            NameValueCollection requestParameters = context.Request.QueryString;
            for (int i = 0; i < requestParameters.Count; i++)
            {
                if (requestParameters.Keys[i] != null)
                {
                    if (requestParameters.Keys[i].StartsWith("rc:", StringComparison.OrdinalIgnoreCase))
                    {
                        builder.AppendFormat("<{0}>{1}</{0}>", XmlConvert.EncodeName(requestParameters.Keys[i].Substring(3)), HttpUtility.HtmlEncode(requestParameters[i]));
                    }
                }
            }
            builder.Append("</DeviceInfo>");

            localReport.Render("IMAGE", builder.ToString(), delegate(string name, string extension, Encoding encoding, string mimeType, bool willSeek)
            {
                if (!HttpContext.Current.Response.IsClientConnected)
                {
                    throw new HttpException("Client disconnected");
                }
                if (lastMemoryStream != null)
                {
                    SendPrintStream(lastMemoryStream, response);
                    lastMemoryStream.Dispose();
                    lastMemoryStream = null;
                }
                lastMemoryStream = new MemoryStream();
                return lastMemoryStream;
            }, out warningArray);
            SendPrintStream(lastMemoryStream, response);
            lastMemoryStream.Dispose();
            SendPrintStream(null, response);

            if (!response.BufferOutput)
            {
                string a = context.Request.ServerVariables["SERVER_PROTOCOL"];
                if (string.Equals(a, "HTTP/1.0", StringComparison.OrdinalIgnoreCase))
                {
                    context.Response.Close();
                }
            }
        }
开发者ID:carlosgilf,项目名称:prettyjs,代码行数:66,代码来源:DynamicReport.cs


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