ScriptForge (Calc) FormatRange() fix new formats

New formats should not be deleted after
use. Anyway they are stored in the
document, not at install level.

+

A few typos in comments.

No change in user documentation.

Change-Id: I839fa0d86abdaf521a12b0d97978cf225cc8088e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/197090
Tested-by: Jenkins
Reviewed-by: Jean-Pierre Ledure <jp@ledure.be>
This commit is contained in:
Jean-Pierre Ledure
2026-01-12 17:23:01 +01:00
parent 2dcc1c95b5
commit 38bc68ba4b
3 changed files with 18 additions and 21 deletions
+6 -9
View File
@@ -492,7 +492,7 @@ Public Function AlignRange(Optional ByVal TargetRange As Variant _
&apos;&apos;&apos; Returns:
&apos;&apos;&apos; A string representing the updated range
&apos;&apos;&apos; Examples:
&apos;&apos;&apos; oDoc.AlignRange(&quot;SheetX.A1:J30&quot;, &quot;Middle,Center&quot;, FilterFormula := &quot;IsNumeric(A1), FilterScope := &quot;CELL&quot;)
&apos;&apos;&apos; oDoc.AlignRange(&quot;SheetX.A1:J30&quot;, &quot;Middle,Center&quot;, FilterFormula := &quot;=IsNumeric(A1), FilterScope := &quot;CELL&quot;)
&apos;&apos;&apos; &apos; Align to the middle of the cells, horizontally and vertically
Dim sAlign As String &apos; Return value
@@ -578,7 +578,7 @@ Public Function BorderRange(Optional ByVal TargetRange As Variant _
&apos;&apos;&apos; Returns:
&apos;&apos;&apos; A string representing the updated range
&apos;&apos;&apos; Examples:
&apos;&apos;&apos; oDoc.BorderRange(&quot;SheetX.A1:J30&quot;, &quot;HB&quot;, FilterFormula := &quot;IsNumeric(A1), FilterScope := &quot;CELL&quot;)
&apos;&apos;&apos; oDoc.BorderRange(&quot;SheetX.A1:J30&quot;, &quot;HB&quot;, FilterFormula := &quot;=IsNumeric(A1), FilterScope := &quot;CELL&quot;)
&apos;&apos;&apos; &apos; Border with a bottom line, including the horizontal inner lines
Dim sBorder As String &apos; Return value
@@ -729,7 +729,7 @@ Public Function ColorizeRange(Optional ByVal TargetRange As Variant _
&apos;&apos;&apos; Returns:
&apos;&apos;&apos; A string representing the updated range
&apos;&apos;&apos; Examples:
&apos;&apos;&apos; oDoc.ColorizeRange(&quot;SheetX.A1:J30&quot;, Background := RGB(255, 0, 0), FilterFormula := &quot;IsNumeric(A1), FilterScope := &quot;CELL&quot;)
&apos;&apos;&apos; oDoc.ColorizeRange(&quot;SheetX.A1:J30&quot;, Background := RGB(255, 0, 0), FilterFormula := &quot;=IsNumeric(A1), FilterScope := &quot;CELL&quot;)
&apos;&apos;&apos; &apos; Paint the cell(s) in red.
Dim sColorize As String &apos; Return value
@@ -1814,7 +1814,7 @@ Public Function DecorateFont(Optional ByVal TargetRange As Variant _
&apos;&apos;&apos; Returns:
&apos;&apos;&apos; A string representing the updated range
&apos;&apos;&apos; Examples:
&apos;&apos;&apos; oDoc.DecorateFont(&quot;SheetX.A1:J30&quot;, FontSize := 15, Decoration := &quot;BU&quot;, FilterFormula := &quot;IsNumeric(A1), FilterScope := &quot;CELL&quot;)
&apos;&apos;&apos; oDoc.DecorateFont(&quot;SheetX.A1:J30&quot;, FontSize := 15, Decoration := &quot;BU&quot;, FilterFormula := &quot;=IsNumeric(A1), FilterScope := &quot;CELL&quot;)
&apos;&apos;&apos; &apos; Modify the font size and apply bold and underline properties to the numeric cells
Dim sDecorate As String &apos; Return value
@@ -2083,7 +2083,7 @@ Public Function FormatRange(Optional ByVal TargetRange As Variant _
) As String
&apos;&apos;&apos; Apply a given number format to a cell or a range of cells.
&apos;&apos;&apos; The cells range may be filtered with a filter formula and its scope.
&apos;&apos;&apos; If the given format does not exist, it is created and suppressed immediately.
&apos;&apos;&apos; If the given format does not exist, it is created.
&apos;&apos;&apos; Args:
&apos;&apos;&apos; TargetRange : the cell or the range as a string that should receive the format
&apos;&apos;&apos; NumberFormat: the format to apply, as a string
@@ -2096,7 +2096,7 @@ Public Function FormatRange(Optional ByVal TargetRange As Variant _
&apos;&apos;&apos; Returns:
&apos;&apos;&apos; A string representing the updated range
&apos;&apos;&apos; Examples:
&apos;&apos;&apos; oDoc.FormatRange(&quot;SheetX.A1:J30&quot;, &quot;0,00E+00&quot;, FilterFormula := &quot;IsNumeric(A1), FilterScope := &quot;CELL&quot;)
&apos;&apos;&apos; oDoc.FormatRange(&quot;SheetX.A1:J30&quot;, &quot;0,00E+00&quot;, FilterFormula := &quot;=IsNumeric(A1), FilterScope := &quot;CELL&quot;)
&apos;&apos;&apos; &apos; Format only the cells containing a numeric value
Dim sFormat As String &apos; Return value
@@ -2156,9 +2156,6 @@ Try:
For Each oFRange In vRanges
oFRange.XCellRange.NumberFormat = lFormatID
Next oFRange
&apos; Delete the new format
If bNew Then .removeByKey(lFormatID)
End With
sFormat = oRange.RangeName
+1 -1
View File
@@ -2330,4 +2330,4 @@ Private Function _Repr() As String
End Function &apos; SFDocuments.SF_Document._Repr
REM ============================================ END OF SFDOCUMENTS.SF_DOCUMENT
</script:module>
</script:module>
+11 -11
View File
@@ -1,16 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE library:library PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "library.dtd">
<library:library xmlns:library="http://openoffice.org/2000/library" library:name="SFDocuments" library:readonly="false" library:passwordprotected="false">
<library:element library:name="__License"/>
<library:element library:name="SF_Form"/>
<library:element library:name="SF_DocumentListener"/>
<library:element library:name="SF_Document"/>
<library:element library:name="SF_Calc"/>
<library:element library:name="SF_Writer"/>
<library:element library:name="SF_Register"/>
<library:element library:name="SF_Base"/>
<library:element library:name="SF_Shape"/>
<library:element library:name="SF_FormControl"/>
<library:element library:name="SF_FormDocument"/>
<library:element library:name="SF_Chart"/>
<library:element library:name="SF_FormDocument"/>
<library:element library:name="SF_FormControl"/>
<library:element library:name="SF_Shape"/>
<library:element library:name="SF_Base"/>
<library:element library:name="SF_Register"/>
<library:element library:name="SF_Writer"/>
<library:element library:name="SF_Calc"/>
<library:element library:name="SF_Document"/>
<library:element library:name="SF_DocumentListener"/>
<library:element library:name="SF_Form"/>
<library:element library:name="__License"/>
</library:library>