summaryrefslogtreecommitdiff
path: root/wizards
diff options
context:
space:
mode:
authorJean-Pierre Ledure <jp@ledure.be>2022-02-03 11:49:46 +0100
committerJean-Pierre Ledure <jp@ledure.be>2022-02-03 15:19:44 +0100
commitde03a5ca23ddb09a55014f9d79ebcd6df54503bb (patch)
tree0af0672f0bc3a9855aad3df2863426367e4a2b53 /wizards
parent266e6b76763d16bcb1dcf67bab2478a7d2d7b8fc (diff)
ScriptForge - (SF_Calc) FIX range parsing error when leading $
When sheet name contains - a leading $ - surrounding single quotes an error message was errorneously displayed to the user. Corrected in the SF_Calc._ParseAddress() function Change-Id: I8abd4908a4c92bd6e569b95be58ab21e16ffc169 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/129408 Tested-by: Jean-Pierre Ledure <jp@ledure.be> Tested-by: Jenkins Reviewed-by: Jean-Pierre Ledure <jp@ledure.be>
Diffstat (limited to 'wizards')
-rw-r--r--wizards/source/sfdocuments/SF_Calc.xba19
1 files changed, 11 insertions, 8 deletions
diff --git a/wizards/source/sfdocuments/SF_Calc.xba b/wizards/source/sfdocuments/SF_Calc.xba
index 29b22f4b0ed0..8c9ab301370f 100644
--- a/wizards/source/sfdocuments/SF_Calc.xba
+++ b/wizards/source/sfdocuments/SF_Calc.xba
@@ -3550,6 +3550,7 @@ Private Function _ParseAddress(ByVal psAddress As String) As Object
&apos;&apos;&apos; CALCADDRESSERROR &apos; Address could not be parsed to a valid address
Dim oAddress As Object &apos; Return value
+Dim sAddress As String &apos; Alias of psAddress
Dim lStart As Long &apos; Position of found regex
Dim sSheet As String &apos; Sheet component
Dim sRange As String &apos; Range component
@@ -3582,20 +3583,22 @@ Dim oSelect As Object &apos; Current selection
.RawAddress = psAddress
Set .XSpreadSheet = Nothing : Set .XCellRange = Nothing
+ &apos; Remove leading &apos;$&apos;
+ If Left(psAddress, 1) = &quot;$&quot; Then sAddress = Mid(psAddress, 2) Else sAddress = psAddress
&apos; Split in sheet and range components - Check presence of surrounding single quotes or dot
- If Left(psAddress, 1) = &quot;&apos;&quot; Then
+ If Left(sAddress, 1) = &quot;&apos;&quot; Then
lStart = 1
- sSheet = ScriptForge.SF_String.FindRegex(psAddress, &quot;^&apos;[^\[\]*?:\/\\]+&apos;&quot;)
+ sSheet = ScriptForge.SF_String.FindRegex(sAddress, &quot;^&apos;[^\[\]*?:\/\\]+&apos;&quot;)
If lStart = 0 Then GoTo CatchAddress &apos; Invalid sheet name
- If Len(psAddress) &gt; Len(sSheet) + 1 Then
- If Mid(psAddress, Len(sSheet) + 1, 1) = &quot;.&quot; then sRange = Mid(psAddress, Len(sSheet) + 2)
+ If Len(sAddress) &gt; Len(sSheet) + 1 Then
+ If Mid(sAddress, Len(sSheet) + 1, 1) = &quot;.&quot; then sRange = Mid(sAddress, Len(sSheet) + 2)
End If
sSheet = Replace(Replace(sSheet, &quot;$&quot;, &quot;&quot;), &quot;&apos;&quot;, &quot;&quot;)
- ElseIf InStr(psAddress, &quot;.&quot;) &gt; 0 Then
- sSheet = Replace(Split(psAddress, &quot;.&quot;)(0), &quot;$&quot;, &quot;&quot;)
- sRange = Replace(Split(psAddress, &quot;.&quot;)(1), &quot;$&quot;, &quot;&quot;)
+ ElseIf InStr(sAddress, &quot;.&quot;) &gt; 0 Then
+ sSheet = Replace(Split(sAddress, &quot;.&quot;)(0), &quot;$&quot;, &quot;&quot;)
+ sRange = Replace(Split(sAddress, &quot;.&quot;)(1), &quot;$&quot;, &quot;&quot;)
Else
- sSheet = psAddress
+ sSheet = sAddress
End If
&apos; Resolve sheet part: either a document named range, or the active sheet or a real sheet