Beispiel #1
0
        internal FixedPage BuildPage(ClassicReportPage page)
        {
            FixedPage fpage = new FixedPage();

            fpage.Height = (_report.PaperHeight * DPI) / 100;
            fpage.Width  = (_report.PaperWidth * DPI) / 100;
            (fpage as IAddChild).AddChild(BuildCanvas(page));
            return(fpage);
        }
Beispiel #2
0
        internal PageContent BuildPageContent(ClassicReportPage page)
        {
            PageContent content = new PageContent();

            content.BeginInit();
            (content as IAddChild).AddChild(BuildPage(page));
            content.EndInit();
            return(content);
        }
Beispiel #3
0
        internal Canvas BuildCanvas(ClassicReportPage page)
        {
            Canvas       canvas     = new Canvas();
            double       leftMargin = 10;
            double       topMargin  = 25;
            double       yPos       = topMargin;
            double       xPos       = leftMargin;
            Size         size       = GetFontSize(_report.Cpi);
            StringReader reader     = new StringReader(page.ToString());
            string       row        = reader.ReadLine();

            while (row != null)
            {
                canvas.Children.Add(BuildText(row, yPos, xPos, size.Width));
                yPos += size.Height;
                row   = reader.ReadLine();
            }
            reader.Close();
            return(canvas);
        }
        private void OnPrintPage(object sender, System.Drawing.Printing.PrintPageEventArgs e)
        {
            System.Windows.Forms.Application.DoEvents();
            float             height     = e.MarginBounds.Height / document.PageHeight;
            float             leftMargin = e.MarginBounds.Left;
            float             topMargin  = e.MarginBounds.Top;
            float             yPos       = topMargin;
            Font              printFont  = FontProvider.GetFont(document.Cpi);
            ClassicReportPage page       = document[fromPage - 1];

            for (int rowIndex = 0; rowIndex < document.PageHeight; rowIndex++)
            {
                foreach (ClassicReportPageItem item in page.GetItems(rowIndex))
                {
                    float xPos = leftMargin;
                    if (item.Offset > 0)
                    {
                        xPos += e.Graphics.MeasureString(Utility.RepeatChar('a', item.Offset - 1), printFont).Width;
                    }
                    System.Drawing.FontStyle fontStyle = System.Drawing.FontStyle.Regular;
                    if (item.IsBold)
                    {
                        fontStyle |= System.Drawing.FontStyle.Bold;
                    }
                    if (item.IsItalic)
                    {
                        fontStyle |= System.Drawing.FontStyle.Italic;
                    }
                    if (item.IsUnderline)
                    {
                        fontStyle |= System.Drawing.FontStyle.Underline;
                    }
                    Font itemFont = new Font(printFont, fontStyle);
                    e.Graphics.DrawString(item.Value, itemFont, Brushes.Black, xPos, yPos);
                    itemFont.Dispose();
                }
                yPos += height;
            }
            e.HasMorePages = ++fromPage <= toPage;
            printFont.Dispose();
        }
Beispiel #5
0
 void AddPage(ClassicReportPage page)
 {
     (fixedDocument as IAddChild).AddChild(BuildPageContent(page));
 }