コード例 #1
0
ファイル: BaseReportContainer.cs プロジェクト: gipasoft/Sfera
        protected virtual void Inizializza(ImpostazioneReportDTO impostazioniReport, string noteRtf)
        {
            _impostazioniReport = impostazioniReport;

            // Create XtraReport instance
            _report = GetXtraReport(impostazioniReport, _isSubreport);
            _report.BeginInit();

            if (!_isSubreport)
            {
                _reportHeaderBand = new ReportHeaderBand();
                _reportFooterBand = new ReportFooterBand();
                _topMarginBand = new TopMarginBand();
                _bottomMarginBand = new BottomMarginBand();
                _pageFooterBand = new PageFooterBand();
            }

            _pageHeaderBand = new PageHeaderBand();
            _detailBand = new DetailBand();

            //
            // Report Header
            //
            if (_reportHeaderBand != null)
            {
                _reportHeaderBand.Name = "ReportHeader";
                _reportHeaderBand.Padding = new PaddingInfo(0, 0, 0, 0, 100F);
                _reportHeaderBand.TextAlignment = TextAlignment.TopLeft;
            }

            //
            // Report Footer
            //
            if (_reportFooterBand != null)
            {
                _reportFooterBand.Name = "ReportFooter";
                _reportFooterBand.Padding = new PaddingInfo(0, 0, 0, 0, 100F);
                _reportFooterBand.TextAlignment = TextAlignment.TopLeft;
            }

            //
            // Page Header
            //
            if (_pageHeaderBand != null)
            {
                _pageHeaderBand.Name = "PageHeader";
                _pageHeaderBand.Padding = new PaddingInfo(0, 0, 0, 0, 100F);
                _pageHeaderBand.TextAlignment = TextAlignment.TopLeft;
                if (_isSubreport)
                    _pageHeaderBand.HeightF = 40f;
            }

            //
            // Page Footer
            //
            if (_pageFooterBand != null)
            {
                _pageFooterBand.Name = "PageFooter";
                _pageFooterBand.Padding = new PaddingInfo(0, 0, 0, 0, 100F);
                _pageFooterBand.TextAlignment = TextAlignment.TopLeft;
            }

            // 
            // TopMargin
            // 
            if (_topMarginBand != null)
            {
                _topMarginBand.Name = "TopMargin";
                _topMarginBand.Padding = new PaddingInfo(0, 0, 0, 0, 100F);
                _topMarginBand.TextAlignment = TextAlignment.TopLeft;
                _topMarginBand.HeightF = 10;
            }

            // 
            // BottomMargin
            //
            if (_bottomMarginBand != null)
            {
                _bottomMarginBand.Name = "BottomMargin";
                _bottomMarginBand.Padding = new PaddingInfo(0, 0, 0, 0, 100F);
                _bottomMarginBand.TextAlignment = TextAlignment.TopLeft;
                _bottomMarginBand.HeightF = 10;
            }

            // 
            // Detail
            // 
            _detailBand.Name = "Detail";
            _detailBand.Padding = new PaddingInfo(0, 0, 0, 0, 100F);
            _detailBand.TextAlignment = TextAlignment.TopLeft;

            // 
            // RipartoConsuntivo
            // 
            _report.Bands.Add(_detailBand);

            if (_reportHeaderBand != null)
                _report.Bands.Add(_reportHeaderBand);
            if (_reportFooterBand != null)
                _report.Bands.Add(_reportFooterBand);
            if (_pageHeaderBand != null)
                _report.Bands.Add(_pageHeaderBand);
            if (_pageFooterBand != null)
                _report.Bands.Add(_pageFooterBand);
            if (_topMarginBand != null)
                _report.Bands.Add(_topMarginBand);
            if (_bottomMarginBand != null)
                _report.Bands.Add(_bottomMarginBand);

            _report.BeforePrint += RipartoConsuntivo_BeforePrint;

            if(!_isSubreport && _addLogo)
                addLogo();
            if (!_isSubreport && _addPageNumberFooter)
                addFooter();
        }