diff options
author | Olivier Hallot <olivier.hallot@libreoffice.org> | 2018-11-14 12:56:15 -0200 |
---|---|---|
committer | Mike Kaganski <mike.kaganski@collabora.com> | 2018-11-15 20:07:08 +0100 |
commit | f33281a5c92c9daa241979cd461c21f3e5cec309 (patch) | |
tree | b6cbbd232836ccf26047862b9eb0f6915674768a | |
parent | 7e2a609f6d78d91c43ddaf76247c95668f402d06 (diff) |
tdf#118473 Help page for VBA FormatNumber
+ some fixes in table formatting
* Added Mike's advise.
* fix dumb copypasta
Change-Id: I997c3200e521e7fac9f20f17a9bb9e2574bccfdd
Reviewed-on: https://gerrit.libreoffice.org/63373
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
-rw-r--r-- | AllLangHelp_sbasic.mk | 1 | ||||
-rw-r--r-- | source/auxiliary/sbasic.tree | 1 | ||||
-rw-r--r-- | source/text/sbasic/shared/03040000.xhp | 279 | ||||
-rw-r--r-- | source/text/sbasic/shared/03170010.xhp | 118 | ||||
-rw-r--r-- | source/text/sbasic/shared/special_vba_func.xhp | 5 |
5 files changed, 282 insertions, 122 deletions
diff --git a/AllLangHelp_sbasic.mk b/AllLangHelp_sbasic.mk index 4e283aa771..a236018f46 100644 --- a/AllLangHelp_sbasic.mk +++ b/AllLangHelp_sbasic.mk @@ -351,6 +351,7 @@ $(eval $(call gb_AllLangHelp_add_helpfiles,sbasic,\ helpcontent2/source/text/sbasic/shared/03150002 \ helpcontent2/source/text/sbasic/shared/03160000 \ helpcontent2/source/text/sbasic/shared/03170000 \ + helpcontent2/source/text/sbasic/shared/03170010 \ helpcontent2/source/text/sbasic/shared/05060700 \ helpcontent2/source/text/sbasic/shared/code-stubs \ helpcontent2/source/text/sbasic/shared/keys \ diff --git a/source/auxiliary/sbasic.tree b/source/auxiliary/sbasic.tree index 2838f96980..d2eb5ea538 100644 --- a/source/auxiliary/sbasic.tree +++ b/source/auxiliary/sbasic.tree @@ -142,6 +142,7 @@ <topic id="sbasic/text/sbasic/shared/03090202.xhp">For...Next Statement</topic> <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/03020102.xhp">FreeFile Function</topic> <topic id="sbasic/text/sbasic/shared/03090405.xhp">FreeLibrary Function</topic> <topic id="sbasic/text/sbasic/shared/03090406.xhp">Function Statement</topic> diff --git a/source/text/sbasic/shared/03040000.xhp b/source/text/sbasic/shared/03040000.xhp index b223fa71fd..7630de5631 100644 --- a/source/text/sbasic/shared/03040000.xhp +++ b/source/text/sbasic/shared/03040000.xhp @@ -62,24 +62,24 @@ </tablerow> <tablerow> <tablecell> - <paragraph id="par_id051620171114567378" role="tablecontent" localize="false" xml-lang="en-US">True</paragraph> + <paragraph id="par_id051620171114567378" role="paragraph" localize="false" xml-lang="en-US">True</paragraph> </tablecell> <tablecell> - <paragraph id="par_id051620171114563299" role="tablecontent" localize="false" xml-lang="en-US">Boolean</paragraph> + <paragraph id="par_id051620171114563299" role="paragraph" localize="false" xml-lang="en-US">Boolean</paragraph> </tablecell> <tablecell> - <paragraph id="par_id051620171114565603" role="tablecontent" localize="false" xml-lang="en-US">1</paragraph> + <paragraph id="par_id051620171114565603" role="paragraph" localize="false" xml-lang="en-US">1</paragraph> </tablecell> </tablerow> <tablerow> <tablecell> - <paragraph id="par_id051620171114564178" role="tablecontent" localize="false" xml-lang="en-US">False</paragraph> + <paragraph id="par_id051620171114564178" role="paragraph" localize="false" xml-lang="en-US">False</paragraph> </tablecell> <tablecell> - <paragraph id="par_id051620171114566455" role="tablecontent" localize="false" xml-lang="en-US">Boolean</paragraph> + <paragraph id="par_id051620171114566455" role="paragraph" localize="false" xml-lang="en-US">Boolean</paragraph> </tablecell> <tablecell> - <paragraph id="par_id051620171114563986" role="tablecontent" localize="false" xml-lang="en-US">0</paragraph> + <paragraph id="par_id051620171114563986" role="paragraph" localize="false" xml-lang="en-US">0</paragraph> </tablecell> </tablerow> </table> @@ -106,13 +106,13 @@ </tablerow> <tablerow> <tablecell> - <paragraph id="par_id051620171114574028" role="tablecontent" localize="false" xml-lang="en-US">Pi</paragraph> + <paragraph id="par_id051620171114574028" role="paragraph" localize="false" xml-lang="en-US">Pi</paragraph> </tablecell> <tablecell> - <paragraph id="par_id051620171114571506" role="tablecontent" localize="false" xml-lang="en-US">Double</paragraph> + <paragraph id="par_id051620171114571506" role="paragraph" localize="false" xml-lang="en-US">Double</paragraph> </tablecell> <tablecell> - <paragraph id="par_id051620171114576361" role="tablecontent" localize="false" xml-lang="en-US">3.14159265358979</paragraph> + <paragraph id="par_id051620171114576361" role="paragraph" localize="false" xml-lang="en-US">3.14159265358979</paragraph> </tablecell> </tablerow> </table> @@ -140,32 +140,32 @@ </tablerow> <tablerow> <tablecell> - <paragraph id="par_id051620171114575052" role="tablecontent" localize="false" xml-lang="en-US">Empty</paragraph> + <paragraph id="par_id051620171114575052" role="paragraph" localize="false" xml-lang="en-US">Empty</paragraph> </tablecell> <tablecell> - <paragraph id="par_id051620171114576734" role="tablecontent" localize="false" xml-lang="en-US">Variant</paragraph> + <paragraph id="par_id051620171114576734" role="paragraph" localize="false" xml-lang="en-US">Variant</paragraph> </tablecell> <tablecell> - <paragraph id="par_id05172017082409622" role="tablecontent" xml-lang="en-US">The <emph>Empty</emph> value indicates that the variable is not initialized.</paragraph> + <paragraph id="par_id05172017082409622" role="paragraph" xml-lang="en-US">The <emph>Empty</emph> value indicates that the variable is not initialized.</paragraph> </tablecell> </tablerow> <tablerow> <tablecell> - <paragraph id="par_id051620171114577892" role="tablecontent" localize="false" xml-lang="en-US">Null</paragraph> + <paragraph id="par_id051620171114577892" role="paragraph" localize="false" xml-lang="en-US">Null</paragraph> </tablecell> <tablecell> - <paragraph id="par_id051620171114571232" role="tablecontent" localize="false" xml-lang="en-US">null</paragraph> + <paragraph id="par_id051620171114571232" role="paragraph" localize="false" xml-lang="en-US">null</paragraph> </tablecell> <tablecell> - <paragraph id="par_id051720170824093395" role="tablecontent" xml-lang="en-US">Indicates that the variable does not contain data.</paragraph> + <paragraph id="par_id051720170824093395" role="paragraph" xml-lang="en-US">Indicates that the variable does not contain data.</paragraph> </tablecell> </tablerow> <tablerow> <tablecell> - <paragraph id="par_id051720170824091253" role="tablecontent" localize="false" xml-lang="en-US">Nothing</paragraph> + <paragraph id="par_id051720170824091253" role="paragraph" localize="false" xml-lang="en-US">Nothing</paragraph> </tablecell> <tablecell> - <paragraph id="par_id051720170824091966" role="tablecontent" localize="false" xml-lang="en-US">Object</paragraph> + <paragraph id="par_id051720170824091966" role="paragraph" localize="false" xml-lang="en-US">Object</paragraph> </tablecell> <tablecell> <paragraph id="par_id051720170824097935" role="paragraph" xml-lang="en-US">Assign the <emph>Nothing</emph> object to a variable to remove a previous assignment.</paragraph> @@ -192,111 +192,146 @@ <paragraph id="par_id051720170824106132" role="bascode" localize="false" xml-lang="en-US"> Print oDoc ‘ Error</paragraph> <paragraph id="par_id051720170824103527" role="bascode" localize="false" xml-lang="en-US">End Sub</paragraph> </bascode> - <paragraph role="heading" id="hd_id661512312593832" level="2" xml-lang="en-US">Additional VBA constants</paragraph> - <paragraph role="paragraph" id="par_id111512312705893" xml-lang="en-US">The following constants are available when VBA compatibility mode is enabled</paragraph> + <section id="addvbaconstants"> + <paragraph role="heading" id="hd_id661512312593832" level="2" xml-lang="en-US">Additional VBA constants</paragraph> + <paragraph role="paragraph" id="par_id111512312705893" xml-lang="en-US">The following constants are available when VBA compatibility mode is enabled</paragraph> - <embed href="text/sbasic/shared/00000003.xhp#vbasupport"/> - <table id="tab_id671512313939217"> - <tablerow> - <tablecell> - <paragraph role="tablehead" id="par_id901512312880723" xml-lang="en-US">Named constant</paragraph> - </tablecell> - <tablecell> - <paragraph id="par_id891512312916493" role="tablehead" xml-lang="en-US">Hexadecimal (decimal) value</paragraph> - </tablecell> - <tablecell> - <paragraph id="par_id991512312965968" role="tablehead" xml-lang="en-US" >Description</paragraph> - </tablecell> - </tablerow> - <tablerow> - <tablecell> - <paragraph id="par_id891512313266496" role="tablecontents" xml-lang="en-US" localize="false">vbCr</paragraph> - </tablecell> - <tablecell> - <paragraph role="tablecontent" id="par_id241512313723033" xml-lang="en-US" localize="false">\x0D (13)</paragraph> - </tablecell> - <tablecell> - <paragraph role="tablecontent" id="par_id611512313731233" xml-lang="en-US">CR - Carriage return</paragraph> - </tablecell> - </tablerow> - <tablerow> - <tablecell> - <paragraph id="par_id471512313282257" role="tablecontents" xml-lang="en-US" localize="false">vbCrLf</paragraph> - </tablecell> - <tablecell> - <paragraph id="par_id691512313750520" role="tablecontents" xml-lang="en-US" localize="false">\x0D\x0A (13 10)</paragraph> - </tablecell> - <tablecell> - <paragraph id="par_id961512313881937" role="tablecontents" xml-lang="en-US" >CRLF - Carriage return and line feed</paragraph> - </tablecell> - </tablerow> - <tablerow> - <tablecell> - <paragraph id="par_id11512313289164" role="tablecontents" xml-lang="en-US" localize="false">vbFormFeed</paragraph> - </tablecell> - <tablecell> - <paragraph id="par_id341512313761295" role="tablecontents" xml-lang="en-US" localize="false">\x0c (12)</paragraph> - </tablecell> - <tablecell> - <paragraph id="par_id221512313889077" role="tablecontents" xml-lang="en-US" >FF - Form feed</paragraph> - </tablecell> - </tablerow> - <tablerow> - <tablecell> - <paragraph id="par_id501512313293989" role="tablecontents" xml-lang="en-US" localize="false">vbLf</paragraph> - </tablecell> - <tablecell> - <paragraph id="par_id311512313777558" role="tablecontents" xml-lang="en-US" localize="false">\x0A (10)</paragraph> - </tablecell> - <tablecell> - <paragraph id="par_id621512313896169" role="tablecontents" xml-lang="en-US" >LF - Line feed</paragraph> - </tablecell> - </tablerow> - <tablerow> - <tablecell> - <paragraph id="par_id191512313300610" role="tablecontents" xml-lang="en-US" localize="false">vbNewLine</paragraph> - </tablecell> - <tablecell> - <paragraph id="par_id521512319135830" role="listitem" xml-lang="en-US">\x0D\x0A (13 10) for 32-bit Windows</paragraph> - <paragraph id="par_id61512319163913" role="listitem" xml-lang="en-US">\x0A (10) for other 64-bit systems</paragraph> - </tablecell> - <tablecell> - <paragraph id="par_id151512313904989" role="tablecontents" xml-lang="en-US" >LF or CRLF </paragraph> - </tablecell> - </tablerow> - <tablerow> - <tablecell> - <paragraph id="par_id211512313306932" role="tablecontents" xml-lang="en-US" localize="false">vbNullString</paragraph> - </tablecell> - <tablecell> - <paragraph id="par_id141512313800110" role="tablecontents" xml-lang="en-US" localize="false">""</paragraph> - </tablecell> - <tablecell> - <paragraph id="par_id741512313911049" role="tablecontents" xml-lang="en-US" >Null string</paragraph> - </tablecell> - </tablerow> - <tablerow> - <tablecell> - <paragraph id="par_id931512313312621" role="tablecontents" xml-lang="en-US" localize="false">vbTab</paragraph> - </tablecell> - <tablecell> - <paragraph id="par_id241512313810064" role="tablecontents" xml-lang="en-US" localize="false">\x09 (9)</paragraph> - </tablecell> - <tablecell> - <paragraph id="par_id951512313918356" role="tablecontents" xml-lang="en-US" >HT - Horizontal tab</paragraph> - </tablecell> - </tablerow> - <tablerow> - <tablecell> - <paragraph id="par_id481512313318983" role="tablecontents" xml-lang="en-US" localize="false">vbVerticalTab </paragraph> - </tablecell> - <tablecell> - <paragraph id="par_id991512313821414" role="tablecontents" xml-lang="en-US" localize="false">\x0B (11)</paragraph> - </tablecell> - <tablecell> - <paragraph id="par_id351512313924593" role="tablecontents" xml-lang="en-US" >VT - Vertical tab</paragraph> - </tablecell> - </tablerow> - </table> + <embed href="text/sbasic/shared/00000003.xhp#vbasupport"/> + <table id="tab_id671512313939217"> + <tablerow> + <tablecell> + <paragraph role="tablehead" id="par_id901512312880723" xml-lang="en-US">Named constant</paragraph> + </tablecell> + <tablecell> + <paragraph id="par_id891512312916493" role="tablehead" xml-lang="en-US">Hexadecimal (decimal) value</paragraph> + </tablecell> + <tablecell> + <paragraph id="par_id991512312965968" role="tablehead" xml-lang="en-US" >Description</paragraph> + </tablecell> + </tablerow> + <tablerow> + <tablecell> + <paragraph id="par_id311542196872466" role="paragraph" xml-lang="en-US" localize="false">vbTrue</paragraph> + </tablecell> + <tablecell> + <paragraph id="par_id151542196872467" role="paragraph" xml-lang="en-US" localize="false">-1</paragraph> + </tablecell> + <tablecell> + <paragraph role="paragraph" id="par_id671542197262160" xml-lang="en-US">Part of vbTriState enumeration.</paragraph> + </tablecell> + </tablerow> + <tablerow> + <tablecell> + <paragraph id="par_id241542196923343" role="paragraph" xml-lang="en-US" localize="false">vbFalse</paragraph> + </tablecell> + <tablecell> + <paragraph id="par_id611542196923343" role="paragraph" xml-lang="en-US" localize="false">0</paragraph> + </tablecell> + <tablecell> + <paragraph role="paragraph" id="par_id351542197255532" xml-lang="en-US">Part of vbTriState enumeration.</paragraph> + </tablecell> + </tablerow> + <tablerow> + <tablecell> + <paragraph id="par_id551542196949698" role="paragraph" xml-lang="en-US" localize="false">vbUseDefault</paragraph> + </tablecell> + <tablecell> + <paragraph id="par_id831542196949698" role="paragraph" xml-lang="en-US" localize="false">-2</paragraph> + </tablecell> + <tablecell> + <paragraph role="paragraph" id="par_id251542197274514" xml-lang="en-US">Part of vbTriState enumeration.</paragraph> + </tablecell> + </tablerow> + <tablerow> + <tablecell> + <paragraph id="par_id891512313266496" role="paragraph" xml-lang="en-US" localize="false">vbCr</paragraph> + </tablecell> + <tablecell> + <paragraph role="paragraph" id="par_id241512313723033" xml-lang="en-US" localize="false">\x0D (13)</paragraph> + </tablecell> + <tablecell> + <paragraph role="paragraph" id="par_id611512313731233" xml-lang="en-US">CR - Carriage return</paragraph> + </tablecell> + </tablerow> + <tablerow> + <tablecell> + <paragraph id="par_id471512313282257" role="paragraph" xml-lang="en-US" localize="false">vbCrLf</paragraph> + </tablecell> + <tablecell> + <paragraph id="par_id691512313750520" role="paragraph" xml-lang="en-US" localize="false">\x0D\x0A (13 10)</paragraph> + </tablecell> + <tablecell> + <paragraph id="par_id961512313881937" role="paragraph" xml-lang="en-US" >CRLF - Carriage return and line feed</paragraph> + </tablecell> + </tablerow> + <tablerow> + <tablecell> + <paragraph id="par_id11512313289164" role="paragraph" xml-lang="en-US" localize="false">vbFormFeed</paragraph> + </tablecell> + <tablecell> + <paragraph id="par_id341512313761295" role="paragraph" xml-lang="en-US" localize="false">\x0c (12)</paragraph> + </tablecell> + <tablecell> + <paragraph id="par_id221512313889077" role="paragraph" xml-lang="en-US" >FF - Form feed</paragraph> + </tablecell> + </tablerow> + <tablerow> + <tablecell> + <paragraph id="par_id501512313293989" role="paragraph" xml-lang="en-US" localize="false">vbLf</paragraph> + </tablecell> + <tablecell> + <paragraph id="par_id311512313777558" role="paragraph" xml-lang="en-US" localize="false">\x0A (10)</paragraph> + </tablecell> + <tablecell> + <paragraph id="par_id621512313896169" role="paragraph" xml-lang="en-US" >LF - Line feed</paragraph> + </tablecell> + </tablerow> + <tablerow> + <tablecell> + <paragraph id="par_id191512313300610" role="paragraph" xml-lang="en-US" localize="false">vbNewLine</paragraph> + </tablecell> + <tablecell> + <paragraph id="par_id521512319135830" role="listitem" xml-lang="en-US">\x0D\x0A (13 10) for 32-bit Windows</paragraph> + <paragraph id="par_id61512319163913" role="listitem" xml-lang="en-US">\x0A (10) for other 64-bit systems</paragraph> + </tablecell> + <tablecell> + <paragraph id="par_id151512313904989" role="paragraph" xml-lang="en-US" >LF or CRLF </paragraph> + </tablecell> + </tablerow> + <tablerow> + <tablecell> + <paragraph id="par_id211512313306932" role="paragraph" xml-lang="en-US" localize="false">vbNullString</paragraph> + </tablecell> + <tablecell> + <paragraph id="par_id141512313800110" role="paragraph" xml-lang="en-US" localize="false">""</paragraph> + </tablecell> + <tablecell> + <paragraph id="par_id741512313911049" role="paragraph" xml-lang="en-US" >Null string</paragraph> + </tablecell> + </tablerow> + <tablerow> + <tablecell> + <paragraph id="par_id931512313312621" role="paragraph" xml-lang="en-US" localize="false">vbTab</paragraph> + </tablecell> + <tablecell> + <paragraph id="par_id241512313810064" role="paragraph" xml-lang="en-US" localize="false">\x09 (9)</paragraph> + </tablecell> + <tablecell> + <paragraph id="par_id951512313918356" role="paragraph" xml-lang="en-US" >HT - Horizontal tab</paragraph> + </tablecell> + </tablerow> + <tablerow> + <tablecell> + <paragraph id="par_id481512313318983" role="paragraph" xml-lang="en-US" localize="false">vbVerticalTab </paragraph> + </tablecell> + <tablecell> + <paragraph id="par_id991512313821414" role="paragraph" xml-lang="en-US" localize="false">\x0B (11)</paragraph> + </tablecell> + <tablecell> + <paragraph id="par_id351512313924593" role="paragraph" xml-lang="en-US" >VT - Vertical tab</paragraph> + </tablecell> + </tablerow> + </table> + </section> </body> </helpdocument> diff --git a/source/text/sbasic/shared/03170010.xhp b/source/text/sbasic/shared/03170010.xhp new file mode 100644 index 0000000000..981c15ab0d --- /dev/null +++ b/source/text/sbasic/shared/03170010.xhp @@ -0,0 +1,118 @@ +<?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="textsbasicshared03170010xml" indexer="include" status="PUBLISH"> + <title id="tit" xml-lang="en-US">FormatNumber Function [VBA]</title> + <filename>/text/sbasic/shared/03170010.xhp</filename> + </topic> + </meta> + <body> + <section id="formatnumber"> + <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>FormatNumber function</bookmark_value> + </bookmark> + <paragraph id="hd_id871542193473857" role="heading" level="1" xml-lang="en-US"><link href="text/sbasic/shared/03170010.xhp" name="FormatNumber Function [VBA]">FormatNumber [VBA]</link></paragraph> + <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> + <embed href="text/sbasic/shared/00000003.xhp#functvalue"/> + <paragraph role="paragraph" id="par_id761542194361212" xml-lang="en-US">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 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> + + <paragraph role="paragraph" id="par_id961542200034362" xml-lang="en-US"><emph>includeLeadingDigit</emph>: Optional. A <link href="text/sbasic/shared/03040000.xhp#addvbaconstants" name="vbtristate">vbTriState</link> enumeration value, specifying whether a leading zero should be displayed for fractional values.</paragraph> + + <list type="unordered"> + <listitem> + <paragraph id="par_id561542198440051" role="listitem" xml-lang="en-US"><emph>vbTrue or -1</emph>: Display a leading zero.</paragraph> + </listitem> + <listitem> + <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> + </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" name="vbtristate">vbTriState</link> enumeration value specifying whether negative numbers should be encased in parenthesis.</paragraph> + <list type="unordered"> + <listitem> + <paragraph id="par_id561543198440051" role="listitem" xml-lang="en-US"><emph>vbTrue or -1</emph>: Use parenthesis for negative numbers.</paragraph> + </listitem> + <listitem> + <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> + </listitem> + </list> + + <paragraph role="paragraph" id="par_id531542201968815" xml-lang="en-US"><emph>groupDigits</emph>: Optional. A <link href="text/sbasic/shared/03040000.xhp#addvbaconstants" name="vbtristate">vbTriState</link> enumeration value specifying the number should be grouped (into thousands, etc.), using the group delimiter that is specified on the system's regional settings.</paragraph> + + <list type="unordered"> + <listitem> + <paragraph id="par_id561543198560051" role="listitem" xml-lang="en-US"><emph>vbTrue or -1</emph>: Group digits.</paragraph> + </listitem> + <listitem> + <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> + </listitem> + </list> + <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 TestFormatNumeber</paragraph> + <paragraph role="bascode" id="par_id551542204266762" xml-lang="en-US" localize="false">testName = "Test 1: positive, 2 decimals"</paragraph> + <paragraph role="bascode" id="par_id561542204276644" xml-lang="en-US" localize="false">str2 = "12.20"</paragraph> + <paragraph role="bascode" id="par_id341542204281478" xml-lang="en-US" localize="false">str1 = FormatNumber("12.2", 2, vbFalse, vbFalse, vbFalse)</paragraph> + <paragraph role="bascode" id="par_id771542204286220" xml-lang="en-US" localize="false">msgbox( "FormatNumber returned: " + str1 + ", Expected: " + str2)</paragraph> + + <paragraph role="bascode" id="par_id411542204290664" xml-lang="en-US" localize="false">testName = "Test 2: negative, 20 decimals, use leading zero"</paragraph> + <paragraph role="bascode" id="par_id411542204295496" xml-lang="en-US" localize="false">str2 = "-0.20000000000000000000"</paragraph> + <paragraph role="bascode" id="par_id391542204301416" xml-lang="en-US" localize="false">str1 = FormatNumber("-.2", 20, vbTrue, vbFalse, vbFalse)</paragraph> + <paragraph role="bascode" id="par_id671542204307459" xml-lang="en-US" localize="false">msgbox( "FormatNumber returned: " + str1 + ", Expected: " + str2)</paragraph> + + <paragraph role="bascode" id="par_id741542204311861" xml-lang="en-US" localize="false">testName = "Test 3: negative, 20 decimals, no leading zero"</paragraph> + <paragraph role="bascode" id="par_id871542204316094" xml-lang="en-US" localize="false">str2 = "-.20000000000000000000"</paragraph> + <paragraph role="bascode" id="par_id911542204322988" xml-lang="en-US" localize="false">str1 = FormatNumber("-0.2", 20, vbFalse, vbFalse, vbFalse)</paragraph> + <paragraph role="bascode" id="par_id61542204328859" xml-lang="en-US" localize="false">msgbox( "FormatNumber returned: " + str1 + ", Expected: " + str2)</paragraph> + + <paragraph role="bascode" id="par_id781542204333400" xml-lang="en-US" localize="false">testName = "Test 4: negative, no leading zero, use parens"</paragraph> + <paragraph role="bascode" id="par_id161542204338478" xml-lang="en-US" localize="false">str2 = "(.20)"</paragraph> + <paragraph role="bascode" id="par_id251542204342658" xml-lang="en-US" localize="false">str1 = FormatNumber("-0.2", -1, vbFalse, vbTrue, vbFalse)</paragraph> + <paragraph role="bascode" id="par_id421542204347269" xml-lang="en-US" localize="false">msgbox( "FormatNumber returned: " + str1 + ", Expected: " + str2)</paragraph> + + <paragraph role="bascode" id="par_id181542204351589" xml-lang="en-US" localize="false">testName = "Test 5: negative, default leading zero, use parens"</paragraph> + <paragraph role="bascode" id="par_id561542204357496" xml-lang="en-US" localize="false">str2 = "(0.20)"</paragraph> + <paragraph role="bascode" id="par_id341542204361912" xml-lang="en-US" localize="false">str1 = FormatNumber("-0.2", -1, vbUseDefault, vbTrue, vbFalse)</paragraph> + <paragraph role="bascode" id="par_id151542204366706" xml-lang="en-US" localize="false">msgbox( "FormatNumber returned: " + str1 + ", Expected: " + str2)</paragraph> + + <paragraph role="bascode" id="par_id841542204371456" xml-lang="en-US" localize="false">testName = "Test 6: group digits"</paragraph> + <paragraph role="bascode" id="par_id711542204376020" xml-lang="en-US" localize="false">str2 = "-12,345,678.00"</paragraph> + <paragraph role="bascode" id="par_id481542204380404" xml-lang="en-US" localize="false">str1 = FormatNumber("-12345678", -1, vbUseDefault, vbUseDefault, vbTrue)</paragraph> + <paragraph role="bascode" id="par_id971542204385212" xml-lang="en-US" localize="false">msgbox( "FormatNumber returned: " + str1 + ", Expected: " + str2)</paragraph> + <paragraph role="bascode" id="par_id11542204687786" xml-lang="en-US" localize="false">End Sub</paragraph> + </bascode> + <section id="relatedtopics"> + <embed href="text/sbasic/shared/00000003.xhp#VBAMath"/> + </section> +</body> +</helpdocument> diff --git a/source/text/sbasic/shared/special_vba_func.xhp b/source/text/sbasic/shared/special_vba_func.xhp index 003f3c5eb9..634891e7a8 100644 --- a/source/text/sbasic/shared/special_vba_func.xhp +++ b/source/text/sbasic/shared/special_vba_func.xhp @@ -92,12 +92,17 @@ <section id="VBAMath"> + + <bookmark xml-lang="en-US" branch="index" id="bm_id051920170358346963"> <bookmark_value>VBA Functions;Mathematical Functions</bookmark_value> + <bookmark_value>VBA Functions;formatting numbers</bookmark_value> </bookmark> <paragraph id="par_id051820170356005221" role="heading" level="2" xml-lang="en-US">Mathematical Functions</paragraph> <embed href="text/sbasic/shared/03170000.xhp#Round"/> +<embed href="text/sbasic/shared/03170010.xhp#formatnumber"/> + </section> <section id="VBAObject"> |