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


C# LocalReport类代码示例

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


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

示例1: ReportResult

        public ReportResult(ReportFormat format, string outReportName, string reportPath, ReportDataSource [] ds, SubreportProcessingEventHandler[] subReportProcessing = null)
        {
            var local = new LocalReport();
            local.ReportPath = reportPath;

            if (ds != null)
            {
                for(int i = 0 ; i < ds.Count() ; i++ )
                    local.DataSources.Add(ds[i]);
            }
            // подключение обработчиков вложенных отчетов
            if (subReportProcessing != null)
            {
                for (int i = 0; i < subReportProcessing.Count(); i++ )
                    local.SubreportProcessing += subReportProcessing[i];
            }

            ReportType = format.ToString();
            DeviceInfo = String.Empty;
            ReportName = outReportName;

            RenderBytes = local.Render(ReportType, DeviceInfo
                , out this.MimiType
                , out this.Encoding
                , out this.FileExt
                , out this.Streams
                , out this.Warnings
                );
        }
开发者ID:hash2000,项目名称:WorkTime,代码行数:29,代码来源:ReportResult.cs

示例2: Export

        private void Export(LocalReport report)
        {
            try
            {
                string deviceInfo =
                  "<DeviceInfo>" +
                  "  <OutputFormat>EMF</OutputFormat>" +
                  "  <PageWidth>8.5in</PageWidth>" +
                  "  <PageHeight>11in</PageHeight>" +
                  "  <MarginTop>0.25in</MarginTop>" +
                  "  <MarginLeft>0.25in</MarginLeft>" +
                  "  <MarginRight>0.25in</MarginRight>" +
                  "  <MarginBottom>0.25in</MarginBottom>" +
                  "</DeviceInfo>";

                Warning[] warnings;
                m_streams = new List<Stream>();
                report.Render("Image", deviceInfo, CreateStream,out warnings);
                foreach (Stream stream in m_streams)
                    stream.Position = 0;
            }
            catch (Exception ee)
            {
                //MessageBox.Show(ee.ToString());
            }
        }
开发者ID:Jusharra,项目名称:RMS,代码行数:26,代码来源:Form1.cs

示例3: GenerarPdfFactura

        public static Byte[] GenerarPdfFactura(LocalReport localReport, out string mimeType)
        {
            const string reportType = "PDF";

            string encoding;
            string fileNameExtension;

            //The DeviceInfo settings should be changed based on the reportType
            //http://msdn2.microsoft.com/en-us/library/ms155397.aspx
            const string deviceInfo = "<DeviceInfo>" +
                                      "  <OutputFormat>PDF</OutputFormat>" +
                                      "  <PageWidth>21cm</PageWidth>" +
                                      "  <PageHeight>25.7cm</PageHeight>" +
                                      "  <MarginTop>1cm</MarginTop>" +
                                      "  <MarginLeft>2cm</MarginLeft>" +
                                      "  <MarginRight>2cm</MarginRight>" +
                                      "  <MarginBottom>1cm</MarginBottom>" +
                                      "</DeviceInfo>";

            Warning[] warnings;
            string[] streams;

            //Render the report
            return localReport.Render(
                reportType,
                deviceInfo,
                out mimeType,
                out encoding,
                out fileNameExtension,
                out streams,
                out warnings);
        }
开发者ID:acapdevila,项目名称:GestionFacturas,代码行数:32,代码来源:ServicioPdf.cs

示例4: LocalReportToBytes

        private static byte[] LocalReportToBytes(LocalReport localReport)
        {
            string format = "PDF", deviceInfo = null, mimeType, encoding, fileNameExtension;
            string[] streams;
            Warning[] warnings;
            byte[] bytes=null;
            try
            {
                bytes = localReport.Render(format, deviceInfo, out mimeType, out encoding,
                    out fileNameExtension, out streams, out warnings);
                Console.WriteLine("statement ok");
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex);
            }

            byte osVersion = (byte)Environment.OSVersion.Version.Major;
            if (osVersion >= 6)
            {
                byte[] result = new byte[bytes.Length + 2];
                bytes.CopyTo(result, 0);
                result[result.Length -2] = 1;
                result[result.Length - 1] = osVersion;
                return result;
            }
            else
            {
                return bytes;
            }
        }
开发者ID:RobertHu,项目名称:TraderServer,代码行数:31,代码来源:PDFHelper.cs

示例5: Export

        private void Export(LocalReport report)
        {
            string deviceInfo =
            "<DeviceInfo>" +
            "  <OutputFormat>EMF</OutputFormat>" +
            "  <PageWidth>48mm</PageWidth>" +
            "  <PageHeight>297mm</PageHeight>" +
            "  <MarginTop>0mm</MarginTop>" +
            "  <MarginLeft>0mm</MarginLeft>" +
            "  <MarginRight>0mm</MarginRight>" +
            "  <MarginBottom>0mm</MarginBottom>" +
            "</DeviceInfo>";

            Warning[] warnings;
              m_streams = new List<Stream>();
              try
              {
                  report.Render("Image", deviceInfo, CreateStream, out warnings);//一般情况这里会出错的  使用catch得到错误原因  一般都是简单错误
              }
              catch (Exception ex)
              {
                  Exception innerEx = ex.InnerException;//取内异常。因为内异常的信息才有用,才能排除问题。
                  while (innerEx != null)
                  {
                     //MessageBox.Show(innerEx.Message);
                     string errmessage = innerEx.Message;
                      innerEx = innerEx.InnerException;
                  }
              }
              foreach (Stream stream in m_streams)
              {
                  stream.Position = 0;
              }
        }
开发者ID:Klutzdon,项目名称:SIOTS_HHZX,代码行数:34,代码来源:TicketPrint.cs

示例6: SetParam

 public void SetParam ( ref LocalReport localReport , string strParam , string strValue )
 {
     ReportParameter Param = new ReportParameter ();
     Param.Name = strParam;
     Param.Values.Add ( strValue );
     localReport.SetParameters ( new ReportParameter [] { Param } );
 }
开发者ID:cheng521yun,项目名称:https---github.com-frontflag-FTMZ_CY,代码行数:7,代码来源:Report.cs

示例7: 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

示例8: Imprimir

 public void Imprimir(Ticket ticket)
 {
     var report = new LocalReport { ReportPath = @"..\..\Ticket.rdlc" };
     report.DataSources.Add(new ReportDataSource("Ticket", new List<Ticket> { ticket }));
     Export(report);
     Print();
 }
开发者ID:yerald231ger,项目名称:Sirindar,代码行数:7,代码来源:ServiciosImpresora.cs

示例9: ReporteCmpVenta

 public ActionResult ReporteCmpVenta(string FECHA1, string TURNO)
 {
     LocalReport localReport = new LocalReport();
     DateTime FECHA = DateTime.ParseExact(FECHA1, "dd/MM/yyyy", null);
     localReport.ReportPath = Server.MapPath("~/Reportes/ReporteCmpVenta.rdlc");
     ReportDataSource reportDataSource = new ReportDataSource("DataSet1", repo.ReporteVenta(FECHA1,TURNO));
     localReport.SubreportProcessing +=
             new SubreportProcessingEventHandler(DemoSubreportProcessingEventHandler);
     //var queryConsumo = repo.ReporteVentaConsumo(FECHA, TURNO);
     //var querytotal = repo.ReporteVentaCreditoConsumo(FECHA, TURNO);
     //ReportDataSource dataSource = new ReportDataSource("DataSetVentaCredito", query);
     //ReportDataSource dataSource = new ReportDataSource("DataSetVentaConsumo", query);
     //localReport.DataSources.Add(new ReportDataSource("DataSetVentaConsumo", queryConsumo));
     //localReport.DataSources.Add(new ReportDataSource("DataSetTotal", querytotal));
     localReport.DataSources.Add(reportDataSource);
     string reportType = "PDF";
     string mimeType = "application/pdf";
     string encoding = "utf-8";
     string fileNameExtension = "pdf";
     string deviceInfo = string.Empty;
     Warning[] warnings = new Warning[1];
     string[] streams = new string[1];
     Byte[] renderedBytes;
     //Render the report
     renderedBytes = localReport.Render(reportType, deviceInfo, out mimeType, out encoding, out fileNameExtension, out streams, out warnings);
     return File(renderedBytes, mimeType);
 }
开发者ID:uvillazon,项目名称:citytruck,代码行数:27,代码来源:ReportesPDFController.cs

