wizards/source/sfdocuments/SF_Calc.xba |    2 ++
 1 file changed, 2 insertions(+)

New commits:
commit f9fa11e1c273e6aeba0d7656d518eaea0b14890b
Author:     Jean-Pierre Ledure <j...@ledure.be>
AuthorDate: Sun May 15 17:51:45 2022 +0200
Commit:     Jean-Pierre Ledure <j...@ledure.be>
CommitDate: Mon May 16 16:22:55 2022 +0200

    ScriptForge - (SF_Calc) FIX CompactUp/Left whan range is 1 row/col
    
    When the range to compact spans only 1 row (CompactUp)
    or 1 column (CompactLeft), a GetValue() method returns
    a scalar and not an array as expected in usual cases.
    
    This caused an abort of the script when invoking the
    UBound() value of the returned array with a Basic run-time error
       Object variable not set
    
    A test on being scalar or array of the result of
    the GetValue() method avoids the error.
    To be done in both CompactXXX() methods.
    
    Impact only on Basic code. Python not involved.
    No changes due in documentation.
    
    Change-Id: I74cf2b274944b442f843e1f4b7ac3a05dd6eaae7
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134352
    Tested-by: Jean-Pierre Ledure <j...@ledure.be>
    Tested-by: Jenkins
    Reviewed-by: Jean-Pierre Ledure <j...@ledure.be>

diff --git a/wizards/source/sfdocuments/SF_Calc.xba 
b/wizards/source/sfdocuments/SF_Calc.xba
index bc17d4abe578..4b42163753bb 100644
--- a/wizards/source/sfdocuments/SF_Calc.xba
+++ b/wizards/source/sfdocuments/SF_Calc.xba
@@ -714,6 +714,7 @@ Try:
                SetFormula(sFormulaRange, FilterFormula)
                &apos;  Get the columns to compact: 0 = False, 1 = True
                vCompact = GetValue(sFormulaRange)
+               If Not IsArray(vCompact) Then vCompact = Array(vCompact)
                ClearAll(sFormulaRange)
 
                &apos;  Iterates from the last to the first column of the range 
and remove the columns that match the filter
@@ -823,6 +824,7 @@ Try:
                SetFormula(sFormulaRange, FilterFormula)
                &apos;  Get the rows to compact: 0 = False, 1 = True
                vCompact = GetValue(sFormulaRange)
+               If Not IsArray(vCompact) Then vCompact = Array(vCompact)
                ClearAll(sFormulaRange)
 
                &apos;  Iterates from the last to the first row of the range 
and remove the rows that match the filter

Reply via email to