SFDocuments.Calc tjeneste

Det delte biblioteket SFDocuments gir en rekke metoder og egenskaper for å forenkle administrasjon og håndtering av LibreOffice-dokumenter.

Tjenesten SFDocuments.Calc er en underklasse av SFDocuments.Document tjeneste. Alle metoder og egenskaper definert for Dokument-tjenesten kan også nås ved å bruke en Calc-tjenesteforekomst.

Tjenesten Calc er fokusert på:

note

Denne hjelpesiden beskriver metoder og egenskaper som bare gjelder for Calc-dokumenter.


Tjenestepåkallelse

Tjenesten Calc er nært knyttet til UI-tjenesten til ScriptForge-biblioteket. Nedenfor er noen eksempler på hvordan Calc-tjenesten kan påkalles.

I Basic

Kodesnutten nedenfor oppretter en Calc-tjenesteforekomst som tilsvarer det aktive Calc-dokumentet.


    Set oDoc = CreateScriptService("Calc")
  

En annen måte å opprette en forekomst av Calc-tjenesten på er å bruke UI-tjenesten. I følgende eksempel opprettes et nytt Calc-dokument og oDoc er en Calc-tjenesteforekomst:


    Dim ui As Object, oDoc As Object
    Set ui = CreateScriptService("UI")
    Set oDoc = ui.CreateDocument("Calc")
  

Eller ved å bruke OpenDocument-metoden fra UI-tjenesten:


    Set oDoc = ui.OpenDocument("C:\Documents\MyFile.ods")
  

Det er også mulig å instansiere Calc-tjenesten ved å bruke CreateScriptService-metoden:


    Dim oDoc As Object
    Set oDoc = CreateScriptService("SFDocuments.Calc", "MyFile.ods")
  

I eksemplet ovenfor er "MyFile.ods" navnet på et åpent dokumentvindu. Hvis dette argumentet ikke er oppgitt, vurderes det aktive vinduet.

Det anbefales å frigjøre ressurser etter bruk:


    Set oDoc = oDoc.Dispose()
  

Men hvis dokumentet ble lukket med CloseDocument-metoden, blir det unødvendig å frigjøre ressurser ved å bruke kommandoen beskrevet ovenfor.

I Python

    myDoc = CreateScriptService("Calc")
  

    ui = CreateScriptService("UI")
    myDoc = ui.CreateDocument("Calc")
  

    myDoc = ui.OpenDocument(r"C:\Documents\MyFile.ods")
  

    myDoc = CreateScriptService("SFDocuments.Calc", "MyFile.ods")
    myDoc.Dispose()
  
tip

Bruken av prefikset "SFDocuments." mens du anroper tjenesten er valgfritt.


Definisjoner

Mange metoder krever et "Ark" eller et "Område" som argument. Enkeltceller betraktes som et spesialtilfelle av et Område.

Begge kan uttrykkes enten som en streng eller som en referanse (= objekt) avhengig av situasjonen:

Eksempel:

Eksemplet nedenfor kopierer data fra dokument A (åpnet som skrivebeskyttet og skjult) til dokument B.

I Basic

    Dim oDocA As Object, oDocB As Object
    Set oDocA = ui.OpenDocument("C:\Documents\FileA.ods", Hidden := True, ReadOnly := True)
    Set oDocB = ui.OpenDocument("C:\Documents\FileB.ods")
    oDocB.CopyToRange(oDocA.Range("SheetX.D4:F8"), "D2:F6") 'CopyToRange(source, target)
  
I Python

    docA = ui.OpenDocument(r"C:\Documents\FileA.ods", hidden = True, readonly = True)
    docB = ui.OpenDocument(r"C:\Documents\FileB.ods")
    docB.CopyToRange(docA.Range("SheetX.D4:F8"), "D2:F6")
  

SheetName

Enten arknavnet som en streng eller et objekt produsert av egenskapen .Ark.

Snarveien "~" (tilde) representerer gjeldende ark.

RangeName

Enten en streng som angir et sett med sammenhengende celler plassert i et ark av gjeldende forekomst eller et objekt produsert av egenskapen .Område.

Snarveien "~" (tilde) representerer gjeldende utvalg eller det første valgte området hvis flere områder er valgt.

Snarveien "*" representerer alle brukte celler.

Arknavnet er valgfritt i et område (standard = det aktive arket). Omkringliggende enkeltanførselstegn og $-tegn er tillatt, men ignoreres.

tip

Bortsett fra egenskapen GjeldendeUtvalg, vurderer tjenesten Calc bare enkeltområder med celler.


Eksempler på gyldige områder

1) '$SheetX'.D2
2) $D$2

En enkelt celle

1) '$SheetX'.D2:F6
2) D2:D10

Enkelt område med flere celler

'$SheetX'.*

Alle brukte celler i det aktuelle arket

1) '$Sheet'.A:A (kolonne A)
2) 3:5 (rad 3 til 5)

Alle celler i sammenhengende kolonner eller rader opp til den sist brukte cellen

mittOmråde

Et område kalt "mittOmråde" på regnearknivå

1) ~.someRange
2) SheetX.someRange

Et områdenavn på arknivå

myDoc.Range("SheetX.D2:F6")

Et område innenfor arket SheetX i filen knyttet til myDoc Calc-forekomsten

~.~ eller ~

Det gjeldende utvalget i det aktive arket


Egenskaper

Alle egenskapene som er generiske for ethvert dokument er implisitt også gjeldende for Calc-dokumenter. For mer informasjon, les hjelpesiden for dokumenttjeneste.

Egenskapene som er spesifikt tilgjengelige for Calc-dokumenter er:

Navn

Skrivebeskyttet

Argument

Returtype

Beskrivelse

CurrentSelection

Nei

Ingen

Strenger eller en rekke strenger

Det enkelt valgte området som en streng eller listen over valgte områder som en matrise.

FirstCell

Ja

Arknavn eller områdenavn som streng

String

Returnerer den første brukte cellen i et gitt område eller ark.

FirstColumn

Ja

Arknavn eller områdenavn som streng

Long

Returnerer kolonnenummeret lengst til venstre i et gitt område eller ark.

FirstRow

Ja

Arknavn eller områdenavn som streng

Long

Returnerer det øverste radnummeret i et gitt område eller ark.

Height

Ja

Områdenavn som streng

Long

Antall rader (>= 1) i det gitte området.

LastCell

Ja

Arknavn eller områdenavn som streng

String

