码迷,mamicode.com
首页 > 其他好文 > 详细

【StiReport】在设计器中增加自定义函数

时间:2015-04-01 17:21:12      阅读:147      评论:0      收藏:0      [点我收藏+]

标签:

  1、创建一个自定义函数

  namespace Winform
  {

    public class methos
    {
      public static string 小数转换成中文(decimal 小数)
      {
        return "321";
      }
    }
  }  

  2、将函数注册到StiReport中

  StiFunctions.AddFunction("自定义函数", "小数转换成中文", "小数转换成中文", "小数转换成中文",
    typeof(methos), typeof(string), "返回大写中文",
    new Type[] { typeof(decimal) }, new string[] { "小数" }, new string[] { "需要转换的小数" });

  上面使用到的是以下一个函数

  public static StiFunction AddFunction(string category, string groupFunctionName, string functionName, string description,

    Type typeOfFunction, Type returnType, string returnDescription,

    Type[] argumentTypes, string[] argumentNames, string[] argumentDescriptions);

  参数介绍:

    category:设计器中,函数所在文件夹名

    groupFunctionName:函数组名

    functionName:函数名,函数名必须和函数组名相同,用于有多个同名函数但参数个数不同的情况;而且函数名要和自定义函数的名字相同

    description:函数描述

    typeOfFunction:自定义函数所在的类的类型

    returnType:返回值的类型

    returnDescription:返回值描述

    argumentTypes:输入值类型的数组

    argumentNames:输入值的名称,必须和自定义函数的输入值名称相同

    argumentDescriptions:输入值的描述

【StiReport】在设计器中增加自定义函数

标签:

原文地址:http://www.cnblogs.com/LiveYourLife/p/4384145.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!