private void Tlm_NewContainer(Object oSender, TableLayoutManager.NewContainerEventArgs ea)
        {
            new Page(this);
            if (page_Cur.iPageNo == 1)
            {
                FontProp fp_Title = new FontPropMM(fd, 3);
                fp_Title.bBold = true;

                RepImage di = new RepImageMM(this.Ruta, Double.NaN, Double.NaN);
                page_Cur.AddLT_MM(rPosLeft, rPosTop, di);

                page_Cur.AddCT_MM(rPosLeft + (rPosRight - rPosLeft) / 2, rPosTop + di.rHeightMM, new RepString(fp_Title, this.Title));

                FontProp fp_Fecha = new FontPropMM(fd, 1.8);
                page_Cur.AddLT_MM(rPosRight, rPosTop, new RepString(fp_Fecha, DateTime.Now.ToShortDateString()));

                FontProp fp_SubTitle = new FontPropMM(fd, 2);
                fp_SubTitle.bBold = true;

                page_Cur.AddLT_MM(rPosLeft, rPosTop + rPosTop, new RepString(fp_SubTitle, Subtitle1));

                ea.container.rHeightMM -= (fp_Title.rLineFeedMM + di.rHeightMM + fp_SubTitle.rLineFeed);                  // reduce height of table container for the first page
            }
            else
            {
                FontProp fp_Title = new FontPropMM(fd, 2);
                fp_Title.bBold = true;
                page_Cur.AddLT_MM(rPosLeft, rPosTop, new RepString(fp_Title, Subtitle1));
                //page_Cur.AddAligned(rPosLeft, RepObj.rAlignRight, rPosTop, RepObj.rAlignTop, new RepString(fp_SubTitle, DateTime.Now.ToShortDateString()));
                //RepImage di = new RepImageMM(this.Ruta, Double.NaN, Double.NaN);
                //page_Cur.AddLT_MM(rPosLeft,rPosTop,di);
                //page_Cur.AddCT_MM(rPosLeft + (rPosRight - rPosLeft) / 2, rPosTop + di.rHeightMM, new RepString(fp_Title, this.Title));

                //FontProp fp_SubTitle = new FontPropMM(fd, 2);
                //fp_SubTitle.bBold = true;
                //page_Cur.AddLT_MM(rPosLeft,rPosTop + rPosTop,new RepString(fp_SubTitle, Subtitle1));
                ea.container.rHeightMM -= (fp_Title.rLineFeedMM);
            }
            page_Cur.AddMM(rPosLeft, rPosBottom - ea.container.rHeightMM, ea.container);
        }
Пример #2
0
        //----------------------------------------------------------------------------------------------------x
        /// <summary>Creates a new page</summary>
        /// <param name="oSender">Sender</param>
        /// <param name="ea">Event argument</param>
        private void Tlm_NewContainer(Object oSender, TableLayoutManager.NewContainerEventArgs ea)
        {
            new Page(this);

            // first page with heading
            if (page_Cur.iPageNo == 1)
            {
                FontProp fp_Title    = new FontPropMM(fd, 2);
                FontProp fp_Subtitle = new FontPropMM(fd, 2);

                RepImage di = new RepImageMM(this.Ruta, Double.NaN, Double.NaN);
                page_Cur.AddLT_MM(rPosLeft, rPosTop, di);

                page_Cur.AddLT_MM(rPosLeft, rPosTop + di.rHeightMM, new RepString(fp_Title, this.Title));
                page_Cur.AddLT_MM(rPosLeft, rPosTop + di.rHeightMM + fp_Title.rLineFeedMM, new RepString(fp_Subtitle, this.Subtitle));

                ea.container.rHeightMM -= (fp_Subtitle.rLineFeedMM + fp_Title.rLineFeedMM + di.rHeightMM);                  // reduce height of table container for the first page
            }

            // the new container must be added to the current page
            page_Cur.AddMM(rPosLeft, rPosBottom - ea.container.rHeightMM, ea.container);
        }
