首先创建一个数字域,为两位小数。域名Total, 另外一个域为TotalSum 用来显示转换后的结果。
1 在TotalSum 中的entering 域中加入如下代码:
******************************************************
Sub Entering(Source As Field)
Dim workspace As New notesuiworkspace
Dim uidoc As notesuidocument
Set uidoc = workspace.currentdocument
Dim lef,rig As String
Dim Cur As String
Cur=/" 万仟佰拾亿仟佰拾万仟佰拾元/"
Dim MyStr As String
Insert=uidoc.fieldgettext(/"totle/")
n=Len(insert)
lef=Left(insert,n-3)
rig=Right(insert,2)
ln=Len(lef)
rn=Len(rig)
For i=1 To ln
MyStr=MyStr+C(Mid(lef,i,1))+Mid(cur,13-ln+i,1)
Next i
MyStr=MyStr+C(Left(rig,1))+/" 角/"+C(Right(rig,1))+/" 分/"
Call uidoc.fieldsettext(/"totalsum/",mystr)
End Sub
************************************************************
在表单中加入自定义函数C():
Function C(S As String) As String
If S=/"1/" Then
C=/" 壹/"
End If
If S=/"2/" Then
C=/" 贰/"
End If
If S=/"3/" Then
C=/" 叁/"
End If
If S=/"4/" Then
C=/" 肆/"
End If
If S=/"5/" Then
C=/" 伍/"
End If
If S=/"6/" Then
C=/" 陆/"
End If
If S=/"7/" Then
C=/" 柒/"
End If
If S=/"8/" Then
C=/" 捌/"
End If
If S=/"9/" Then
C=/" 玖/"
End If
If S=/"0/" Then
C=/" 零/"
End If
End Function
Lotus中货币数字转换成人民币大写
最新推荐文章于 2022-02-25 21:57:21 发布