Zellen, Wert und Formel

Von Jürgen Schell. | 9 April, 2008 - 08:39
Beschreibung:

Die wichtigsten Eigenschaften einer Zelle sind ihr value und ihre formula.

tell application "RagTime 6.5"
     tell column 1 of table 1 of document 1
          set value of cell 1 to "abc"
          set value of cell 2 to 250.052
     end tell
end tell

trägt in die Zelle A1 den Text “abc� ein, in Zelle A2 die Zahl 250,052

Folgendes Script erzeugt in zwei Zellen dieselbe Formel, aber mit einer unterschiedlichen Technik:

tell application "RagTime 6.5"
     tell column 1 of table 1 of document 1
          set formula of cell 1 to "Summe(B:B)"
          set sylk formula of cell 2 to "SUM(C[1]:C[1])"
     end tell
end tell

Sowohl in Zelle A1 als auch A2 wird die Formel “Summe(B:B)� eingetragen. Der Unterschied ist: Variante 1 funktioniert nur mit einem deutsch-sprachigen RagTime, Variante 2 mit allen Sprachen. SYLK-Formeln sind unabhängig von der Sprache normiert. Wie bekommen Sie die Syntax für eine SYLK-Formel heraus? Einfach mit einem Script. Installieren Sie sich folgendes Hilfsscript in RagTime:

-- Hilfsscript für SYLK-Syntax
tell application "RagTime 6.5"
     set dieSYLKFormel to (sylk formula of selection) as text
end tell
set the clipboard to dieSYLKFormel

Wählen Sie eine Zelle mit einer Formel aus und rufen das Script auf. Die Formal steht danach in der SYLK-Syntax in der Zwischenablage und kann in einem Script eingesetzt werden.