Returnerer den sist brukte cellen i et gitt område eller ark.

LastColumn

Ja

Arknavn eller områdenavn som streng

Long

Den sist brukte kolonnen i et gitt område eller ark.

LastRow

Ja

Arknavn eller områdenavn som streng

Long

Den sist brukte raden i et gitt område eller ark.

Range

Ja

Områdenavn som streng

Object

En områdereferanse som kan brukes som argument for metoder som Kopier til område.

Region

Ja

Områdenavn som streng

String

Returnerer adressen til det minste området som inneholder det angitte området, slik at området er omgitt av tomme celler eller arkkanter. Dette tilsvarer å bruke snarveien til det angitte området.

Sheet

Ja

Arknavn som streng

Object

En arkreferanse som kan brukes som argument for metoder som Kopier ark.

Sheets

Ja

Ingen

Matrise med strenger

Listen med navn på alle eksisterende ark.

Width

Ja

Områdenavn som streng

Long

Antall kolonner (>= 1) i det gitte området.

XCellRange

Ja

Områdenavn som streng

Object

Et com.sun.star.Table.XCellRange UNO-objekt.

XSheetCellCursor

Ja

Områdenavn som streng

Object

Et com.sun.star.sheet.XSheetCellCursor UNO-objekt. Etter å ha flyttet markøren, kan den resulterende områdeadressen nås gjennom AbsoluteName UNO-egenskapen til markørobjektet, som returnerer en strengverdi som kan brukes som argument for egenskaper og metoder for Calc-tjenesten.

XSpreadsheet

Ja

Arknavn som streng

Object

Et com.sun.star.sheet.XSpreadsheet UNO-objekt.


tip

Besøk nettstedet til LibreOffice API Dokumentasjonen for å lære mer om XCellRange, XSheetCellCursor og XSpreadsheet UNO-objekter.


Metoder

Liste over metoder i Calc-tjenesten

A1Style
Activate
Charts
ClearAll
ClearFormats
ClearValues
CopySheet
CopySheetFromFile
CopyToCell
CopyToRange
CreateChart
DAvg
DCount
DMax

DMin
DSum
Forms
GetColumnName
GetFormula
GetValue
ImportFromCSVFile
ImportFromDatabase
InsertSheet
MoveRange
MoveSheet
Offset
OpenRangeSelector

PrintOut
Printf
RemoveSheet
RenameSheet
SetArray
SetValue
SetCellStyle
SetFormula
ShiftDown
ShiftLeft
ShiftRight
ShiftUp
SortRange


A1Style

Returnerer en områdeadresse som en streng basert på ark koordinater, dvs. rad- og kolonnenummer.

Hvis bare et par koordinater er gitt, returneres en adresse til en enkelt celle. Ytterligere argumenter kan spesifisere cellen nederst til høyre i et rektangulært område.

Syntaks:

svc.A1Style(row1: int, column1: int, row2: int = 0; column2: int = 0; sheetname: str = "~"): str

Parametre:

rad1, kolonne1: Spesifiser rad- og kolonnenumrene til cellen øverst til venstre i området som skal vurderes. Rad- og kolonnenummer starter på 1.

rad2, kolonne2: Spesifiser rad- og kolonnenumrene til cellen nederst til høyre i området som skal vurderes. Hvis disse argumentene ikke er oppgitt, eller hvis verdier som er mindre enn rad1 og kolonne1 er gitt, er adressen til enkeltcelleområdet representert av rad1 og kolonne1 som returneres.

arknavn: Navnet på arket som skal legges til den returnerte områdeadressen. Arket må eksistere. Standardverdien er "~" som tilsvarer det aktive arket.

Eksempel:

Eksemplene nedenfor i Basic og Python anser at "Ark1" er det aktive arket.

I Basic

    Set oDoc = CreateScriptService("Calc")
    addr1 = oDoc.A1Style(1, 1) ' '$Sheet1'.$A$1
    addr2 = oDoc.A1Style(2, 2, 3, 6) ' '$Sheet1'.$B$2:$F$3
    addr3 = oDoc.A1Style(2, 2, 0, 6) ' '$Sheet1'.$B$2
    addr4 = oDoc.A1Style(3, 4, 3, 8, "Sheet2") ' '$Sheet2'.$D$3:$H$3
    addr5 = oDoc.A1Style(5, 1, SheetName := "Sheet3") ' '$Sheet3'.$A$5
  
I Python

    doc = CreateScriptService("Calc")
    addr1 = doc.A1Style(1, 1) # '$Sheet1'.$A$1
    addr2 = doc.A1Style(2, 2, 3, 6) # '$Sheet1'.$B$2:$F$3
    addr3 = doc.A1Style(2, 2, 0, 6) # '$Sheet1'.$B$2
    addr4 = doc.A1Style(3, 4, 3, 8, "Sheet2") # '$Sheet2'.$D$3:$H$3
    addr5 = doc.A1Style(5, 1, sheetname="Sheet3") # '$Sheet3'.$A$5
  
tip

Metoden A1Style kan kombineres med alle de mange egenskapene og metodene til Calc-tjenesten som krever et område som argument, for eksempel GetValue, GetFormula, ClearAll osv.


Activate

Hvis argumentet arknavn er oppgitt, aktiveres det gitte arket og det blir det valgte arket. Hvis argumentet er fraværende, aktiveres dokumentvinduet.

Syntaks:

svc.Activate(sheetname: str = ""): bool

Parametre:

arknavn: Navnet på arket som skal aktiveres i dokumentet. Standardverdien er en tom streng, noe som betyr at dokumentvinduet vil aktiveres uten å endre det aktive arket.

Eksempel:

Eksemplet aktiverer arket kalt "Ark4" i det aktive dokumentet.

I Basic

    Dim ui as Variant, oDoc as Object
    Set ui = CreateScriptService("UI")
    Set oDoc = ui.GetDocument(ui.ActiveWindow)
    oDoc.Activate("Sheet4")
  
I Python

    ui = CreateScriptService("UI")
    myDoc = ui.GetDocument(ui.ActiveWindow)
    myDoc.Activate("Sheet4")
  
tip

Aktivering av et ark gir mening bare hvis det utføres på et Calc-dokument. For å være sikker på at du har et Calc-dokument for hånden kan du bruke egenskapen isCalc til dokumentobjektet, som returnerer Sann hvis det er et Calc-dokument og Usann ellers.


Charts

