Exemplo n.º 1
0
        public Phrase GetPhrase(string column_val, DbType column_type, EbFont _reportFont)
        {
            Phrase phrase = GetFormattedPhrase(this.Font, _reportFont, column_val);

            if (column_val != string.Empty)
            {
                try
                {
                    BaseFont calcbasefont = phrase.Font.GetCalculatedBaseFont(false);
                    float    stringwidth  = calcbasefont.GetWidthPoint(column_val, phrase.Font.CalculatedSize);
                    if (stringwidth > 0)
                    {
                        float charwidth            = stringwidth / column_val.Length;
                        int   numberofCharsInALine = Convert.ToInt32(Math.Floor(WidthPt / charwidth));
                        if (numberofCharsInALine < column_val.Length)
                        {
                            if (column_type == System.Data.DbType.Int32 || column_type == System.Data.DbType.Decimal || column_type == System.Data.DbType.Double || column_type == System.Data.DbType.Int16 || column_type == System.Data.DbType.Int64 || column_type == System.Data.DbType.VarNumeric)
                            {
                                column_val = "###";
                            }
                            else if (!this.RenderInMultiLine)
                            {
                                column_val = column_val.Substring(0, numberofCharsInALine - 2) + "...";
                            }
                        }
                    }
                }
                catch (Exception e)
                {
                    throw e;
                }
            }
            return(GetFormattedPhrase(this.Font, _reportFont, column_val));
        }
Exemplo n.º 2
0
 public Phrase GetFormattedPhrase(EbFont Font, EbFont _reportFont, string text)
 {
     iTextSharp.text.Font iTextFont = null;
     if (Font is null)
     {
         if (!(_reportFont is null))
         {
             Font = _reportFont;
         }
         else
         {
             Font = (new EbFont {
                 Color = "#000000", FontName = "Roboto", Caps = false, Size = 10, Strikethrough = false, Style = 0, Underline = false
             });
         }
     }