Пример #3
0
        //----------------------------------------------------------------------------------------------------x
        /// <summary>Creates this document</summary>
        internal protected override void Create()
        {
            fd = new FontDef(this, "Arial");
            FontProp fp        = new FontPropMM(fd, 1.6);
            FontProp fp_Header = new FontPropMM(fd, 1.9);

            fp_Header.bBold = true;


            // create table
            using (TableLayoutManager tlm = new TableLayoutManager(fp_Header))
            {
                tlm.rContainerHeightMM    = rPosBottom - rPosTop;               // set height of table
                tlm.headerCellDef.rAlignV = RepObj.rAlignCenter;                // set vertical alignment of all header cells
                tlm.headerCellDef.rAlignH = RepObj.rAlignCenter;                // set horizontal alignment of all header cells
                tlm.cellDef.pp_LineBottom = new PenProp(this, 0.05, Color.LightGray);
                tlm.eNewContainer        += new TableLayoutManager.NewContainerEventHandler(Tlm_NewContainer);

                // define columns
                TableLayoutManager.Column col;

                for (int i = 0; i < this.Head.Length; i++)
                {
                    col = new TableLayoutManager.ColumnMM(tlm, this.Head[i], this.WidthCol[i]);
                    col.cellDef.textMode = TableLayoutManager.TextMode.MultiLine;
                }

                for (int i = 0; i < this.Datos.Rows.Count; i++)
                {
                    tlm.NewRow();

                    /*int j = 0;
                     * //Da formato a la columna nro de guía
                     * tlm.Add(j, new RepString(fp, Utiles.Formatos.CerosIzq(Convert.ToInt32(this.Datos.Rows[i][this.Col[j++]]), 10)));
                     *
                     * //inserta la fila de condición de cobro
                     * tlm.Add(j, new RepString(fp, this.Datos.Rows[i][this.Col[j++]].ToString()));
                     *
                     * //Da formato a las columnas de importes
                     * for (; j < this.Col.Length-1; j++)
                     *      tlm.Add(j, new RepString(fp, Utiles.Formatos.Importe(Convert.ToDouble(this.Datos.Rows[i][this.Col[j]]))));
                     *
                     * //inserta la columna estado
                     * tlm.Add(j, new RepString(fp,
                     *      Convert.ToInt32(this.Datos.Rows[i][this.Col[j]]) == (int)SisPack.ValorEstadoAdministrativo.Anulada
                     *      ? "Anulada" : null));*/

                    int j = 2;
                    tlm.Add(j, new RepString(fp, this.Datos.Rows[i][this.Col[j++]].ToString()));
                    tlm.Add(j, new RepString(fp, this.Datos.Rows[i][this.Col[j++]].ToString()));
                }
                tlm.AdjustHeight();
            }

            // print page number and current date/time
            foreach (Page page in enum_Page)
            {
                Double rY = rPosBottom + 1.5;
                page.AddLT_MM(rPosLeft, rY, new RepString(fp, DateTime.Today.ToString("dd/MM/yyyy") + "  " + DateTime.Now.ToShortTimeString()));
                page.AddRT_MM(rPosRight, rY, new RepString(fp, page.iPageNo.ToString() + " / " + iPageCount.ToString()));
            }
        }
        internal protected override void Create()
        {
            fd = new FontDef(this, "Arial");
            FontProp fp        = new FontPropMM(fd, 1.4);
            FontProp fp_Header = new FontPropMM(fd, 1.4);

            fp_Header.bBold   = false;
            fp_Header.bItalic = false;

            using (TableLayoutManager tlm = new TableLayoutManager(fp_Header))
            {
                tlm.rContainerHeightMM    = rPosBottom - rPosTop;               // set height of table
                tlm.headerCellDef.rAlignV = RepObj.rAlignCenter;                // set vertical alignment of all header cells
                tlm.cellDef.pp_LineBottom = new PenProp(this, 0.05, Color.LightGray);
                tlm.eNewContainer        += new TableLayoutManager.NewContainerEventHandler(Tlm_NewContainer);

                TableLayoutManager.Column col;
                //for (int j = 0; j < this.Columnas1; j++)
                //{
                for (int i = 0; i < this.Head1.Length; i++)
                {
                    col = new TableLayoutManager.ColumnMM(tlm, this.Head1[i], this.WidthCol1[i]);
                    col.cellDef.textMode = TableLayoutManager.TextMode.MultiLine;
                    if (i > 2)
                    {
                        col.cellDef.rAlignH = RepObj.rAlignRight;
                    }
                }
                //}
                for (int i = 0; i < this.Datos1.Rows.Count; i++)
                {
                    tlm.NewRow();
                    for (int j = 0; j < Columnas1; j++)
                    {
                        tlm.Add(j, new RepString(fp, Datos1.Rows[i][this.Col1[j]].ToString()));
                    }
                }
                tlm.AdjustHeight();
            }
            using (TableLayoutManager tlm = new TableLayoutManager(fp_Header))
            {
                tlm.rContainerHeightMM    = rPosBottom - rPosTop;               // set height of table
                tlm.headerCellDef.rAlignV = RepObj.rAlignCenter;                // set vertical alignment of all header cells
                tlm.cellDef.pp_LineBottom = new PenProp(this, 0.05, Color.LightGray);
                tlm.eNewContainer        += new TableLayoutManager.NewContainerEventHandler(Tlm_NewContainer);
                TableLayoutManager.Column col;
                Subtitle1 = "Tarifarios de Entrega";
                //for(int j = 0; j < this.Columnas2; j++)
                //{
                for (int i = 0; i < this.Head2.Length; i++)
                {
                    col = new TableLayoutManager.ColumnMM(tlm, this.Head2[i], this.WidthCol2[i]);
                    col.cellDef.textMode = TableLayoutManager.TextMode.MultiLine;
                    if (i > 1)
                    {
                        col.cellDef.rAlignH = RepObj.rAlignRight;
                    }
                }
                //}
                for (int i = 0; i < this.Datos2.Rows.Count; i++)
                {
                    tlm.NewRow();
                    for (int j = 0; j < Columnas2; j++)
                    {
                        tlm.Add(j, new RepString(fp, this.Datos2.Rows[i][this.Col2[j]].ToString()));
                    }
                }
                tlm.AdjustHeight();
            }
            foreach (Page page in enum_Page)
            {
                Double rY = rPosBottom + 1.5;
                page.AddRT_MM(rPosRight, rY, new RepString(fp, page.iPageNo.ToString() + " / " + iPageCount.ToString()));
            }
        }