Returnerer enten listen med navnene på alle kartobjekter i et gitt ark eller en enkelt Diagram tjenesteforekomst.

Syntaks:

svc.Charts(sheetname: str, chartname: str = ""): obj

Parametre:

arknavn: Navnet på arket som listen over diagrammer skal hentes fra eller hvor det angitte diagrammet er plassert.

kartnavn: Det brukerdefinerte navnet på diagramobjektet som skal returneres. Hvis diagrammet ikke har et brukerdefinert navn, kan det interne objektnavnet brukes. Hvis dette argumentet er fraværende, returneres listen over diagramnavn i det angitte arket.

tip

Bruk sidefeltet Navigator for å sjekke navnene som er tildelt diagrammer under kategorien OLE-objekter.


Eksempel:

I Basic

Eksemplet nedenfor viser antall kartobjekter i "Ark1".


    Dim arrNames as Object
    arrNames = oDoc.Charts("Sheet1")
    MsgBox "There are " & UBound(arrNames) + 1 & " charts in Sheet1"
  

Følgende eksempel gir tilgang til diagrammet kalt "MyChart" i "Ark1" og skriver ut typen.


    Dim oChart as Object
    oChart = oDoc.Charts("Sheet1", "MyChart")
    MsgBox oChart.ChartType
  
I Python

    bas = CreateScriptService("Basic")
    chart_names = doc.Charts("Sheet1")
    bas.MsgBox(f"There are {len(chart_names)} charts in Sheet1")
  

    chart = doc.Charts("Sheet1", "MyChart")
    bas.MsgBox(chart.ChartType)
  

ClearAll

Sletter alt innhold og formater for det gitte området.

Syntaks:

svc.ClearAll(range: str)

Parametre:

område: Området som skal slettes, som en streng.

Eksempel:

I Basic

      oDoc.ClearAll("SheetX.A1:F10")
  
I Python

    myDoc.ClearAll("SheetX.A1:F10")
  

ClearFormats

Fjerner formatene og stilene i det gitte området.

Syntaks:

svc.ClearFormats(range: str)

Parametre:

område: Området hvis formater og stiler skal slettes, som en streng.

Eksempel:

I Basic

      oDoc.ClearFormats("SheetX.*")
  
I Python

    myDoc.ClearFormats("SheetX.*")
  

ClearValues

Sletter verdiene og formlene i det gitte området.

Syntaks:

svc.ClearValues(range: str)

Parametre:

område: Området hvis verdier og formler skal slettes, som en streng.

Eksempel:

I Basic

      oDoc.ClearValues("SheetX.A1:F10")
  
I Python

    myDoc.ClearValues("SheetX.A1:F10")
  

CopySheet

Kopierer et spesifisert ark før et eksisterende ark eller på slutten av listen over ark. Arket som skal kopieres kan være inne i ethvert åpent Calc-dokument. Returnerer Sann hvis vellykket.

Syntaks:

svc.CopySheet(sheetname: any, newname: str, [beforesheet: any]): bool

Parametre:

arknavn: Navnet på arket som skal kopieres som en streng eller dets referanse som et objekt.

Dette biblioteket må lastes før kjøring. Kjør følgende setning før du kjører en makro som bruker dette biblioteket:

foranark: Navnet (strengen) eller indeksen (numerisk, fra 1) på arket som det kopierte arket skal settes inn før. Dette argumentet er valgfritt, og standard oppførsel er å legge til det kopierte arket på den siste posisjonen.

Eksempel:

I Basic

Følgende eksempel lager en kopi av arket "SheetX" og plasserer det som det siste arket i gjeldende dokument. Navnet på det kopierte arket er "SheetY".


    Dim oDoc as Object
    Henter dokumentobjektet til det aktive vinduet
    Set oDoc = CreateScriptService("Calc")
    oDoc.CopySheet("SheetX", "SheetY")
  

Eksemplet nedenfor kopierer "SheetX" fra "FileA.ods" og limer det inn på den siste posisjonen til "FileB.ods" med navnet "SheetY":


      Dim oDocA As Object : Set oDocA = ui.OpenDocument("C:\Documents\FileA.ods", Hidden := True, ReadOnly := True)
      Dim oDocB As Object : Set oDocB = ui.OpenDocument("C:\Documents\FileB.ods")
      oDocB.CopySheet(oDocA.Sheet("SheetX"), "SheetY")
  
I Python

    myDoc.CopySheet("SheetX", "SheetY")
  

    docA = ui.OpenDocument(r"C:\Documents\FileA.ods", hidden = True, readonly = True)
    docB = ui.OpenDocument(r"C:\Documents\FileB.ods")
    docB.CopySheet(docA.Sheet("SheetX"), "SheetY")
  
tip

For å kopiere ark mellom åpne dokumenter, bruk CopySheet. For å kopiere ark fra dokumenter som er lukket, bruk CopySheetFromFile.


CopySheetFromFile

Kopierer et spesifisert ark fra et lukket Calc-dokument og limer det inn før et eksisterende ark eller på slutten av listen over ark i filen referert til av et Dokument-objekt.

Hvis filen ikke eksisterer, oppstår det en feil. Hvis filen ikke er en gyldig Calc-fil, settes det inn et tomt ark. Hvis kildearket ikke finnes i inndatafilen, settes det inn en feilmelding øverst på det nylig limte arket.

Syntaks:

svc.CopySheetFromFile(filename: str, sheetname: str, newname: str, [beforesheet: any]): bool

Parametre:

filnavn: Identifiserer filen som skal åpnes. Den må følge SF_FileSystem.FileNaming-notasjonen. Filen må ikke være beskyttet med passord.

arknavn: Navnet på arket som skal kopieres som en streng.

newname: Navnet på det kopierte arket som skal settes inn i dokumentet. Navnet må ikke være i bruk i dokumentet.

førark: Navnet (strengen) eller indeksen (numerisk, fra 1) på arket som det kopierte arket skal settes inn før. Dette argumentet er valgfritt, og standard oppførsel er å legge til det kopierte arket på den siste posisjonen.

Eksempel:

Følgende eksempel kopierer "SheetX" fra "myFile.ods" og limer det inn i dokumentet referert til av "oDoc" som "SheetY" ved den første posisjonen.

I Basic

    oDoc.CopySheetFromFile("C:\Documents\myFile.ods", "SheetX", "SheetY", 1)
  
I Python

    myDoc.CopySheetFromFile(r"C:\Documents\myFile.ods", "SheetX", "SheetY", 1)
  

CopyToCell

