Number FormattingUse a large selection of different number formatting properties to add data to your documents.  View on YouTube
int LiteralsTo show an integer, simply include the literal number as one of the elements inside a span. IntegerLiteral = Span { 42;};42
Functions and Variables with int ValuesFunctions that return integers or variables containing integers, like the function X shown here, will be formatted the same way. X(i) = i * i + 3;IntegerVariable = Span { "The output of X(5) is "; X(5);};The output of X(5) is 28
Hexadecimal FormatTo format an integer in hexadecimal, change the TextRadix to 16. IntegerHexadecimal = Span { TextRadix: 16; 129579;};1fa2b
Uppercase Hex FormatTo have the hex digits shown in upper-case, change the TextCase property to AllUpper. IntegerHexadecimalUpper = Span { TextRadix: 16; TextCase: AllUpper; 671277;};A3E2D
Binary FormatTo format a number in binary, use 2 as the TextRadix. IntegerBinary = Span { TextRadix: 2; 127;};1111111
Number Zero-PaddingUse the TextNumPadding property to set the minimum width of a number. This is handy for text sorting and creating tables with aligned numbers. IntegerHexadecimal4 = Block { TextRadix: 16; TextNumPadding: 4; 4; 27; 12245;};0004001b2fd5
Group SeparatorsTo format an integer with a group separator, set the TextGroup property to true. IntegerGroup = Span { TextGroup: true; 1234567.89;};1.234.567,89
Culture SettingsUse the TextCulture property to ensure the formatting is correct for the intended readership. IntegerGroupCulture = Span { TextCulture: CultureInfo.FindCulture("de-DE"); TextGroup: true; 8912345.67;};8.912.345,67
double LiteralsAs with integers, to a format a number of type double, include it as an element in the revision. DoubleFormatting = Span { 4325.1245;};4325,1245
Function Return ValuesFormatting a return value from a function works the same way. DoubleReturn = Span { Math.Sqrt(1 + 1);};1,4142135623730951
Decimal DigitsUse the TextDigits property to fix the number of fractional digits in the number. DoubleDigits = Span { TextDigits: 3; Math.PI;};3,142
Percentage FormatSet the TextPercent property to true to show numbers as percentages. Percentage = Block { TextPercent: true; 0.04; 1.5;};4%150%
Significant FiguresSet TextSignificant to true, to make TextDigits refer to 'significant' figures, rather than decimal digits. SignificantDigits = Block { TextSignificant: true; TextDigits: 3; // 3 significant figures 4325.1245; 5.4193; 0.0006427; 1.215e10; 1.2e-10;};43305,420,000643122000000000,000000000120
Scientific NotationFormat the number in scientific notation by setting TextScientific to true. ScientificNotation = Span { TextScientific: true; TextDigits: 2; 175_000;};1,75x105
Significant Figures in Scientific NotationNotice that the TextSignificant property controls the total number of significant figures with scientific notation. ScientificNotationSig = Span { TextScientific: true; TextSignificant: true; TextDigits: 2; 8_175_400;};8,2x106
Decimal Tab StopsYou can use a custom tab stop in a paragraph to align numbers on decimal point. readonly AlignedPar = Paragraph(null, [new(5%, Decimal)]);AlignedPars = Block { AlignedPar {Tab; 1.2 }; AlignedPar {Tab; 123.99}; AlignedPar {Tab; 0.5544};};1,2123,990,5544
Fractional ExpressionsUse the TextDenominator property to convert a number to a fraction, with a maximum denominator, in lowest terms. Denominator = Block { TextDenominator: 16; 0.125; 0.5; 12.75; 1.04125;};181212341116