protected override void OnBeforePrint(System.Drawing.Printing.PrintEventArgs e) { if (TmpFormula.Length == 0) { TmpFormula = Text; } string strFormula = TmpFormula; object ObjData; try { if (strFormula == null || strFormula.Length == 0) { return; } ObjData = Report.GetCurrentColumnValue(strFormula); if (ObjData != null) { try { Type tp = ObjData.GetType(); if (tp == typeof(decimal)) { decimal TmpDec = (decimal)ObjData; if (_FormatString.Length > 0) { Text = TmpDec.ToString(_FormatString); } else { Text = ObjData.ToString(); } } else if (tp == typeof(DateTime)) { DateTime dt = (DateTime)ObjData; if (_FormatString.Length > 0) { Text = dt.ToString(_FormatString); } else { Text = ObjData.ToString(); } } else { Text = ObjData.ToString(); } } catch { Text = ObjData.ToString(); } return; } // Cek sbg ekspresi Evaluator ev = ((xReport)RootReport).Evaluator; if (ev == null) { return; } ObjData = ev.Parse(ParseFormula(Report, strFormula)); if (ObjData != null) { try { Type tp = ObjData.GetType(); if (tp == typeof(decimal)) { decimal TmpDec = (decimal)ObjData; if (_FormatString.Length > 0) { Text = TmpDec.ToString(_FormatString); } else { Text = ObjData.ToString(); } } else if (tp == typeof(DateTime)) { DateTime dt = (DateTime)ObjData; if (_FormatString.Length > 0) { Text = dt.ToString(_FormatString); } else { Text = ObjData.ToString(); } } else { Text = ObjData.ToString(); } } catch { Text = ObjData.ToString(); } } } catch (Exception ex) { Text = "#Error:" + ex.Message; } finally { base.OnBeforePrint(e); } }