FastReport.Net编写金额转换成大写方法
显示结果
using System;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using System.Windows.Forms;
using System.Drawing;
using System.Data;
using FastReport;
using FastReport.Data;
using FastReport.Dialog;
using FastReport.Barcode;
using FastReport.Table;
using FastReport.Utils;
using System.Text.RegularExpressions; //首先引入命名空间
namespace FastReport
{
public class ReportScript
{
private string DaXie(decimal money)
{
string s =money.ToString("#L#E#D#C#K#E#D#C#J#E#D#C#I#E#D#C#H#E#D#C#G#E#D#C#F#E#D#C#.0B0A");
string d =Regex.Replace(s,@"((?<=-|^)[^1-9]*)|((?'z'0)[0A-E]*((?=[1-9])|(?'-z'(?=[F-L\.]|$))))|((?'b'[F-L])(?'z'0)[0A-L]*((?=[1-9])|(?'-z'(?=[\.]|$))))","${b}${z}");
return Regex.Replace(d,".",delegate(Match m){return"负元空零壹贰叁肆伍陆柒捌玖空空空空空空空分角拾佰仟万億兆京垓秭穰"[m.Value[0]-'-'].ToString();});
}
}
}
fastreport报表中调用方法:
本合同约定 承包价款总计为[bdc_lq_ht.cbzjk]元人民币(大写:[DaXie([bdc_lq_ht.cbzjk])])
—the—end—