Kopierer et spesifisert kildeområde (verdier, formler og formater) til et målområde eller celle. Metoden reproduserer virkemåten til en Kopier/Lim inn-operasjon fra et område til en enkelt celle.

Den returnerer en streng som representerer det modifiserte celleområdet. Størrelsen på det modifiserte området bestemmes fullt ut av størrelsen på kildeområdet.

Kildeområdet kan tilhøre et annet åpent dokument.

Syntaks:

svc.CopyToCell(sourcerange: any, destinationcell: str): str

Parametre:

kildeområde: Kildeområdet som en streng når det tilhører samme dokument eller som en referanse når det tilhører et annet åpent Calc-dokument.

destinationcell: Destinasjonscellen der det kopierte celleområdet skal limes inn, som en streng. Hvis et område er gitt, vurderes kun dens øverste venstre celle.

Eksempel:

I Basic

Next is an example where the source and destination are in the same file:


      oDoc.CopyToCell("SheetX.A1:F10", "SheetY.C5")
  

The example below illustrates how to copy a range from another open Calc document:


    Dim ui as Variant : ui = CreateScriptService("UI")
    Dim oDocSource As Object, oDocDestination As Object
    'Open the source document in the background (hidden)
    Set oDocSource = ui.OpenDocument("C:\SourceFile.ods", Hidden := True, ReadOnly := True)
    Set oDocDestination = CreateScriptService("Calc")
    oDocDestination.CopyToCell(oDocSource.Range("Sheet1.C2:C4"), "SheetT.A5")
    'Do not forget to close the source document because it was opened as hidden
    oDocSource.CloseDocument()
  
I Python

    docSource = ui.OpenDocument(r"C:\Documents\SourceFile.ods", hidden = True, readonly = True)
    docDestination = CreateScriptService("Calc")
    docDestination.CopyToCell(docSource.Range("Sheet1.C2:C4"), "SheetT.A5")
    docSource.CloseDocument()
  
tip

To simulate a Copy/Paste from a range to a single cell, use CopyToCell. To simulate a Copy/Paste from a range to a larger range (with the same cells being replicated several times), use CopyToRange.


CopyToRange

Copies downwards and/or rightwards a specified source range (values, formulas and formats) to a destination range. The method imitates the behaviour of a Copy/Paste operation from a source range to a larger destination range.

The method returns a string representing the modified range of cells.

The source range may belong to another open document.

Syntaks:

svc.CopyToRange(sourcerange: any, destinationrange: str): str

Parametre:

sourcerange: The source range as a string when it belongs to the same document or as a reference when it belongs to another open Calc document.

destinationrange: The destination of the copied range of cells, as a string.

Eksempel:

I Basic

Copy within the same document:


    oDoc.CopyToRange("SheetX.A1:F10", "SheetY.C5:J5")
    ' Returns a range string: "$SheetY.$C$5:$J$14"
  

Copy from one file to another:


    Dim oDocA As Object : Set oDocA = ui.OpenDocument("C:\Documents\FileA.ods", Hidden := True, ReadOnly := True)
    Dim oDocB As Object : Set oDocB = ui.OpenDocument("C:\Documents\FileB.ods")
    oDocB.CopyToRange(oDocA.Range("SheetX.A1:F10"), "SheetY.C5:J5")
  
I Python

    doc.CopyToRange("SheetX.A1:F10", "SheetY.C5:J5")
  

    docA = ui.OpenDocument(r"C:\Documents\FileA.ods", hidden = True, readonly = True)
    docB = ui.OpenDocument(r"C:\Documents\FileB.ods")
    docB.CopyToRange(docA.Range("SheetX.A1:F10"), "SheetY.C5:J5")
  

CreateChart

Creates a new chart object showing the data in the specified range. The returned chart object can be further manipulated using the Chart service.

Syntaks:

svc.CreateChart(chartname: str, sheetname: str, range: str, columnheader: bool = False, rowheader: bool = False): obj

Parametre:

chartname: The user-defined name of the chart to be created. The name must be unique in the same sheet.

sheetname: The name of the sheet where the chart will be placed.

range: The range to be used as the data source for the chart. The range may refer to any sheet of the Calc document.

columnheader: When True, the topmost row of the range is used as labels for the category axis or the legend (Default = False).

rowheader: When True, the leftmost column of the range is used as labels for the category axis or the legend. (Default = False).

Eksempel:

The examples below in Basic and Python create a chart using the data contained in the range "A1:B5" of "Sheet1" and place the chart in "Sheet2".

I Basic

    Set oChart = oDoc.CreateChart("MyChart", "Sheet2", "Sheet1.A1:B5", RowHeader := True)
    oChart.ChartType = "Donut"
  
I Python

    chart = doc.CreateChart("MyChart", "Sheet2", "Sheet1.A1:B5", rowheader=True)
    chart.ChartType = "Donut"
  
tip

Refer to the help page about ScriptForge's Chart service to learn more how to further manipulate chart objects. It is possible to change properties as the chart type, chart and axes titles and chart position.


DAvg, DCount, DMax, DMin and DSum

Apply the functions Average, Count, Max, Min and Sum, respectively, to all the cells containing numeric values on a given range.

Syntaks:

svc.DAvg(range: str): float

svc.DCount(range: str): float

svc.DMax(range: str): float

svc.DMin(range: str): float

svc.DSum(range: str): float

Parametre:

range: The range to which the function will be applied, as a string.

Eksempel:

The example below applies the Sum function to the range "A1:A1000" of the currently selected sheet:

I Basic

      result = oDoc.DSum("~.A1:A1000")
  
I Python

    result = myDoc.DSum("~.A1:A1000")
  
note

Cells in the given range that contain text will be ignored by all of these functions. For example, the DCount method will not count cells with text, only numerical cells.


Forms

Depending on the parameters provided this method will return:

Syntaks:

svc.Forms(sheetname: str): str[0..*]

svc.Forms(sheetname: str, form: str = ''): svc

svc.Forms(sheetname: str, form: int): svc

Parametre:

sheetname: The name of the sheet, as a string, from which the form will be retrieved.

form: The name or index corresponding to a form stored in the specified sheet. If this argument is absent, the method will return a list with the names of all forms available in the sheet.

Eksempel:

In the following examples, the first line gets the names of all forms stored in "Sheet1" and the second line retrieves the Form object of the form named "Form_A" which is stored in "Sheet1".

