wizards/source/sfdocuments/SF_Calc.xba | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)
New commits: commit cb62be830fae6e42e94c42813923e635e895eae7 Author: Jean-Pierre Ledure <[email protected]> AuthorDate: Tue Jun 21 18:29:03 2022 +0200 Commit: Jean-Pierre Ledure <[email protected]> CommitDate: Tue Jun 21 19:34:04 2022 +0200 ScriptForge - (SF_Calc)FIX wrong sheet name validation When the name of a sheet contains a "." or a space, when passed as an argument, the name must be surrounded with sinle quotes (like in usual Calc formulas). The validation of the sheet name goes thru the comparison with the list of existing sheet names in the document. The comparison compared erroneously the name with quotes and sheet name without quotes. Gave an unjustified user error. Example: calc.Sheet("'Commits 7.4'") Cfr. commit on master: https://gerrit.libreoffice.org/c/core/+/136233 Change-Id: I7a47c9dfe1c7b507e99a37d5714046dd6d8e7567 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/136258 Tested-by: Jean-Pierre Ledure <[email protected]> Reviewed-by: Jean-Pierre Ledure <[email protected]> Tested-by: Jenkins diff --git a/wizards/source/sfdocuments/SF_Calc.xba b/wizards/source/sfdocuments/SF_Calc.xba index 4b42163753bb..0b7b88ae8f76 100644 --- a/wizards/source/sfdocuments/SF_Calc.xba +++ b/wizards/source/sfdocuments/SF_Calc.xba @@ -4444,6 +4444,7 @@ Private Function _ValidateSheet(Optional ByRef pvSheetName As Variant _ ''' DUPLICATESHEETERROR A sheet with the given name exists already Dim vSheets As Variant ' List of sheets +Dim sSheet As String ' Sheet name without single quotes Dim lSheet As Long ' Index in list of sheets Dim vTypes As Variant ' Array of accepted variable types Dim bValid As Boolean ' Return value @@ -4474,12 +4475,13 @@ Try: pvSheetName = _Component.CurrentController.ActiveSheet.Name Else vSheets = _Component.getSheets.getElementNames() + sSheet = Replace(pvSheetName, "'", "") If pvNew Then - If ScriptForge.SF_Array.Contains(vSheets, pvSheetName) Then GoTo CatchDuplicate + If ScriptForge.SF_Array.Contains(vSheets, sSheet) Then GoTo CatchDuplicate Else - If Not ScriptForge.SF_Utils._Validate(pvSheetName, psArgName, V_STRING, vSheets) Then GoTo Finally + If Not ScriptForge.SF_Utils._Validate(sSheet, psArgName, V_STRING, vSheets) Then GoTo Finally If pvResetSheet Then - lSheet = ScriptForge.SF_Array.IndexOf(vSheets, pvSheetName, CaseSensitive := False) + lSheet = ScriptForge.SF_Array.IndexOf(vSheets, sSheet, CaseSensitive := False) pvSheetName = vSheets(lSheet) End If End If
