半岛外围网上直营

logo FastReport中文文档

示例 3.打印月份名称


在上一个示例中,矩阵中打印了月份的数字。出现这种情况是因为 "Month "数据列包含月份的编号,而不是名称。要打印月份名称,请执行以下操作:

  • 选择打印月份编号的单元格。在本例中,该单元格的名称为 "Cell8";
  • 在 "BeforePrint "窗口中按下按钮并双击 "BeforePrint "事件;
  • FastReport 将在报表脚本中添加一个空的事件处理程序。请编写以下代码:
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];
}

运行报告后,结果如下:

fastreport
扫码咨询


添加微信 立即咨询

电话咨询

客服热线
023-68661681

TOP
利记足球官网(官方)网站/网页版登录入口/手机版登录入口-最新版(已更新) 真人boyu·博鱼滚球网(官方)网站/网页版登录入口/手机版登录入口-最新版(已更新) 最大网上PM娱乐城盘口(官方)网站/网页版登录入口/手机版登录入口-最新版(已更新) 正规雷火竞技官方买球(官方)网站/网页版登录入口/手机版登录入口-最新版(已更新) 雷火竞技权威十大网(官方)网站/网页版登录入口/手机版登录入口-最新版(已更新) boyu·博鱼信誉足球官网(官方)网站/网页版登录入口/手机版登录入口-最新版(已更新) 权威188BET足球网(官方)网站/网页版登录入口/手机版登录入口-最新版(已更新) 正规188BET足球大全(官方)网站/网页版登录入口/手机版登录入口-最新版(已更新)