summaryrefslogtreecommitdiff
path: root/wizards
diff options
context:
space:
mode:
authorJean-Pierre Ledure <jp@ledure.be>2022-02-03 15:29:49 +0100
committerJean-Pierre Ledure <jp@ledure.be>2022-02-05 12:21:31 +0100
commit1c949e29e8a589bb8430e6fb2e5855dbb722b82a (patch)
tree89f282fc565c4bbba4107ddda5c59f4e8aabb931 /wizards
parent33d70d68aa67d567e9b18fa5947b86df6e378f32 (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 Correction on master: https://git.libreoffice.org/core/+/de03a5ca23ddb09a55014f9d79ebcd6df54503bb%5E%21 Change-Id: I588c07132b9d98a3351f03e3e876ef81812d2f04 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/129426 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 e5b35e4afa12..78c17689d92a 100644
--- a/wizards/source/sfdocuments/SF_Calc.xba
+++ b/wizards/source/sfdocuments/SF_Calc.xba
@@ -3533,6 +3533,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
@@ -3565,20 +3566,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