Express a number in words in English, Deutsch, Français,
Español, Italiano, & Turkish.
For programs that print cheques etc.
Italiano and Français money routines are untested
Español has no money support at the moment
Copyleft Andy Preston, Apollo Developments, 1999.
This is Free Software,
released under the LGPL (Copy Enclosed).
OSI Certified
Open Source Software.
Delphi 2 - 5; Quick Reports 2, and 3 (optional)
For Quick Reports Functionality:
See Demo.dpr, Demo1.dfm, & Demo1.pas (included in this archive) for more information.
This fuction allows you to find out if a given language uses a gender
TGender = (genMale, genFemale, genNeuter) is defined in NumW.pas
e.g. English has no gender; Deutsch has Masculine, Feminine, & Neuter; Français has Masculine & Feminine.
Example
Uses NumWords, NumW; Procedure CheckGenderList; Begin GenderList.Items.Clear; If InWords.HasGender (genMale) Then GenderList.Items.Add ('Male'); If InWords.HasGender (genFemale) Then GenderList.Items.Add ('Female'); If InWords.HasGender (genNeuter) Then GenderList.Items.Add ('Neuter'); End;
Your local language and currency information is automatically obtained from Windows when your program starts, you can use this procedure to override the defaults and use a foreign language, or currency
Example
Uses Windows, NumWords; Procedure TForm1.FormShow (Sender : TObject); Begin InWords.SelectLocale (CTRY_GERMANY, LANG_GERMAN); End;
TGender = (genMale, genFemale, genNeuter) is defined in NumW.pas
This function returns a String containing the value passed in TheNumber in words
If you want to select the gender of the string returned pass a value in Gender if you are not worried about gender, use genNeuter
If the language in use does not support gender this parameter is ignored
Example
Uses NumWords, NumW; Procedure Convert (ANum : Integer); Var AString : String; Begin AString := InWords.Number (ANum, genFemale); . . . AString := InWords.Number (StrToInt (NumBox.Text), genNeuter); . . . End;
Convert a sum of money into words: Dollars are passed in Major, Cents are passed in Minor.
The EuroMode parameter is for European countries who are currently operating both their national currencies and the new Pan-EEC 'Euro' / 'Cent' currency. If this flag is False (noEuro) then the value will be printed using the local currency. If this flag is True (useEuro) then the value will be printed using the 'Euro' and 'Cent'.
For non-European languages this parameter is ignored
Example
Uses NumWords; Procedure TRepForm.QRLabel1Print (Sender : TObject; Var Value : String); Begin Value:=InWords.IMoney (Trunc(DataModule1.Table2.FieldByName ('Pounds').AsFloat ), Trunc(DataModule1.Table2.FieldByName ('Pence').AsFloat) , useEuro ); End; Procedure TRepForm.QRLabel2Print (Sender : TObject; Var Value : String); Begin Value:=InWords.IMoney (Trunc(DataModule1.Table2.FieldByName ('Pounds').AsFloat ), Trunc(DataModule1.Table2.FieldByName ('Pence').AsFloat) , noEuro ); End;
The same as the previous function except that the value is passed as an Extended value, with Dollars in the integer part, and Cents in the remainder.
Example
Uses NumWords; Procedure TRepForm.QRLabel1Print (Sender : TObject; Var Value : String); Begin Value:=InWords.EMoney (DataModule1.Table2.FieldByName ('Pounds').AsFloat, useE uro); End; Procedure TRepForm.QRLabel2Print (Sender : TObject; Var Value : String); Begin Value:=InWords.EMoney (DataModule1.Table2.FieldByName ('Pounds').AsFloat, noEu ro); End;
See QRDemo.dpr, QRDemo1.dfm, QRDemo1.pas, QRDemo2.dfm, And QRDemo2.pas (included in this archive) for more information.
object QRDBMoneyWords : TQRDBMoneyWords DataSet = DataModule1.Table3 DataField = 'Amount' Gender = genNeuter EuroMode = True Alignment = taLeftJustify AutoSize = True AutoStretch = False WordWrap = True end
Gender is of type TGender (See Function Number (TheNumber : Integer; Gender : TGender) : String above). If the field you are trying to print is an integer, this property controls the gender that it will be printed in.
EuroMode a Boolean flag. If it is True and the selected language is in use in the EEC, the value will be printed in Euros and Cents. If it is False or the selected language is not in use in the EEC, the value will be printed in the normal currency.
See Function IMoney (Major, Minor : Integer; EuroMode : Boolean) : String above for more details.
The following parts of NumWords are currently 'missing'.
Most of these issues can be resolved with a quick e-mail conversation. If you need this functionality, you will also be able to give me the information I need to implement it.
If you've tested it with Delphi 3, 4, or 5; or C++ Builder, e-mail me (Andy Preston) and let me know. Then I can update this.
If you've got any fab-and-groovy modifications or just want to let me know you love NumWords, I'd also be glad to hear from you.
OSI Certified is a certification mark of the Open Source Initiative. Borland Delphi, and C++ Builder are trade marks of Inprise Corp. Quick Reports is a trade mark of QU-Soft ASD. Windows is a trade mark of Microsoft Corp.
This page has been checked by Weblint, Version 1.020