Exemple #1
0
        //创建页眉
        private PageSectionType CreatPageHeader()
        {
            var height = 0.91;
            var lrHeigth = 0.0;
            const double tableHeaderHeigth = 0.0;
            var items = new ArrayList();

            var ctb = new Textbox
            {
                Height = "0.9cm",
                Left = LeftMargin + "mm",
                Width = (A4Width - LeftMargin - RightMargin) + "mm",
                Paragraphs = CreateParagraphs(PageHeaderText, new Style { FontFamily = "宋体", FontSize = "18pt", FontWeight = "Bold", TextAlign = "Center" }.Create()),
                CanGrow = true,
                Style = new Style { FontSize = "18pt", FontWeight = "Bold", TextAlign = "Center" }.Create()
            };

            TextboxType headerTextbox = ctb.Create("Page_HeaderText");
            items.Add(headerTextbox);

            ctb.Width = ((A4Width - LeftMargin - RightMargin) / 2) + "mm";
            ctb.Height = "0.5cm";
            ctb.Paragraphs = CreateParagraphs(PageHeaderLeftText);
            ctb.Style = new Style { FontSize = "9pt", TextAlign = "Left" }.Create();
            ctb.Top = "0.92cm";
            TextboxType headerLeftTextbox = ctb.Create("Page_HeaderLeftText");
            if (!string.IsNullOrEmpty(PageHeaderLeftText))
            {
                items.Add(headerLeftTextbox);
                lrHeigth = 0.5;
            }

            ctb.Style = new Style { FontSize = "9pt", TextAlign = "Right" }.Create();
            ctb.Left = ((A4Width) / 2) + "mm";
            ctb.Paragraphs = CreateParagraphs(PageHeaderRightText);

            TextboxType headerRightTextbox = ctb.Create("Page_HeaderRightText");
            if (!string.IsNullOrEmpty(PageHeaderRightText))
            {
                items.Add(headerRightTextbox);
                lrHeigth = 0.5;
            }

            var reportItems = new ReportItemsType {Items = items.ToArray()};

            var header = new PageSection {ReportItems = reportItems};
            height = height + tableHeaderHeigth + lrHeigth;
            header.Height = height + "cm";
            header.PrintOnFirstPage = true;
            header.PrintOnLastPage = true;
            return header.Create();
        }
Exemple #2
0
        //����ҳü
        private PageSectionType CreatPageHeader()
        {
            double height = 0.91;
            double LRHeigth = 0.0;
            double tableHeaderHeigth = 0.0;
            ArrayList Items = new ArrayList();

            Textbox ctb = new Textbox
            {
                Height = "0.9cm",
                Left = LeftMargin.ToString() + "mm",
                Width = (A4Width - LeftMargin - RightMargin).ToString() + "mm",
                Paragraphs = CreateParagraphs(PageHeaderText, new Style { FontFamily="����", FontSize = "18pt", FontWeight = "Bold", TextAlign = "Center" }.Create()),
                CanGrow = true ,
                Style = new Style { FontSize = "18pt", FontWeight = "Bold", TextAlign = "Center" }.Create()
            };

            TextboxType headerTextbox = ctb.Create("Page_HeaderText");
            Items.Add(headerTextbox);

            ctb.Width = ((A4Width - LeftMargin - RightMargin) / 2).ToString() + "mm";
            ctb.Height = "0.5cm";
            ctb.Paragraphs = CreateParagraphs(PageHeaderLeftText);
            ctb.Style = new Style { FontSize = "9pt", TextAlign = "Left" }.Create();
            ctb.Top = "0.92cm";
            TextboxType headerLeftTextbox = ctb.Create("Page_HeaderLeftText");
            if (!string.IsNullOrEmpty(this.PageHeaderLeftText))
            {
                Items.Add(headerLeftTextbox);
                LRHeigth = 0.5;
            }

            ctb.Style = new Style { FontSize = "9pt", TextAlign = "Right" }.Create();
            ctb.Left = ((A4Width) / 2).ToString() + "mm";
            ctb.Paragraphs = CreateParagraphs(PageHeaderRightText);

            TextboxType headerRightTextbox = ctb.Create("Page_HeaderRightText");
            if (!string.IsNullOrEmpty(this.PageHeaderRightText))
            {
                Items.Add(headerRightTextbox);
                LRHeigth = 0.5;
            }

            ReportItemsType reportItems = new ReportItemsType();
            reportItems.Items = Items.ToArray();

            PageSection header = new PageSection();
            header.ReportItems = reportItems;
            height = height+tableHeaderHeigth + LRHeigth;
            header.Height = height.ToString()+"cm";
            header.PrintOnFirstPage = true;
            header.PrintOnLastPage = true;
            return header.Create();
        }