I Basic

    Set FormNames = oDoc.Forms("Sheet1")
    Set FormA = oDoc.Forms("Sheet1", "Form_A")
  
I Python

    form_names = doc.Forms("Sheet1")
    form_A = doc.Forms("Sheet1", "Form_A")
  

GetColumnName

Converts a column number ranging between 1 and 1024 into its corresponding letter (column 'A', 'B', ..., 'AMJ'). If the given column number is outside the allowed range, a zero-length string is returned.

Syntaks:

svc.GetColumnName(columnnumber: int): str

Parametre:

columnnumber: The column number as an integer value in the interval 1 ... 1024.

Eksempel:

I Basic

Displays a message box with the name of the third column, which by default is "C".


    MsgBox oDoc.GetColumnName(3)
  
I Python

    bas = CreateScriptService("Basic")
    bas.MsgBox(myDoc.GetColumnName(3))
  
note

The maximum number of columns allowed on a Calc sheet is 1024.


GetFormula

Get the formula(s) stored in the given range of cells as a single string, a 1D or a 2D array of strings.

Syntaks:

svc.GetFormula(range: str): any

Parametre:

range: The range where to get the formulas from, as a string.

Eksempel:

I Basic

The following example returns a 3 by 2 array with the formulas in the range "A1:B3" (3 rows by 2 columns):


    arrFormula = oDoc.GetFormula("~.A1:B3")
  
I Python

    arrFormula = myDoc.GetFormula("~.A1:B3")
  

GetValue

Get the value(s) stored in the given range of cells as a single value, a 1D array or a 2D array. All values are either doubles or strings.

Syntaks:

svc.GetValue(range: str): any

Parametre:

range: The range where to get the values from, as a string.

Eksempel:

I Basic

      arrValues = oDoc.GetValue("~.B1:C100")
  
I Python

    arrValues = myDoc.GetValue("~.B1:C100")
  
note

If a cell contains a date, the number corresponding to that date will be returned. To convert numeric values to dates in Basic scripts, use the Basic CDate builtin function. In Python scripts, use the CDate function from the Basic service.


ImportFromCSVFile

Imports the contents of a CSV-formatted text file and places it on a given destination cell.

The destination area is cleared of all contents and formats before inserting the contents of the CSV file. The size of the modified area is fully determined by the contents of the input file.

The method returns a string representing the modified range of cells.

Syntaks:

svc.ImportFromCSVFile(filename: str, destinationcell: str, [filteroptions: str]): str

Parametre:

filename: Identifies the file to open. It must follow the SF_FileSystem.FileNaming notation.

destinationcell: The destination cell to insert the imported data, as a string. If instead a range is given, only its top-left cell is considered.

filteroptions: The arguments for the CSV input filter. The default filter makes following assumptions:

Eksempel:

I Basic

    oDoc.ImportFromCSVFile("C:\Temp\myCSVFile.csv", "SheetY.C5")
  
I Python

    myDoc.ImportFromCSVFile(r"C:\Temp\myCSVFile.csv", "SheetY.C5")
  
tip

To learn more about the CSV Filter Options, refer to the Filter Options Wiki page.


ImportFromDatabase

Imports the contents of a database table, query or resultset, i.e. the result of a SELECT SQL command, inserting it on a destination cell.

The destination area is cleared of all contents and formats before inserting the imported contents. The size of the modified area is fully determined by the contents in the table or query.

The method returns True when the import was successful.

Syntaks:

svc.ImportFromDatabase(filename: str = "", registrationname: str = "", destinationcell: str = "", sqlcommand: str = "", directsql: bool): bool

Parametre:

filename: Identifies the file to open. It must follow the SF_FileSystem.FileNaming notation.

registrationname: The name to use to find the database in the databases register. This argument is ignored if a filename is provided.

destinationcell: The destination of the imported data, as a string. If a range is given, only its top-left cell is considered.

sqlcommand: A table or query name (without surrounding quotes or square brackets) or a SELECT SQL statement in which table and field names may be surrounded by square brackets or quotes to improve its readability.

directsql: When True, the SQL command is sent to the database engine without pre-analysis. Default is False. The argument is ignored for tables. For queries, the applied option is the one set when the query was defined.

Eksempel:

I Basic

    oDoc.ImportFromDatabase("C:\Temp\myDbFile.odb", , "SheetY.C5", "SELECT * FROM [Employees] ORDER BY [LastName]")
  
I Python

    myDoc.ImportFromDatabase(r"C:\Temp\myDbFile.odb", , "SheetY.C5", "SELECT * FROM [Employees] ORDER BY [LastName]")
  

InsertSheet

Inserts a new empty sheet before an existing sheet or at the end of the list of sheets.

Syntaks:

svc.InsertSheet(sheetname: str, [beforesheet: any]): bool

Parametre:

sheetname: The name of the new sheet.

beforesheet: The name (string) or index (numeric, starting from 1) of the sheet before which to insert the new sheet. This argument is optional and the default behavior is to insert the sheet at the last position.

Eksempel:

The following example inserts a new empty sheet named "SheetX" and places it before "SheetY":

I Basic

    oDoc.InsertSheet("SheetX", "SheetY")
  
I Python

    myDoc.InsertSheet("SheetX", "SheetY")
  

MoveRange

Moves a specified source range to a destination range of cells. The method returns a string representing the modified range of cells. The dimension of the modified area is fully determined by the size of the source area.

Syntaks:

svc.MoveRange(source: str, destination: str): str

Parametre:

source: The source range of cells, as a string.

destination: The destination cell, as a string. If a range is given, its top-left cell is considered as the destination.

Eksempel:

I Basic

    oDoc.MoveRange("SheetX.A1:F10", "SheetY.C5")
  
I Python

    myDoc.MoveRange("SheetX.A1:F10", "SheetY.C5")
  

MoveSheet

Moves an existing sheet and places it before a specified sheet or at the end of the list of sheets.

Syntaks:

svc.MoveSheet(sheetname: str, [beforesheet: any]): bool

Parametre:

sheetname: The name of the sheet to move. The sheet must exist or an exception is raised.

beforesheet: The name (string) or index (numeric, starting from 1) of the sheet before which the original sheet will be placed. This argument is optional and the default behavior is to move the sheet to the last position.

Eksempel:

The example below moves the existing sheet "SheetX" and places it before "SheetY":

I Basic

    oDoc.MoveSheet("SheetX", "SheetY")
  
I Python

    myDoc.MoveSheet("SheetX", "SheetY")
  

Offset

