开发者

How can I use collections with the excel com interface from visual works

开发者 https://www.devze.com 2023-02-04 08:41 出处:网络
Using the Excel COM automation interface I can set value in a cell 开发者_高级运维by doing: excel := COMDispatchDriver createObject: \'Excel.Application\'.

Using the Excel COM automation interface I can set value in a cell 开发者_高级运维by doing:

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

Is there a way I can do this with a collection, something like:

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 ]
]
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号