to lich:
再有就是,我从你给的库文件中把转换的函数取出来,单个用,也不行,怎么办哪。取出来单个用,如下:
const
_ChineseNumeric: array[0..22] of string = (
'零', '壹', '贰', '叁', '肆', '伍', '陆', '柒', '捌', '玖', '拾', '佰', '仟',
'万', '亿', '兆', '圆', '角', '分', '厘', '点', '负', '整');
function frCurrToBIGNum(Value: Currency): string;
var
sArabic, sIntArabic: string;
sSectionArabic, sSection: string;
i, iDigit, iSection, iPosOfDecimalPoint: integer;
bInZero, bMinus: boolean;
function ConvertStr(const str: string): string;
//将字串反向, 例如: 传入 '1234', 传回 '4321'
var
i: integer;
begin
Result := '';
for i := Length(str)do
wnto 1do
Result := Result + str;
end;
begin
Result := '';
bInZero := True;
sArabic := FloatToStr(Value);
//将数字转成阿拉伯数字字串
if sArabic[1] = '-' then
begin
bMinus := True;
sArabic := Copy(sArabic, 2, 9999);
end
else
bMinus := False;
iPosOfDecimalPoint := Pos('.', sArabic);
//取得小数点的位置
//先处理整数的部分
if iPosOfDecimalPoint = 0 then
sIntArabic := ConvertStr(sArabic)
else
sIntArabic := ConvertStr(Copy(sArabic, 1, iPosOfDecimalPoint - 1));
//从个位数起以每四位数为一小节
for iSection := 0 to ((Length(sIntArabic) - 1) div 4)do
begin
sSectionArabic := Copy(sIntArabic, iSection * 4 + 1, 4);
sSection := '';
for i := 1 to Length(sSectionArabic)do
//以下的 i 控制: 个十百千位四个位数
begin
iDigit := Ord(sSectionArabic) - 48;
if iDigit = 0 then
begin
if (not bInZero) and (i <> 1) then
sSection := _ChineseNumeric[0] + sSection;
bInZero := True;
end
else
begin
case i of
2: sSection := _ChineseNumeric[10] + sSection;
3: sSection := _ChineseNumeric[11] + sSection;
4: sSection := _ChineseNumeric[12] + sSection;
end;
sSection := _ChineseNumeric[iDigit] + sSection;
bInZero := False;
end;
end;
//加上该小节的位数
if Length(sSection) = 0 then
begin
if (Length(Result) > 0) and (Copy(Result, 1, 2) <> _ChineseNumeric[0]) then
Result := _ChineseNumeric[0] + Result;
end
else
begin
case iSection of
0: Result := sSection;
1: Result := sSection + _ChineseNumeric[13] + Result;
2: Result := sSection + _ChineseNumeric[14] + Result;
3: Result := sSection + _ChineseNumeric[15] + Result;
end;
end;
end;
if Length(Result) > 0 then
Result := Result + _ChineseNumeric[16];
if iPosOfDecimalPoint > 0 then
//处理小数部分
begin
for i := iPosOfDecimalPoint + 1 to Length(sArabic)do
begin
iDigit := Ord(sArabic) - 48;
Result := Result + _ChineseNumeric[iDigit];
case i - (iPosOfDecimalPoint + 1) of
0: Result := Result + _ChineseNumeric[17];
1: Result := Result + _ChineseNumeric[18];
2: Result := Result + _ChineseNumeric[19];
end;
end;
end;
//其他例外状况的处理
if Length(Result) = 0 then
Result := _ChineseNumeric[0];
if Copy(Result, 1, 4) = _ChineseNumeric[1] + _ChineseNumeric[10] then
Result := Copy(Result, 3, 254);
if Copy(Result, 1, 2) = _ChineseNumeric[20] then
Result := _ChineseNumeric[0] + Result;
if bMinus then
Result := _ChineseNumeric[21] + Result;
if ((Round(Value * 100)) div 1) mod 10 = 0 then
Result := Result + _ChineseNumeric[22];
end;
procedure TGzb.frReport1UserFunction(const Name: String;
p1, p2,
p3: Variant;
var Val: Variant);
begin
// try
if AnsiCompareText('NumtoRmb', Name) = 0 then
val := frCurrToBIGNum(p1);
// except
// end;
end;
我觉着这原因是由fastreport造成的,有什么办法吗?