Returns a new range (as a string) offset by a certain number of rows and columns from a given range.

This method has the same behavior as the homonymous Calc's Offset function.

Syntaks:

svc.Offset(reference: str, rows: int = 0, columns: int = 0, [height: int], [width: int]): str

Parametre:

reference: The range, as a string, that the method will use as reference to perform the offset operation.

rows: The number of rows by which the initial range is offset upwards (negative value) or downwards (positive value). Use 0 (default) to stay in the same row.

columns: The number of columns by which the initial range is offset to the left (negative value) or to the right (positive value). Use 0 (default) to stay in the same column.

height: The vertical height for an area that starts at the new range position. Omit this argument when no vertical resizing is needed.

width: The horizontal width for an area that starts at the new range position. Omit this argument when no horizontal resizing is needed.

Arguments rows and columns must not lead to zero or negative start row or column.

Arguments height and width must not lead to zero or negative count of rows or columns.

Eksempel:

I Basic

    oDoc.Offset("A1", 2, 2)
    'SheetX.$C$3 (A1 moved by two rows and two columns down)
    oDoc.Offset("A1", 2, 2, 5, 6)
    'SheetX.$C$3:$H$7 (A1 offset by two rows and columns with width of 5 rows and 6 columns)
  
I Python

    myDoc.Offset("A1", 2, 2)
    myDoc.Offset("A1", 2, 2, 5, 6)
  

OpenRangeSelector

Opens a non-modal dialog that can be used to select a range in the document and returns a string containing the selected range.

note

This method opens the same dialog that is used by LibreOffice when the Shrink button is pressed. For example, the Tools - Goal Seek dialog has a Shrink button to the right of the Formula cell field.


This method does not change the current selection.

Syntaks:

svc.OpenRangeSelector(opt title: str, opt selection: str, singlecell: bool = False, closeafterselect: bool = True): str

Parametre:

title: The title of the dialog, as a string.

selection: An optional range that is initially selected when the dialog is displayed.

singlecell: When True (default) only single-cell selection is allowed. When False range selection is allowed.

closeafterselect: When True (default) the dialog is closed immediately after the selection is made. When False the user can change the selection as many times as needed and then manually close the dialog.

Eksempel:

I Basic

    Dim sRange as String
    sRange = oDoc.OpenRangeSelector(Title := "Select a range")
  
I Python

    sRange = myDoc.OpenRangeSelector(title = "Select a range")
  

Printf

Returns the input string after substituting its token characters by their values in a given range.

This method does not change the current selection.

tip

This method can be used to quickly extract specific parts of a range name, such as the sheet name or first cell column and row, and use them to compose a new range address.


Syntaks:

svc.Printf(inputstr: str, range: str, tokencharacter: str = "%"): str

Parametre:

inputstr: The string containing the tokens that will be replaced by the corresponding values in range.

range: A RangeName from which values will be extracted. If it contains a sheet name, the sheet must exist.

tokencharacter: Character used to identify tokens. By default "%" is the token character. The following tokens are accepted:

Eksempel:

I Basic

The example below extracts each element of the RangeName defined in sRange and uses them to compose a message.


    Dim sRange as String, sInputStr as String
    sRange = "Sheet1.A1:E10"
    sInputStr = "Sheet name: %S" & Chr(10) & _
                "First row: %R1" & Chr(10) & _
                "First column %C1" & Chr(10) & _
                "Last row %R2" & Chr(10) & _
                "Last column %C2"
    MsgBox oDoc.Printf(sInputStr, sRange)
  

The Printf method can be combined with SetFormula to create formulas over multiple cells. For instance, consider a table with numeric values in the range "A1:E10" from which formulas are to be created to sum the values in each row and place the results in the range "F1:F10":


    Dim sFormula as String, sRange as String
    sRange = "A1:E10"
    ' Note the use of the "$" character
    sFormula = "=SUM($%C1%R1:$%C2%R1)"
    oDoc.SetFormula("F1:F10", oDoc.Printf(sFormula, sRange))
  
I Python

    sRange = "Sheet1.A1:E10"
    sInputStr = "Sheet name: %S\n" \
                "First row: %R1\n" \
                "First column %C1\n" \
                "Last row %R2\n" \
                "Last column %C2"
    bas = CreateScriptService("Basic")
    bas.MsgBox(myDoc.Printf(sInputStr, sRange))
  

    sRange = "A1:E10
    sFormula = "=SUM($%C1%R1:$%C2%R1)"
    myDoc.SetFormula("F1:F10", myDoc.Printf(sFormula, sRange))
  

PrintOut

This method sends the contents of the given sheet to the default printer or to the printer defined by the SetPrinter method of the Document service.

Returns True if the sheet was successfully printed.

Syntaks:

svc.PrintOut(opt sheetname: str, pages: str = "", copies: num = 1): bool

Parametre:

sheetname: The sheet to print, default is the active sheet.

pages: The pages to print as a string, like in the user interface. Example: "1-4;10;15-18". Default is all pages.

copies: The number of copies. Default is 1.

Eksempel:

I Basic

    If oDoc.PrintOut("SheetX", "1-4;10;15-18", Copies := 2) Then
        ' ...
    End If
  
I Python

    if doc.PrintOut('SheetX', copies=3, pages='45-88'):
        # ...
  

RemoveSheet

Removes an existing sheet from the document.

Syntaks:

svc.RemoveSheet(sheetname: str): bool

Parametre:

sheetname: The name of the sheet to remove.

Eksempel:

I Basic

    oDoc.RemoveSheet("SheetY")
  
I Python

    myDoc.RemoveSheet("SheetY")
  

RenameSheet

Renames the given sheet and returns True if successful.

Syntaks:

svc.RenameSheet(sheetname: str, newname: str): bool

Parametre:

sheetname: The name of the sheet to rename.

newname: the new name of the sheet. It must not exist yet.

Eksempel:

This example renames the active sheet to "SheetY":

I Basic

    oDoc.RenameSheet("~", "SheetY")
  
I Python

    mydoc.RenameSheet("~", "SheetY")
  

SetArray

Stores the given value starting from a specified target cell. The updated area expands itself from the target cell or from the top-left corner of the given range to accommodate the size of the input value argument. Vectors are always expanded vertically.

The method returns a string representing the modified area as a range of cells.

Syntaks:

svc.SetArray(targetcell: str, value: any): str

Parametre:

targetcell: The cell or a range as a string from where to start to store the given value.

