当前位置: 代码迷 >> 报表 >> 急请问水晶报表怎么将数字转换为英文
  详细解决方案

急请问水晶报表怎么将数字转换为英文

热度:170   发布时间:2016-05-05 07:42:12.0
急!急!!急!!!请教水晶报表如何将数字转换为英文。
如题↑
例:5000.00   转换为:    five thousand;
    1230.18$   转换为:    one thousand two hundred thirty  point one eight dollars
补充:在有小数的情况下,小数同样要转换!
或者说:将阿拉伯数字的金额,转换为英语中的金额,
------解决方案--------------------
可以参考下面vbs代码

public   Function   NumToText(dblVal   As   Double, CurrencyCode As String)   As   String 
        Static   Ones(0   To   9)   As   String 
        Static   Teens(0   To   9)   As   String 
        Static   Tens(0   To   9)   As   String 
        Static   Thousands(0   To   4)   As   String 
        Static   bInit   As   Boolean 
        Dim   i   As   Integer,   bAllZeros   As   Boolean,   bShowThousands   As   Boolean
        Dim   strVal   As   String,   strBuff   As   String,   strTemp   As   String 
        Dim   nCol   As   Integer,   nChar   As   Integer 
        Dim CurrencyUnit As String, CurrencyCents As String
        'Only   handles   positive   values 
        if dblVal   <   0 then
exit function
        end if

        If   bInit   =   False   Then 
                'Initialize   array 
                bInit   =   True 
                Ones(0)   =   "zero " 
                Ones(1)   =   "one " 
                Ones(2)   =   "two " 
                Ones(3)   =   "three " 
                Ones(4)   =   "four " 
                Ones(5)   =   "five " 
  相关解决方案