https://bugs.documentfoundation.org/show_bug.cgi?id=152739

Buovjaga <[email protected]> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
     Ever confirmed|0                           |1
             Status|UNCONFIRMED                 |NEEDINFO
         Whiteboard| QA:needsComment            |
                 CC|                            |ilmari.lauhakangas@libreoff
                   |                            |ice.org

--- Comment #2 from Buovjaga <[email protected]> ---
I copied it to instdir/share/RoundUP.py as:

from decimal import Decimal, getcontext, ROUND_HALF_UP  # # Round UP

round_context = getcontext()
round_context.rounding = ROUND_HALF_UP


# -------------------------------------
def roundUp(x, digits, precision=5):
    tmp = round(Decimal(x), precision)
    fRet = float(tmp.__round__(digits))
    return fRet


# ---------------------------------------------------------------
if __name__ == '__main__':
    fRU = roundUp(2.125, 2)  # -> 2.13
    fRU = roundUp(3.125, 2)  # -> 3.13
    fRU = roundUp(-2.125, 2)  # -> -2.13
    fRU = roundUp(4.125, 2)  # -> 4.13
    fRU = roundUp(2.225, 2)  # -> 2.23
    pass

Accordingly, in the Basic script I changed the location to share:
sFunctionPy = "vnd.sun.star.script:RoundUP.py$roundUp"& _
    "?language=Python&location=share"

When I run it, I get

BASIC runtime error.
Argument is not optional

pointing to line

vRoundUp = oScript.invoke(Array(num, dec), Array(), Array())

Please advise.

Arch Linux 64-bit, X11
Version: 7.6.0.0.alpha0+ (X86_64) / LibreOffice Community
Build ID: f0ff4243d45b11f372a2ed824fbb8806de9cb595
CPU threads: 8; OS: Linux 6.2; UI render: default; VCL: kf5 (cairo+xcb)
Locale: fi-FI (fi_FI.UTF-8); UI: en-US
Calc: threaded
Built on 17 March 2023

-- 
You are receiving this mail because:
You are the assignee for the bug.

Reply via email to