value: A scalar, a vector or an array (in Python, one or two-dimensional lists and tuples) with the new values to be stored from the target cell or from the top-left corner of the range if targetcell is a range. The new values must be strings, numeric values or dates. Other types will cause the corresponding cells to be emptied.

Eksempel:

I Basic

The following example uses the builtin DimArray function to create an array and then store it in cell "A1":


    Dim arrData as Variant
    arrData = DimArray(2, 1)
    arrData(0, 0) = 1 : arrData(1, 0) = 2 : arrData(2, 0) = 3
    arrData(0, 1) = "One" : arrData(1, 1) = "Two" : arrData(2, 1) = "Three"
    oDoc.SetArray("Sheet1.A1", arrData)
  

This example uses the RangeInit method of the ScriptForge Array service to create an array with values that are then stored from cell "A1" and downwards.


    'Fill 1st column with values from 1 to 1000
    oDoc.SetArray("Sheet1.A1", SF_Array.RangeInit(1, 1000))
  
I Python

    arrData = ((1, "One"), (2, "Two"), (3, "Three"))
    myDoc.SetArray("Sheet1.A1", arrData)
  

    myDoc.SetArray("Sheet1.A1", tuple(i + 1 for i in range(1000)))
  
tip

To dump the full contents of an array in a sheet, use SetArray. To dump the contents of an array only within the boundaries of the targeted range of cells, use SetValue.


SetValue

Stores the given value in the specified range. The size of the modified area is equal to the size of the target range.

The method returns a string representing the modified area as a range of cells.

Syntaks:

svc.SetValue(targetrange: str, value: any): str

Parametre:

targetrange: The range where to store the given value, as a string.

value: A scalar, a vector or an array with the new values for each cell of the range. The new values must be strings, numeric values or dates. Other types will cause the corresponding cells to be emptied.

The full range is updated and the remainder of the sheet is left unchanged. If the size of value is smaller than the size of targetrange, then the remaining cells will be emptied.

If the size of value is larger than the size of targetrange, then value is only partially copied until it fills the size of targetrange.

Vectors are expanded vertically, except if targetrange has a height of exactly 1 row.

Eksempel:

I Basic

    oDoc.SetValue("A1", 2)
    'Below the Value array is smaller than the TargetRange (remaining cells are emptied)
    oDoc.SetValue("A1:F1", Array(1, 2, 3))
    'Below the Value and TargetRange have the same size
    oDoc.SetValue("A1:D2", SF_Array.AppendRow(Array(1, 2, 3, 4), Array(5, 6, 7, 8)))
  

If you want to fill a single row with values, you can use the Offset function. In the example below, consider that arrData is a one-dimensional array:


    Dim firstCell As String : firstCell = "A1"
    Dim lenArray As Integer : lenArray = UBound(arrData) - LBound(arrData) + 1
    Dim newRange As String : newRange = oDoc.Offset(firstCell, width = lenArray)
    oDoc.SetValue(newRange, arrData)
  
I Python

    myDoc.SetValue("A1", 2)
    myDoc.SetValue("A1:F1", (1, 2, 3))
    myDoc.SetValue("A1:D2", ((1, 2, 3, 4), (5, 6, 7, 8)))
  

    firstCell = "A1"
    newRange = doc.Offset(firstCell, width = len(arrData))
    doc.SetValue(newRange, arrData)
  

SetCellStyle

Applies the specified cell style to the given target range. The full range is updated and the remainder of the sheet is left untouched. If the cell style does not exist, an error is raised.

The method returns a string representing the modified area as a range of cells.

Syntaks:

svc.SetCellStyle(targetrange: str, style: str): str

Parametre:

targetrange: The range to which the style will be applied, as a string.

style: The name of the cell style to apply.

Eksempel:

I Basic

    oDoc.SetCellStyle("A1:J1", "Heading 1")
    oDoc.SetCellStyle("A2:J100", "Neutral")
  
I Python

    myDoc.SetCellStyle("A1:J1", "Heading 1")
    myDoc.SetCellStyle("A2:J100", "Neutral")
  

SetFormula

Inserts the given (array of) formula(s) in the specified range. The size of the modified area is equal to the size of the range.

The method returns a string representing the modified area as a range of cells.

Syntaks:

svc.SetFormula(targetrange: str, formula: any): str

Parametre:

targetrange: The range to insert the formulas, as a string.

formula: A string, a vector or an array of strings with the new formulas for each cell in the target range.

The full range is updated and the remainder of the sheet is left unchanged.

If the given formula is a string, the unique formula is pasted along the whole range with adjustment of the relative references.

If the size of formula is smaller than the size of targetrange, then the remaining cells are emptied.

If the size of formula is larger than the size of targetrange, then the formulas are only partially copied until it fills the size of targetrange.

Vectors are always expanded vertically, except if targetrange has a height of exactly 1 row.

Eksempel:

I Basic

    oDoc.SetFormula("A1", "=A2")
    'Horizontal vector, partially empty
    oDoc.SetFormula("A1:F1", Array("=A2", "=B2", "=C2+10"))
    'D2 contains the formula "=H2"
    oDoc.SetFormula("A1:D2", "=E1")
  
I Python

    myDoc.SetFormula("A1", "=A2")
    myDoc.SetFormula("A1:F1", ("=A2", "=B2", "=C2+10"))
    myDoc.SetFormula("A1:D2", "=E1")
  

ShiftDown

Moves a given range of cells downwards by inserting empty rows. The current selection is not affected.

Depending on the value of the wholerows argument the inserted rows can either span the width of the specified range or span all columns in the row.

This method returns a string representing the new location of the initial range.

note

If the shifted range exceeds the sheet edges, then nothing happens.


Syntaks:

svc.ShiftDown(range: str, wholerow: bool = False, opt rows: int): str

Parametre:

range: The range above which rows will be inserted, as a string.

wholerow: If set to False (default), then the width of the inserted rows will be the same as the width of the specified range. Otherwise, the inserted row will span all columns in the sheet.

rows: The number of rows to be inserted. The default value is the height of the original range. The number of rows must be a positive number.

Eksempel:

I Basic

    ' Moves the range "A3:D3" down by one row; affects only columns A to D
    oDoc.ShiftDown("A3:D3")
    ' The inserted row spans all columns in the sheet
    oDoc.ShiftDown("A3:D3", WholeRow := True)
    ' Moves the range "A3:D3" down by five rows
    oDoc.ShiftDown("A3:D3", Rows := 5)
    ' Moves the range "A3:D10" down by two rows and shows the new location of the original range
    Dim sNewRange as String
    sNewRange = oDoc.ShiftDown("A3:D10", Rows := 2)
    MsgBox sNewRange   ' $Sheet1.$A$5:$D$12
  
