f0f1f2.studio Template reference
English
Open application
Method

FormatMoneyInWords

Definition

Namespace
Resto.Front.PrintTemplates.Cheques.Razor

Spells out an amount using the engine's currency language resources.

string TemplateBaseCore<T>.FormatMoneyInWords(decimal money)
Returns
string
Nullability
Not specified
Declared in
Resto.Front.PrintTemplates.Cheques.Razor.TemplateBaseCore<T>
Model purpose
Base class for RazorEngineCore print templates. Model contains the document data of type T. Provides formatting and markup output methods.

Parameters

decimal money
Amount in the selected currency; this method does not convert currencies.

Return value

A capitalized amount in words with inflected currency units; minor units are appended as digits when their names exist.

Remarks

Uses the current currency and CurrentUICulture resources, not arbitrary ISO-specific language rules. Negative amounts receive the localized minus word. The legacy converter assumes hundredths: it calculates (fraction + 0.005) * 100 and does not carry 100 minor units into the integer part. It does not honor MinimumDenomination. Avoid using it as a general currency rounding function.

Exceptions

System.InvalidOperationException
The engine currency provider has not been initialized.
System.ArgumentOutOfRangeException
The current currency has no registered word-conversion rules.
System.OverflowException
The absolute integer part cannot be represented by Int64.

Example

// Print an amount in words using the current currency and UI language.
FormatMoneyInWords(125.50m);