number to words crystal report
I would like to show bill amount of 99.50 in words in Cryst开发者_StackOverflowal Report.
How to do this? If bill amount is 99, it shows 'Ninety nine'. But it does not show decimal part as 'Fifty' :(
Add a new formula to your Report and set the syntax to Basic Syntax
This formula should do what you want.
Dim NumberAmount As Number
Dim LeftOfDecimal As String
Dim RightOfDecimal As String
NumberAmount = 99.50
LeftOfDecimal = ToWords(NumberAmount)
LeftOfDecimal = Left(LeftOfDecimal, InStrRev(LeftOfDecimal, " and")-1)
RightOfDecimal = ToWords(ToNumber(Mid(ToText(NumberAmount), InStr(ToText(NumberAmount), ".")+1,2)))
RightOfDecimal = Left(RightOfDecimal, InStrRev(RightOfDecimal, " and")-1)
formula = LeftOfDecimal + " and " + RightOfDecimal
I have used a variable called NumberAmount
but you can easily change this to use your own Field Value from your datasource.
精彩评论