Wie kann ich Sammlungen mit der Excel-COM-Schnittstelle von visuellen Arbeiten verwenden

StackOverflow https://stackoverflow.com/questions/4670136

  •  10-10-2019
  •  | 
  •  

Frage

Mit der Excel-COM-Automatisierungsschnittstelle I-Wert in einer Zelle, indem Sie festlegen kann:

excel := COMDispatchDriver createObject: 'Excel.Application'.
excel getWorkbooks Add. 
excel setVisible: true.
(excel getRange: 'A1') setValue: 100

Gibt es eine Weise, die ich dies mit einer Sammlung tun, so etwas wie:

excel := COMDispatchDriver createObject: 'Excel.Application'.
excel getWorkbooks Add. 
excel setVisible: true.
(excel getRange: 'A1:A4') setValue: #(1 2 3 4)
War es hilfreich?

Lösung

ExcelApplicationController

| cont |
cont := (Examples.Excel97ApplicationController new).
[
  cont addWorkbook.
  cont isVisible: true.

  "Insert the title of our report."
  cont caption: 'First Quarter Results'.

  cont setRange: 'B5:E9'
     to: #( #( 10 20 30 40 ) #( 1 2 3 4 ) #( 101 201 301 401) #( 102 203 305 407 ) ).


] ensure:[
  cont notNil
        ifTrue: [
            cont release.
            cont := nil ]
]
Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top