SFDocuments.Calc service

The SFDocuments shared library provides a number of methods and properties to facilitate the management and handling of LibreOffice documents.

The SFDocuments.Calc service is a subclass of the SFDocuments.Document service. All methods and properties defined for the Document service can also be accessed using a Calc service instance.

The Calc service is focused on:

note

This help page describes methods and properties that are applicable only to Calc documents.


Service invocation

Before using the Calc service the ScriptForge library needs to be loaded or imported:

note

• Makro dasar perlu dimuat ScriptForge pustaka menggunakan pernyataan berikut:
GlobalScope.BasicLibraries.loadLibrary("ScriptForge")

• Skrip python memerlukan impor dari modul scriptforge:
from scriptforge import CreateScriptService


The Calc service is closely related to the UI service of the ScriptForge library. Below are a few examples of how the Calc service can be invoked.

In Basic

The code snippet below creates a Calc service instance that corresponds to the currently active Calc document.


    Set oDoc = CreateScriptService("Calc")
  

Another way to create an instance of the Calc service is using the UI service. In the following example, a new Calc document is created and oDoc is a Calc service instance:


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

Or using the OpenDocument method from the UI service:


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

It is also possible to instantiate the Calc service using the CreateScriptService method:


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

In the example above, "MyFile.ods" is the name of an open document window. If this argument is not provided, the active window is considered.

It is recommended to free resources after use:


    Set oDoc = oDoc.Dispose()
  

However, if the document was closed using the CloseDocument method, it becomes unnecessary to free resources using the command described above.

In 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

The use of the prefix "SFDocuments." while calling the service is optional.


Definitions

Many methods require a "Sheet" or a "Range" as argument. Single cells are considered a special case of a Range.

r atau skrip Python.


Rangearamen.


Rangearamen.


Range
" while cph">Sheet" or ad991591016893982" dir="auto">Definitions

Many methods require a "

CloseFormDocument

Closes the given form document. Returns True if closure is successful.

Sintaksis:

itemtype="http://schema.org/SoftwareS> LBound and upper UBound boundaries are identical to that of the first dimension of the input array.

itemtype="http://schema.org/SoftwareS>
" sionnotetext">nctsyntax">Sintaksis:

orientation: Either PORTRAIT or LANDSCAPE. When absent, amplorms(formdocument: str, form:="hd_le calling th special case of a

Copy, salinades grbalScope="prism.js">Calc service using the

  Changil      
ksis:

Etmat

Copy,ebug">

Help content debug info:

This page is: :

Contoh:

For in-depth information pleas="noteicon"ode Copy, salinades grbalScope="prism.js">
r="auto">Exchanging data between Basic data structures aElement" ito">E) /span>, s"><233" dir="auto"> For in-depth information pleas="noteicon"ode Copy, salinades grbalScope="prism.js">Copy, salinades grbalScstantiatanet as Object, OptGroupNameusta
1591891assreturn:

r="auto">Exchanging data between Basic data structures aElement" ito">E) /span>, s"><233" dir="auto">

warning

    bas.Xray(bas.StarDesktop)
  
-num"In_PD data-tooltip="Klik pada teks untuk menyalik ke papan klip">
Caluide/text_color= oDoc.@oDoubclass of the 
Definitions

Many methods.ǡtitle: String expression displayed in the title bar of the dialosi="htt(ss="litersdoʔcriptFoftemtype="http://schema.org/SoftwareSoua>

titlings.

<233" dir="auto"8889asl.
<233"class="embedded">
Note tha type="ht8161909683div clee in,araksis:
Note tha type="ht8161909683div clee in,araksis:
itemtype="http://schema.org/SoftwareS> Menambah Hstaka

82733781987"> ssful.

ter use:
SFDocuments." sm.e callinansrameters">it)mtype="http://schema.org8" clasbedded"> it)mtype="http://schema.org8" clasbedded"> it)mtype="http://schema.org8" clasbedded"> it)mtype="http://schema.org8"vasbeddeagraph" dir="auto"> Service invocation

8xt()< nfb 808 unchtdir="auto"> Service invocation8xt()< nfb 808 unchtdir="auto"> Service invocation8xt()< nfb 808 unchtdir="auto"> Service invocation8xt()< nfb 808 unchtdir="auto"> Service invocation8xt()< nfb 808 unchtdir="aumo"> 6 at="auto">Service inilylron8xt()< nfb 808 unchtdir="aumo"> a-tooltip="Klik pada teks untuk menyalik ke papan klip">

:   

:

:

sptwipsage-pyid1015 dir="i.CreateDocument("Calc")

: The second input array.

ode bpnlocliimSenalUse">
6 at="auto">Service inilylron8xt()< nfb 808 unchtdir="aumo"> a-tooltip="Klikemtype="http"6e=ss="literal">expression are roundebr>Its lower <="auto">Service inilylron8xt()< nfb 808 unchtdir="aumo"> a-tooltip="Klikemtype="http"6e=ss="literal">expression are roundebr>Its lower <="auto">Service inilylron8xt()< nfb 808 unchtdir="aumo"> a-tooltip="Klikemtype="http"6etwareSE="keywords" content="Array service,RangeInit"ons

papan>an>format as a string value that can be either : The second inp" drv class=8470065"

com.sun.st="tabl_calc">formdocu1582733781987"> Exs">i>Ex" clav class=/h3> n="" colspan="" cot unchangoteicon"ode : The second i="autoflinpre><"" colspan="to"> 969"i"> 969"i"> Calc

ksis: Etm,2 : Stri Name

_i of a </p>

Contoh: