コード例 #1
2
ファイル: ReportResult.cs プロジェクト: hash2000/WorkTime
        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
                );
        }
コード例 #2
0
ファイル: ReportUtil.cs プロジェクト: NiponJaiboon/RiskEval
        /// <summary>
        /// Method to provide create MS-Report for website
        /// </summary>
        /// <param name="reportPath">Physical path of report</param>
        /// <param name="reportType">Export type PDF or Excel</param>
        /// <param name="reportName">Report name</param>
        /// <param name="reportDataSource">Report Datasource</param>
        /// <param name="response">HttpResponse</param>
        public static void ExportMSReport(string reportPath, string reportType, string reportName
                                          , ReportDataSource reportDataSource, System.Web.HttpResponse response
                                          , SubreportProcessingEventHandler subreportProcessingEvent
                                          , IEnumerable <ReportParameter> reportParameters)
        {
            // Variables
            Warning[] warnings;
            string[]  streamIds;
            string    mimeType  = string.Empty;
            string    encoding  = string.Empty;
            string    extension = string.Empty;

            // Setup the report viewer object and get the array of bytes
            ReportViewer viewer = new ReportViewer();

            viewer.ProcessingMode = ProcessingMode.Local;
            viewer.LocalReport.DataSources.Add(reportDataSource);
            viewer.LocalReport.ReportPath = reportPath;
            //viewer.LocalReport.LoadSubreportDefinition("",)
            viewer.LocalReport.SetParameters(reportParameters);
            viewer.LocalReport.SubreportProcessing += subreportProcessingEvent;

            byte[] bytes = viewer.LocalReport.Render(reportType, null, out mimeType, out encoding, out extension, out streamIds, out warnings);

            // Now that you have all the bytes representing the PDF report, buffer it and send it to the client.
            response.Buffer = true;
            response.Clear();
            response.ClearContent();
            response.ClearHeaders();
            response.ContentType     = mimeType;
            response.ContentEncoding = System.Text.Encoding.UTF8;
            response.AddHeader("content-disposition", "attachment; filename=" + reportName + "." + extension);
            response.BinaryWrite(bytes); // create the file
            response.End();              // send it to the client to download
        }
コード例 #3
0
 public SalaryListReport(string name, List <int> id)
 {
     NameReport     = name;
     _checkedId     = id;
     DataSources    = new List <ReportDataSource>();
     SubreportProc += SubreportVocSickLaw;
     SubreportProc += SubreportPaymentAccr;
     SubreportProc += SubreportTaxes;
 }