//----------------------------------------------------------------------------------------------------x /// <summary>Gets a font handle for the specified font family.</summary> /// <remarks>If the font family is already registered a ReportException will be thrown.</remarks> /// <param name="report">Report to which this font belongs</param> /// <param name="sFontName">Name of the font family</param> public static FontDef fontDef_FromName(Report report, String sFontName) { Debug.Assert(sFontName != null); FontDef fontDef = (FontDef)report.ht_FontDef[sFontName]; if (fontDef == null) { return(new FontDef(report, sFontName)); } return(fontDef); }
//----------------------------------------------------------------------------------------------------x /// <summary>Initializes the font definition class.</summary> /// <param name="fontDef"></param> internal protected abstract void InitFontDef(FontDef fontDef);
//----------------------------------------------------------------------------------------------------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())); } }
//----------------------------------------------------------------------------------------------------x /// <summary>Initializes a new font property object</summary> /// <param name="fontDef">Font definition</param> /// <param name="rSize">Size of the font</param> public FontProp(FontDef fontDef, Double rSize) : this(fontDef, rSize, Color.Black) { }
//----------------------------------------------------------------------------------------------------x /// <summary>Initializes a new font property object</summary> /// <param name="fontDef">Font definition</param> /// <param name="rSize">Size of the font</param> /// <param name="color">Color of the font</param> public FontProp(FontDef fontDef, Double rSize, Color color) { this._fontDef = fontDef; this._rSize = rSize; this._color = color; }
//----------------------------------------------------------------------------------------------------x /// <summary>Initializes a new font property object with metric values</summary> /// <param name="fontDef">Font definition</param> /// <param name="rSize">Size of the font in millimeter</param> /// <param name="color">Color of the font</param> public FontPropMM(FontDef fontDef, Double rSize, Color color) : base(fontDef, RT.rMM(rSize), color) { }
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())); } }