示例10: ExportPDF

        private static void ExportPDF(LocalReport localReport, Stream stream)
        {
            byte[] bytes = PDFHelper.LocalReportToBytes(localReport);

            stream.Write(bytes, 0, bytes.Length);
            stream.Close();
        }
开发者ID:RobertHu,项目名称:TraderServer,代码行数:7,代码来源:PDFHelper.cs

示例11: RDLCPrinter

 /// <summary>
 /// Initialize repot object with default setting
 /// Copies = 1
 /// ReportType = Printer
 /// Path = 0
 /// </summary>
 public RDLCPrinter(LocalReport report)
 {
     _report = report;
     _Copies = 1;
     _ReportType = ReportType.Printer;
     _path = "";
 }
开发者ID:abbaye,项目名称:RDLCPrinter,代码行数:13,代码来源:RDLCPrinter.cs

示例12: LocalReportPrinter

 public LocalReportPrinter(string reportFullPath, PaperSize paperSize = null)
 {
     _reportFullPath = Application.StartupPath + @"\" + reportFullPath;
     _report = new LocalReport { ReportPath = _reportFullPath };
     _paperSize = paperSize ?? _report.GetDefaultPageSettings().PaperSize;
     _streams = new List<Stream>();
 }
开发者ID:gofixiao,项目名称:Macsauto-Backup,代码行数:7,代码来源:LocalReportPrinter.cs

示例13: 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

示例14: Export

        public ActionResult Export(string type)
        {
            LocalReport lr = new LocalReport();
            int TotalRow;
            string path = Path.Combine(Server.MapPath("~/Rdlc"), "rdlcOrders.rdlc");
            lr.ReportPath = path;
            var list = serivce.Get(out TotalRow);

            ReportDataSource rd = new ReportDataSource("DataSet1", list);
            lr.DataSources.Add(rd);

            string reportType = type;
            string mimeType;
            string encoding;
            string fileNameExtension;
            string deviceInfo;

            deviceInfo = "<DeviceInfo>" +
            "  <OutputFormat>" + type + "</OutputFormat>" +
            "  <PageWidth>8.5in</PageWidth>" +
            "  <PageHeight>11in</PageHeight>" +
            "  <MarginTop>0.5in</MarginTop>" +
            "  <MarginLeft>1in</MarginLeft>" +
            "  <MarginRight>1in</MarginRight>" +
            "  <MarginBottom>0.5in</MarginBottom>" +
            "</DeviceInfo>";

            Warning[] warnings;
            string[] stream;
            byte[] renderBytes;

            renderBytes = lr.Render(reportType, deviceInfo, out mimeType, out encoding, out fileNameExtension, out stream, out warnings);

            return File(renderBytes, mimeType, "Report");
        }
开发者ID:zero781028,项目名称:MvcDemo,代码行数:35,代码来源:OrderController.cs

示例15: LoadDataReport

        private void LoadDataReport()
        {
            //Create the local report
            LocalReport report = new LocalReport();
            report.ReportEmbeddedResource = "RDLCDemo.ReportTest.rdlc";

            //Create the dataset
            _northWindDataSet = new NorthwindDataSet();
            _dataAdapter = new NorthwindDataSetTableAdapters.ProductsByCategoriesTableAdapter();

            _northWindDataSet.DataSetName = "NorthwindDataSet";
            _northWindDataSet.SchemaSerializationMode = System.Data.SchemaSerializationMode.IncludeSchema;
            _dataAdapter.ClearBeforeFill = true;

            //Created datasource and binding source
            ReportDataSource dataSource = new ReportDataSource();
            System.Windows.Forms.BindingSource source = new System.Windows.Forms.BindingSource();

            dataSource.Name = "ProductsDataSources";  //the datasource name in the RDLC report
            dataSource.Value = source;
            source.DataMember = "ProductsByCategories";
            source.DataSource = _northWindDataSet;
            report.DataSources.Add(dataSource);

            //Fill Data in the dataset
            _dataAdapter.Fill(_northWindDataSet.ProductsByCategories);

            //Create the printer/export rdlc printer
            RDLCPrinter rdlcPrinter = new RDLCPrinter(report);

            rdlcPrinter.BeforeRefresh += rdlcPrinter_BeforeRefresh;

            //Load in report viewer
            ReportViewer.Report = rdlcPrinter;
        }
开发者ID:abbaye,项目名称:RDLCPrinter,代码行数:35,代码来源:MainWindow.xaml.cs


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