Exemple #3
0
        //创建页脚
        private PageSectionType CreatPageFooter()
        {
            string height = "0.65cm";
            string top = "0mm";
            var items = new ArrayList();

            var style = new Style {FontSize = "9pt", TextAlign = "Left"};
            var ctb = new Textbox
                          {
                              Width = ((A4Width - LeftMargin - RightMargin)/2) + "mm",
                              Height = "0.63cm",
                              Paragraphs = CreateParagraphs(PageFooterLeftText, style.Create()),
                              Style = style.Create(),
                              CanGrow = true,
                              Left = LeftMargin + "mm"
                          };
            TextboxType headerLeftTextbox = ctb.Create("Page_FooterLeftText");
            if (!string.IsNullOrEmpty(PageFooterLeftText))
            {
                items.Add(headerLeftTextbox);
                height = "1.1cm";
                top = "0.6cm";
            }

            style.TextAlign = "Right";
            ctb.Style = style.Create();
            ctb.Left = ((A4Width) / 2) + "mm";
            ctb.Paragraphs = CreateParagraphs(PageFooterRightText, style.Create());
            TextboxType headerRightTextbox = ctb.Create("Page_FooterRightText");
            if (!string.IsNullOrEmpty(PageFooterRightText))
            {
                items.Add(headerRightTextbox);
                height = "1.1cm";
                top = "0.6cm";
            }

            style.TextAlign = "Center";
            ctb = new Textbox
            {
                Top = top,
                Height = "0.6cm",
                //Left = LeftMargin + "mm",
                Width = (A4Width - LeftMargin - RightMargin) + "mm",
                Paragraphs = CreateParagraphs(string.Format("=" + _pageFooterText, "Globals!PageNumber", "Globals!TotalPages"), style.Create()),
                //Value = string.Format("=" + pageFooterText, "Globals!PageNumber", "Globals!TotalPages"),
                Style = style.Create()
            };
            TextboxType headerTextbox = ctb.Create("Page_FooterText");
            items.Add(headerTextbox);

            var reportItems = new ReportItemsType { Items = items.ToArray() };
            var header = new PageSection
                             {
                                 ReportItems = reportItems,
                                 Height = height,
                                 PrintOnFirstPage = true,
                                 PrintOnLastPage = true
                             };
            return header.Create();
        }
Exemple #4
0
        //����ҳ��
        private PageSectionType CreatPageFooter()
        {
            Style style = new Style();
            Textbox ctb = new Textbox();

            string height = "0.65cm";
            string top = "0mm";
            ArrayList Items = new ArrayList();

            style.FontSize = "9pt";
            style.TextAlign = "Left";
            ctb.Width = ((A4Width - LeftMargin - RightMargin) / 2).ToString() + "mm";
            ctb.Height = "0.63cm";
            ctb.Paragraphs = CreateParagraphs(PageFooterLeftText,style.Create());
            ctb.Style = style.Create();
            ctb.CanGrow = true;
            ctb.Left = LeftMargin.ToString() + "mm";
            TextboxType headerLeftTextbox = ctb.Create("Page_FooterLeftText");
            if (!string.IsNullOrEmpty(this.PageFooterLeftText))
            {
                Items.Add(headerLeftTextbox);
                height = "1.1cm";
                top = "0.6cm";
            }

            style.TextAlign = "Right";
            ctb.Style = style.Create();
            ctb.Left = ((A4Width) / 2).ToString() + "mm";
            ctb.Paragraphs = CreateParagraphs(PageFooterRightText, style.Create());
            TextboxType headerRightTextbox = ctb.Create("Page_FooterRightText");
            if (!string.IsNullOrEmpty(this.PageFooterRightText))
            {
                Items.Add(headerRightTextbox);
                height = "1.1cm";
                top = "0.6cm";
            }

            style.TextAlign = "Center";
            ctb = new Textbox
            {
                Top = top,
                Height = "0.6cm",
                Left = LeftMargin.ToString() + "mm",
                Width = (A4Width - LeftMargin - RightMargin).ToString() + "mm",
                Paragraphs = CreateParagraphs(string.Format("=" + pageFooterText, "Globals!PageNumber", "Globals!TotalPages"), style.Create()),
                //Value = string.Format("=" + pageFooterText, "Globals!PageNumber", "Globals!TotalPages"),
                Style = style.Create()
            };
            TextboxType headerTextbox = ctb.Create("Page_FooterText");
            Items.Add(headerTextbox);

            ReportItemsType reportItems = new ReportItemsType();
            reportItems.Items = Items.ToArray();
            PageSection header = new PageSection();
            header.ReportItems = reportItems;
            header.Height = height;
            header.PrintOnFirstPage = true;
            header.PrintOnLastPage = true;
            return header.Create();
        }