diff options
-rw-r--r-- | AllLangHelp_sbasic.mk | 1 | ||||
-rw-r--r-- | source/auxiliary/sbasic.tree | 1 | ||||
-rw-r--r-- | source/text/sbasic/shared/03170010.xhp | 19 | ||||
-rw-r--r-- | source/text/sbasic/shared/03170020.xhp | 58 | ||||
-rw-r--r-- | source/text/sbasic/shared/special_vba_func.xhp | 1 |
5 files changed, 73 insertions, 7 deletions
diff --git a/AllLangHelp_sbasic.mk b/AllLangHelp_sbasic.mk index c864e3d0b9..a41510f962 100644 --- a/AllLangHelp_sbasic.mk +++ b/AllLangHelp_sbasic.mk @@ -394,6 +394,7 @@ $(eval $(call gb_AllLangHelp_add_helpfiles,sbasic,\ helpcontent2/source/text/sbasic/shared/03160000 \ helpcontent2/source/text/sbasic/shared/03170000 \ helpcontent2/source/text/sbasic/shared/03170010 \ + helpcontent2/source/text/sbasic/shared/03170020 \ helpcontent2/source/text/sbasic/shared/05060700 \ helpcontent2/source/text/sbasic/shared/is_keyword \ helpcontent2/source/text/sbasic/shared/new_keyword \ diff --git a/source/auxiliary/sbasic.tree b/source/auxiliary/sbasic.tree index 6a97572f6a..e97c93b658 100644 --- a/source/auxiliary/sbasic.tree +++ b/source/auxiliary/sbasic.tree @@ -165,6 +165,7 @@ <topic id="sbasic/text/sbasic/shared/03120301.xhp">Format Function</topic> <topic id="sbasic/text/sbasic/shared/03150000.xhp">FormatDateTime Function [VBA]</topic> <topic id="sbasic/text/sbasic/shared/03170010.xhp">FormatNumber Function [VBA]</topic> + <topic id="sbasic/text/sbasic/shared/03170020.xhp">FormatPercent Function [VBA]</topic> <topic id="sbasic/text/sbasic/shared/03080503.xhp">Frac Function</topic> <topic id="sbasic/text/sbasic/shared/03020102.xhp">FreeFile Function</topic> <topic id="sbasic/text/sbasic/shared/03090405.xhp">FreeLibrary Function</topic> diff --git a/source/text/sbasic/shared/03170010.xhp b/source/text/sbasic/shared/03170010.xhp index c2e1a573c6..1f8767b040 100644 --- a/source/text/sbasic/shared/03170010.xhp +++ b/source/text/sbasic/shared/03170010.xhp @@ -21,18 +21,22 @@ <bookmark xml-lang="en-US" branch="index" id="bm_id661542193659245"> <bookmark_value>FormatNumber function</bookmark_value> </bookmark> - <paragraph id="hd_id871542193473857" role="heading" level="1" xml-lang="en-US"><link href="text/sbasic/shared/03170010.xhp">FormatNumber [VBA]</link></paragraph> + <h1 id="hd_id871542193473857" xml-lang="en-US"><link href="text/sbasic/shared/03170010.xhp">FormatNumber [VBA]</link></h1> <paragraph id="par_id351542193473858" role="paragraph" xml-lang="en-US">Returns a string with a number formatting applied to a numeric expression.</paragraph> </section> <embed href="text/sbasic/shared/00000003.xhp#vbasupport"/> <embed href="text/sbasic/shared/00000003.xhp#functsyntax"/> - <paragraph role="bascode" id="par_id291542194090512" xml-lang="en-US" localize="false">FormatNumber( expression, numDigitsAfterDecimal as Integer, includeLeadingDigit as Integer, <br/> useParensForNegativeNumbers as Integer, groupDigits as Integer )</paragraph> + <bascode> + <paragraph role="bascode" id="par_id291542194090512" localize="false">FormatNumber( expression As Variant, [numDigitsAfterDecimal As Integer], [includeLeadingDigit As Integer], _</paragraph> + <paragraph role="bascode" id="bas_id381676032350926" localize="false"> [useParensForNegativeNumbers As Integer], [groupDigits As Integer] ) As String</paragraph> + </bascode> + <section id="ReturnAndParms"> <embed href="text/sbasic/shared/00000003.xhp#functvalue"/> - <paragraph role="paragraph" id="par_id761542194361212" xml-lang="en-US">String</paragraph> + <paragraph role="paragraph" id="par_id761542194361212" localize="false">String</paragraph> <embed href="text/sbasic/shared/00000003.xhp#functparameters"/> - <paragraph id="par_id240720170117391741" role="paragraph" xml-lang="en-US"><emph>expression</emph>: Required. The numeric expression to be formatted.</paragraph> + <paragraph id="par_id240720170117391741" role="paragraph" xml-lang="en-US"><emph>expression</emph>: Required. A numeric expression to be formatted. If <literal>expression</literal> is a string, then the decimal and thousands separator need to be localized.</paragraph> <paragraph role="paragraph" id="par_id631542195798758" xml-lang="en-US"><emph>numDigitsAfterDecimal</emph>: Optional. A numeric value specifying the number of digits that should be displayed after the decimal. If omitted, it defaults to the value -1, meaning that the default settings for user interface locale should be used.</paragraph> @@ -46,7 +50,7 @@ <paragraph id="par_id21542198550868" role="listitem" xml-lang="en-US"><emph>vbFalse or 0</emph>: Do not display leading zeros.</paragraph> </listitem> <listitem> - <paragraph id="par_id241542199046808" role="listitem" xml-lang="en-US"><emph>vbUseDefaults or -2</emph>: Use the user interface locale settings. This is the default when omitted.</paragraph> + <paragraph id="par_id241542199046808" role="listitem" xml-lang="en-US"><emph>vbUseDefault or -2</emph>: Use the user interface locale settings. This is the default when omitted.</paragraph> </listitem> </list> <paragraph role="paragraph" id="par_id311542201637647" xml-lang="en-US"><emph>useParensForNegativeNumbers</emph>: Optional. A <link href="text/sbasic/shared/03040000.xhp#addvbaconstants">vbTriState</link> enumeration value specifying whether negative numbers should be encased in parenthesis.</paragraph> @@ -58,7 +62,7 @@ <paragraph id="par_id21542398550868" role="listitem" xml-lang="en-US"><emph>vbFalse or 0</emph>: Do not display parenthesis.</paragraph> </listitem> <listitem> - <paragraph id="par_id241542191246808" role="listitem" xml-lang="en-US"><emph>vbUseDefaults or -2</emph>: Same as vbFalse. This is the default when omitted.</paragraph> + <paragraph id="par_id241542191246808" role="listitem" xml-lang="en-US"><emph>vbUseDefault or -2</emph>: Same as vbFalse. This is the default when omitted.</paragraph> </listitem> </list> @@ -72,9 +76,10 @@ <paragraph id="par_id215423985506768" role="listitem" xml-lang="en-US"><emph>vbFalse or 0</emph>: Do not group digits.</paragraph> </listitem> <listitem> - <paragraph id="par_id241542191267808" role="listitem" xml-lang="en-US"><emph>vbUseDefaults or -2</emph>: Same as vbFalse. This is the default when omitted.</paragraph> + <paragraph id="par_id241542191267808" role="listitem" xml-lang="en-US"><emph>vbUseDefault or -2</emph>: Same as vbFalse. This is the default when omitted.</paragraph> </listitem> </list> + </section> <embed href="text/sbasic/shared/00000003.xhp#errorcode"/> <embed href="text/sbasic/shared/00000003.xhp#err13"/> <embed href="text/sbasic/shared/00000003.xhp#functexample"/> diff --git a/source/text/sbasic/shared/03170020.xhp b/source/text/sbasic/shared/03170020.xhp new file mode 100644 index 0000000000..ea5d3972e5 --- /dev/null +++ b/source/text/sbasic/shared/03170020.xhp @@ -0,0 +1,58 @@ +<?xml version="1.0" encoding="UTF-8"?> +<helpdocument version="1.0"> + <!-- + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + --> + <meta> + <topic id="textsbasicshared03170020xml" indexer="include" status="PUBLISH"> + <title id="tit" xml-lang="en-US">FormatPercent Function [VBA]</title> + <filename>/text/sbasic/shared/03170020.xhp</filename> + </topic> + </meta> + <body> + <section id="formatPercent"> + <bookmark id="bm_id541542193473856" xml-lang="en-US" branch="hid/zzzz" localize="false"/> + <bookmark xml-lang="en-US" branch="index" id="bm_id661542193659245"> + <bookmark_value>FormatPercent function</bookmark_value> + </bookmark> + <h1 id="hd_id871542193473857" xml-lang="en-US"><link href="text/sbasic/shared/03170020.xhp">FormatPercent [VBA]</link></h1> + <paragraph id="par_id351542193473858" role="paragraph" xml-lang="en-US">Returns a string with a number formatting applied to a numeric expression. A percent sign is appended to the returned string.</paragraph> + </section> + <embed href="text/sbasic/shared/00000003.xhp#vbasupport"/> + <embed href="text/sbasic/shared/00000003.xhp#functsyntax"/> + <bascode> + <paragraph role="bascode" id="par_id291542194090512" localize="false">FormatPercent( expression, [numDigitsAfterDecimal As Integer], [includeLeadingDigit As Integer], _</paragraph> + <paragraph role="bascode" id="bas_id651676032533813" localize="false"> [useParensForNegativeNumbers As Integer], [groupDigits As Integer] ) As String</paragraph> + </bascode> + <embed href="text/sbasic/shared/03170010.xhp#ReturnAndParms"/> + <embed href="text/sbasic/shared/00000003.xhp#errorcode"/> + <embed href="text/sbasic/shared/00000003.xhp#err13"/> + <embed href="text/sbasic/shared/00000003.xhp#functexample"/> + <bascode> + <paragraph role="bascode" id="par_id381542204697430" xml-lang="en-US" localize="false">Sub TestFormatNumber</paragraph> + <paragraph role="bascode" id="par_id551542204266762" localize="false"> Const UseComputerRegionalSettings = -1</paragraph> + + <paragraph role="bascode" id="par_id771542204286220" xml-lang="en-US"> MsgBox FormatPercent(12.2, NumDigitsAfterDecimal:=2) ' 1220.00% if selected user interface is english</paragraph> + + <paragraph role="bascode" id="par_id671542204307459" xml-lang="en-US"> MsgBox FormatPercent("-,2", 2, IncludeLeadingDigit:=vbTrue) ' -20,00% if french user interface</paragraph> + + <paragraph role="bascode" id="par_id61542204328859" xml-lang="en-US"> MsgBox FormatPercent("-0.2", 2) ' -20.00% for en-US, -0.00 for fr-CA, de-AT or pt-BR</paragraph> + + <paragraph role="bascode" id="par_id421542204347269" xml-lang="en-US"> MsgBox FormatPercent(-0.2, UseComputerRegionalSettings, UseParensForNegativeNumbers:=vbTrue) ' (20,00)% if pt-BR</paragraph> + + <paragraph role="bascode" id="par_id151542204366706" xml-lang="en-US"> MsgBox FormatPercent("-0,2", UseComputerRegionalSettings, vbUseDefault, vbTrue) ' (20,00)% if german</paragraph> + + <paragraph role="bascode" id="par_id971542204385212" xml-lang="en-US"> MsgBox FormatPercent("-12345678", -1, vbUseDefault, vbUseDefault, GroupDigits:=vbTrue) ' -1 234 567 800,00% for fr-BE</paragraph> + + <paragraph role="bascode" id="par_id11542204687786" localize="false">End Sub</paragraph> + </bascode> + <section id="relatedtopics"> + <embed href="text/sbasic/shared/00000003.xhp#VBAMath"/> + </section> +</body> +</helpdocument>
\ No newline at end of file diff --git a/source/text/sbasic/shared/special_vba_func.xhp b/source/text/sbasic/shared/special_vba_func.xhp index 92e88d44e1..a1e10543c1 100644 --- a/source/text/sbasic/shared/special_vba_func.xhp +++ b/source/text/sbasic/shared/special_vba_func.xhp @@ -107,6 +107,7 @@ <h2 id="par_id051820170356005221">Mathematical Functions</h2> <embed href="text/sbasic/shared/03170000.xhp#Round"/> <embed href="text/sbasic/shared/03170010.xhp#formatnumber"/> +<embed href="text/sbasic/shared/03170020.xhp#formatPercent"/> <embed href="text/sbasic/shared/partition.xhp#vbapartition"/> </section> |