Exemplo n.º 1
0
        /// <summary>
        ///     PdfTable constructor.
        /// </summary>
        /// <param name="Page">Current PdfPage.</param>
        /// <param name="Contents">Current PdfContents.</param>
        /// <param name="Font">Table's default font.</param>
        /// <param name="FontSize">Table's default font size.</param>
        public PdfTable
        (
            PdfPage Page,
            PdfContents Contents,
            PdfFont Font    = null,
            double FontSize = 9.0
        )
        {
            // save arguments
            Document      = Page.Document;
            this.Page     = Page;
            this.Contents = Contents;

            // See if at least one font is defined. Make it the default font for the table
            if (Font == null)
            {
                foreach (var Obj in Document.ObjectArray)
                {
                    if (Obj.GetType() == typeof(PdfFont))
                    {
                        Font = (PdfFont)Obj;
                        break;
                    }
                }
            }

            // initialize default cell style
            DefaultCellStyle = new PdfTableStyle
            {
                Font     = Font,
                FontSize = FontSize
            };
            DefaultCellStyle.Margin.Left   = DefaultCellStyle.Margin.Right = 3.0 / Document.ScaleFactor;
            DefaultCellStyle.Margin.Bottom = DefaultCellStyle.Margin.Top = 1.0 / Document.ScaleFactor;

            // initialize default header style
            DefaultHeaderStyle = CellStyle;
            DefaultHeaderStyle.BackgroundColor = Color.LightGray;

            // default table area
            TableArea = new PdfRectangle(72.0 / Page.ScaleFactor, 72.0 / Page.ScaleFactor,
                                         (Page.Width - 72.0) / Page.ScaleFactor, (Page.Height - 72.0) / Page.ScaleFactor);

            // set header on each page as the default
            HeaderOnEachPage = true;

            // create table border control
            Borders = new PdfTableBorder(this);

            // very small amount 1/300 of an inch
            // used to guard against rounding errors
            Epsilon = Document.Epsilon;
        }
Exemplo n.º 2
0
        /// <summary>
        /// PdfTable constructor.
        /// </summary>
        /// <param name="Page">Current PdfPage.</param>
        /// <param name="Contents">Current PdfContents.</param>
        /// <param name="Font">Table's default font.</param>
        /// <param name="FontSize">Table's default font size.</param>
        public PdfTable(
			PdfPage		Page,
			PdfContents	Contents,
			PdfFont		Font = null,
			Double		FontSize = 9.0
			)
        {
            // save arguments
            this.Document = Page.Document;
            this.Page = Page;
            this.Contents = Contents;

            // See if at least one font is defined. Make it the default font for the table
            if(Font == null) foreach(PdfObject Obj in Document.ObjectArray) if(Obj.GetType() == typeof(PdfFont))
            {
            Font = (PdfFont) Obj;
            break;
            }

            // initialize default cell style
            DefaultCellStyle = new PdfTableStyle();
            DefaultCellStyle.Font = Font;
            DefaultCellStyle.FontSize = FontSize;
            DefaultCellStyle.Margin.Left = DefaultCellStyle.Margin.Right = 3.0 / Document.ScaleFactor;
            DefaultCellStyle.Margin.Bottom = DefaultCellStyle.Margin.Top = 1.0 / Document.ScaleFactor;

            // initialize default header style
            DefaultHeaderStyle = CellStyle;
            DefaultHeaderStyle.BackgroundColor = Color.LightGray;

            // default table area
            TableArea = new PdfRectangle(72.0 / Document.ScaleFactor, 72.0 / Document.ScaleFactor,
            (Document.PageSize.Width - 72.0) / Document.ScaleFactor, (Document.PageSize.Height - 72.0) / Document.ScaleFactor);

            // set header on each page as the default
            HeaderOnEachPage = true;

            // create table border control
            Borders = new PdfTableBorder(this);

            // very small amount 1/300 of an inch
            // used to guard against rounding errors
            Epsilon = 1.0 / (300.0 * Document.ScaleFactor);
            return;
        }