• <menu id="w2i4a"></menu>
  • logo FastReport中文文檔

    文檔首頁(yè)>>FastReport中文文檔>>示例 3.打印月份名稱

    示例 3.打印月份名稱


    在上一個(gè)示例中,矩陣中打印了月份的數(shù)字。出現(xiàn)這種情況是因?yàn)?"Month "數(shù)據(jù)列包含月份的編號(hào),而不是名稱。要打印月份名稱,請(qǐng)執(zhí)行以下操作:

    • 選擇打印月份編號(hào)的單元格。在本例中,該單元格的名稱為 "Cell8";
    • 在 "BeforePrint "窗口中按下按鈕并雙擊 "BeforePrint "事件;
    • FastReport 將在報(bào)表腳本中添加一個(gè)空的事件處理程序。請(qǐng)編寫(xiě)以下代碼:
    private void Cell8_BeforePrint(object sender, EventArgs e)
    {
      string[] month Names = newstring[] {
        "January", "February", "March", "April", 
        "May", "June", "July", "August", 
        "September", "October", "November", "December" };
      // Cell8 is a cell that prints the month number.
      // Cell8.Value is a value printed in the cell (i.e. the month number).
      // This value is of System.Object type, so we need to cast it to int
      Cell8.Text = monthNames[(int)Cell8.Value - 1];
    }

    運(yùn)行報(bào)告后,結(jié)果如下:

    fastreport
    掃碼咨詢


    添加微信 立即咨詢

    電話咨詢

    客服熱線
    023-68661681

    TOP
    三级成人熟女影院,欧美午夜成人精品视频,亚洲国产成人乱色在线观看,色中色成人论坛 (function(){ var bp = document.createElement('script'); var curProtocol = window.location.protocol.split(':')[0]; if (curProtocol === 'https') { bp.src = 'https://zz.bdstatic.com/linksubmit/push.js'; } else { bp.src = 'http://push.zhanzhang.baidu.com/push.js'; } var s = document.getElementsByTagName("script")[0]; s.parentNode.insertBefore(bp, s); })();