예제 #1
0
        public void NewLine(bool pBanding = false, EnumDocumentParts pArea = EnumDocumentParts.BODY)
        {
            var _line = new PrintableLine()
            {
                Banding = pBanding, LineNumber = BodyList.Lines.Count
            };

            _line.Add(new PrintableText(" ", CurrentFont));
            switch (pArea)
            {
            case EnumDocumentParts.HEADER:
                HeaderList.Lines.Add(_line);
                CurrentLineIndex = HeaderList.Lines.Count - 1;
                CurrentZone      = EnumDocumentParts.HEADER;
                break;

            case EnumDocumentParts.BODY:
                BodyList.Lines.Add(_line);
                CurrentLineIndex = BodyList.Lines.Count - 1;
                CurrentZone      = EnumDocumentParts.BODY;
                break;

            case EnumDocumentParts.FOOTER:
                FooterList.Lines.Add(_line);
                CurrentLineIndex = FooterList.Lines.Count - 1;
                CurrentZone      = EnumDocumentParts.FOOTER;
                break;
            }
        }
예제 #2
0
        protected override void OnPrintPage(PrintPageEventArgs e)
        {
            var g = e.Graphics;

            g.PageUnit = GraphicsUnit.Millimeter;
            float _x = XMin;
            float _y = YMin;

            //lets print the header
            HeaderList.Lines.ForEach(l =>
            {
                PrintDocumentLine(l, g, ref _y);
            });

            // lets print the lines
            if (BodyList.LastPrintedLine > 1)
            {
                PrintDocumentLine(BodyList.Lines[1], g, ref _y, BodyXOffset); // column titles in following new pages
            }
            while (_y <= YMax && BodyList.LastPrintedLine < BodyList.Lines.Count)
            {
                PrintDocumentLine(BodyList.Lines[BodyList.LastPrintedLine], g, ref _y, BodyXOffset);
                BodyList.LastPrintedLine++;
            }

            // lets print the footer
            _y = YMax;
            FooterList.Lines.ForEach(l =>
            {
                PrintDocumentLine(l, g, ref _y);
            });

            if (PageCounter != 0)
            {
                var _pCounter = new PrintableLine();
                _pCounter.Add(new PrintableText(string.Format("Page {0}", PageCounter), new Font("Courier New", 12, FontStyle.Bold)));
                PrintDocumentLine(_pCounter, g, ref _y);
                PageCounter++;
            }

            // are going to be more pages?
            e.HasMorePages = (BodyList.LastPrintedLine < BodyList.Lines.Count);

            base.OnPrintPage(e);
        }