ビジュアルワークスのExcel COMインターフェイスでコレクションを使用するにはどうすればよいですか

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

  •  10-10-2019
  •  | 
  •  

質問

Excel com Automationインターフェイスを使用して、次のことでセルで値を設定できます。

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

コレクションでこれを行う方法はありますか?

excel := COMDispatchDriver createObject: 'Excel.Application'.
excel getWorkbooks Add. 
excel setVisible: true.
(excel getRange: 'A1:A4') setValue: #(1 2 3 4)
役に立ちましたか?

解決

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 ]
]
ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top