I Python

    myDoc.ShiftDown("A3:D3")
    myDoc.ShiftDown("A3:D3", wholerow = True)
    myDoc.ShiftDown("A3:D3", rows = 5)
    sNewRange = myDoc.ShiftDown("A3:D10", rows = 2)
    bas = CreateScriptService("Basic")
    bas.MsgBox(sNewRange)
  

ShiftLeft

Deletes the leftmost columns of a given range and moves to the left all cells to the right of the affected range. The current selection is not affected.

Depending on the value of the wholecolumns argument the deleted columns can either span the height of the specified range or span all rows in the column.

This method returns a string representing the location of the remaining portion of the initial range. If all cells in the original range have been deleted, then an empty string is returned.

Syntaks:

svc.ShiftLeft(range: str, wholecolumn: bool = False, opt columns: int): str

Parametre:

range: The range from which cells will be deleted, as a string.

wholecolumn: If set to False (default), then the height of the deleted columns will be the same as the height of the specified range. Otherwise, the deleted columns will span all rows in the sheet.

columns: The number of columns to be deleted from the specified range. The default value is the width of the original range, which is also the maximum value of this argument.

Eksempel:

I Basic

    ' Deletes the range "B3:B6"; moves left all cells to the right
    oDoc.ShiftLeft("B3:B6")
    ' Deletes the first column in the range "A3:D6"
    oDoc.ShiftLeft("A3:D6", Columns := 1)
    ' The deleted columns (A to D) spans all rows in the sheet
    oDoc.ShiftLeft("A3:D6", WholeColumn := True)
  
I Python

    myDoc.ShiftLeft("B3:B6")
    myDoc.ShiftLeft("A3:D6", Columns = 1)
    myDoc.ShiftLeft("A3:D6", WholeColumn = True)
  

ShiftUp

Deletes the topmost rows of a given range and moves upwards all cells below the affected range. The current selection is not affected.

Depending on the value of the wholerows argument the deleted rows can either span the width of the specified range or span all columns in the row.

This method returns a string representing the location of the remaining portion of the initial range. If all cells in the original range have been deleted, then an empty string is returned.

Syntaks:

svc.ShiftUp(range: str, wholerow: bool = False, opt rows: int): str

Parametre:

range: The range from which cells will be deleted, as a string.

wholerow: If set to False (default), then the width of the deleted rows will be the same as the width of the specified range. Otherwise, the deleted row will span all columns in the sheet.

rows: The number of rows to be deleted from the specified range. The default value is the height of the original range, which is also the maximum value of this argument.

Eksempel:

I Basic

    ' Deletes the range "A3:D3"; moves all cells below it by one row up
    oDoc.ShiftUp("A3:D3")
    ' Deletes the first row in the range "A3:D6"
    oDoc.ShiftUp("A3:D6", Rows := 1)
    ' The deleted rows spans all columns in the sheet
    oDoc.ShiftUp("A3:D6", WholeRow := True)
  
I Python

    myDoc.ShiftUp("A3:D3")
    myDoc.ShiftUp("A3:D6", rows = 1)
    myDoc.ShiftUp("A3:D6", wholerow = True)
  

ShiftRight

Moves a given range of cells to the right by inserting empty columns. The current selection is not affected.

Depending on the value of the wholecolumns argument the inserted columns can either span the height of the specified range or span all rows in the column.

This method returns a string representing the new location of the initial range.

note

If the shifted range exceeds the sheet edges, then nothing happens.


Syntaks:

svc.ShiftRight(range: str, wholecolumn: bool = False, opt columns: int): str

Parametre:

range: The range which will have empty columns inserted to its left, as a string.

wholecolumn: If set to False (default), then the height of the inserted columns will be the same as the height of the specified range. Otherwise, the inserted columns will span all rows in the sheet.

columns: The number of columns to be inserted. The default value is the width of the original range.

Eksempel:

I Basic

    ' Moves the range "A3:A6" right by one column; affects only rows 3 to 6
    oDoc.ShiftRight("A3:A6")
    ' Moves the range "A3:A6" right by five columns
    oDoc.ShiftRight("A3:A6", Columns := 5)
    ' The inserted column spans all rows in the sheet
    oDoc.ShiftRight("A3:A6", WholeColumn := True)
  
I Python

    myDoc.ShiftRight("A3:A6")
    myDoc.ShiftRight("A3:A6", columns = 5)
    myDoc.ShiftRight("A3:A6", wholecolumn = True)
  

SortRange

Sorts the given range based on up to 3 columns/rows. The sorting order may vary by column/row. It returns a string representing the modified range of cells. The size of the modified area is fully determined by the size of the source area.

Syntaks:

svc.SortRange(range: str, sortkeys: any, sortorder: any = "ASC", destinationcell: str = "", containsheader: bool = False, casesensitive: bool = False, sortcolumns: bool = False): str

Parametre:

range: The range to be sorted, as a string.

sortkeys: A scalar (if 1 column/row) or an array of column/row numbers starting from 1. The maximum number of keys is 3.

sortorder: A scalar or an array of strings containing the values "ASC" (ascending), "DESC" (descending) or "" (which defaults to ascending). Each item is paired with the corresponding item in sortkeys. If the sortorder array is shorter than sortkeys, the remaining keys are sorted in ascending order.

destinationcell: The destination cell of the sorted range of cells, as a string. If a range is given, only its top-left cell is considered. By default the source Range is overwritten.

containsheader: When True, the first row/column is not sorted.

casesensitive: Only for string comparisons. Default = False

sortcolumns: When True, the columns are sorted from left to right. Default = False : rows are sorted from top to bottom.

Eksempel:

I Basic

    'Sort range based on columns A (ascending) and C (descending)
    oDoc.SortRange("A2:J200", Array(1, 3), Array("ASC", "DESC"), CaseSensitive := True)
  
I Python

    myDoc.SortRange("A2:J200", (1, 3), ("ASC", "DESC"), casesensitive = True)
  
warning

Alle ScriptForge Grunnleggende rutiner eller identifikatorer som er prefikset med et understrekingstegn "_" er reservert for intern bruk. De er ikke ment å brukes i grunnleggende makroer eller Python-skript.