コード例 #1
0
 public string GetCalcFieldValue(EbPdfGlobals globals, EbDataSet DataSet, int serialnumber, EbReport Rep)
 {
     return(Rep.ExecuteExpression(Rep.ValueScriptCollection[this.Name], serialnumber, globals, DataFieldsUsedInCalc, true)?.ToString());
 }
コード例 #2
0
        public override void DrawMe(float printingTop, EbReport Rep, List <Param> Params, int slno)
        {
            ColumnText   ct         = new ColumnText(Rep.Canvas);
            string       column_val = string.Empty;
            EbDbTypes    dbtype     = EbDbTypes.String;
            EbPdfGlobals globals    = new EbPdfGlobals();

            try
            {
                column_val = Rep.ExecuteExpression(Rep.ValueScriptCollection[Name], slno, globals, DataFieldsUsedInCalc, true).ToString();
                dbtype     = (EbDbTypes)CalcFieldIntType;

                if (Rep.CalcValInRow.ContainsKey(Title))
                {
                    Rep.CalcValInRow[Title] = new PdfNTV {
                        Name = Title, Type = (PdfEbDbTypes)(int)dbtype, Value = column_val
                    }
                }
                ;
                else
                {
                    Rep.CalcValInRow.Add(Title, new PdfNTV {
                        Name = Title, Type = (PdfEbDbTypes)(int)dbtype, Value = column_val
                    });
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message + e.StackTrace);
            }
            if (SuppressIfZero && !(Convert.ToDecimal(column_val) > 0))
            {
                column_val = String.Empty;
            }
            else
            {
                if (dbtype == EbDbTypes.Decimal)
                {
                    column_val = FormatDecimals(column_val, AmountInWords, DecimalPlaces, Rep.CultureInfo?.NumberFormat, FormatUsingCulture);
                }
                if (Prefix != "" || Suffix != "")
                {
                    column_val = Prefix + " " + column_val + " " + Suffix;
                }
            }
            Phrase phrase = GetPhrase(column_val, (DbType)DbType, Rep.Font);

            if (!string.IsNullOrEmpty(LinkRefId))
            {
                Anchor    a = CreateLink(phrase, LinkRefId, Rep.Doc, Params);
                Paragraph p = new Paragraph {
                    a
                };
                p.Font = GetItextFont(this.Font, Rep.Font);
                ct.AddText(p);
            }
            else
            {
                ct.AddText(phrase);
            }

            float ury = Rep.HeightPt - (printingTop + TopPt + Rep.detailprintingtop);
            float lly = Rep.HeightPt - (printingTop + TopPt + HeightPt + Rep.detailprintingtop);

            ct.SetSimpleColumn(Llx, lly, Urx, ury, Leading, (int)TextAlign);
            ct.Go();
        }