首頁
編程語言
C語言|JAVA編程
Python編程
網頁編程
ASP編程|PHP編程
JSP編程
數據庫
MYSQL數據庫|SqlServer數據庫
Oracle數據庫|DB2數據庫
您现在的位置: 程式碼之家 >> 編程語言 >  >> C語言 >> 關於C語言

個人開發框架總結(五):報表配置 SetReportConfig 方法覆寫與動態標籤文字設定

     編輯:關於C語言

SetReportConfig 動態設定報表標籤

protected override void SetReportConfig(FaibClass.Common.Windows.Config.ReportConfig config)
{
    base.SetReportConfig(config);
    // 公司名稱
    var lbl = config.Header.FindObject("Company");
    if (lbl != null)
        ((FaibClass.Common.Windows.Report.ReportLabel)lbl).Text = ContextArgs.Instance.CompanyName;

    // 操作員
    lbl = config.Header.FindObject("Employee");
    if (lbl != null)
    {
        var text = ((FaibClass.Common.Windows.Report.ReportLabel)lbl).Text;
        ((FaibClass.Common.Windows.Report.ReportLabel)lbl).Text = string.Format(text, ContextArgs.Instance.UserName);
    }
}

透過 FindObject 依 Key 取得標籤物件,動態填入公司名、使用者名等執行期資訊。若報表需查詢,亦需建立對應 .pcs 配置檔。

  1. 上一篇文章:
  2. 下一篇文章:
Copyright © 程式碼之家 All Rights Reserved