业务报表依据报表指定控件值获取大写金额合计
Mr_Duan 发表于 2023-7-26 10:22
您好,AR11有脚本功能,我也是和你这设置一样,但是就是不好事。
您好,您先检查一下对应的合计值是否正确,然后在使用脚本函数转换大写,也可以使用一个新的文本框,调用脚本的函数,然后对应的参数输入一个数值,测试看看能否正常显示,如果参数设置为数值也不可以显示,那猜测有可能是旧版本遗留的问题,建议您升级版本,我这边使用16版本测试是正常的,针对旧版本,已不在维护,所有功能均会在新版本进行实现,感谢理解。
Function ConvertToRMB(ByVal inputString As String) As String
Dim numList As String = "零壹贰叁肆伍陆柒捌玖"
Dim rmbList As String = "分角元拾佰仟万拾佰仟亿拾佰仟万"
Dim number As Double = 0
Dim tempOutString As String = ""
number = Double.Parse(inputString)
Dim tempNumberString As String = Convert.ToInt64(number * 100).ToString()
Dim tempNmberLength As Integer = tempNumberString.Length
Dim i As Integer = 0
While i < tempNmberLength
Dim oneNumber As Integer = Int32.Parse(tempNumberString.Substring(i, 1))
Dim oneNumberChar As String = numList.Substring(oneNumber, 1)
Dim oneNumberUnit As String = rmbList.Substring(tempNmberLength - i - 1, 1)
If Not (oneNumberChar = "零") Then
tempOutString += oneNumberChar + oneNumberUnit
Else
If OrElse OrElse OrElse Then
While tempOutString.EndsWith("零")
tempOutString = tempOutString.Substring(0, tempOutString.Length - 1)
End While
End If
If OrElse (oneNumberUnit = "万" AndAlso Not tempOutString.EndsWith("亿")) OrElse Then
tempOutString += oneNumberUnit
Else
If Not tempOutString Is Nothing Then
Dim tempEnd As Boolean = tempOutString.EndsWith("亿")
Dim zeroEnd As Boolean = tempOutString.EndsWith("零")
If tempOutString.Length > 1 Then
Dim zeroStart As Boolean = tempOutString.Substring(tempOutString.Length - 2, 2).StartsWith("零")
If Not zeroEnd AndAlso (zeroStart OrElse Not tempEnd) Then
tempOutString += oneNumberChar
End If
Else
If Not zeroEnd AndAlso Not tempEnd Then
tempOutString += oneNumberChar
End If
End If
End If
End If
End If
i += 1
End While
If Not tempOutString Is Nothing Then
While tempOutString.EndsWith("零")
tempOutString = tempOutString.Substring(0, tempOutString.Length - 1)
End While
While tempOutString.EndsWith("元")
tempOutString = tempOutString + "整"
End While
Return tempOutString
Else
Return ""
End If
End Function
您好,大小写转换参考这个链接:https://www.grapecity.com.cn/blogs/converttormb
将链接中的代码粘贴在桌面设计器的脚本,然后再文本框中使用=Code.ConvertToRMB()来调用方法。
11版本较旧,不确定11版本是否有脚本功能,您检查看看,如果没有的话建议您升级至14版本,我这边有14的环境,能看到14版本有脚本功能。
Bella.Yuan 发表于 2023-7-26 10:04
您好,大小写转换参考这个链接:https://www.grapecity.com.cn/blogs/converttormb
将链接中的代码粘贴在 ...
您好,AR11有脚本功能,我也是和你这设置一样,但是就是不好事。
页:
[1]