Henry Rich wrote:
> I can bring up the tables\excel addon and read blocks of cells.
>
> Now I want to set the value of a cell or block of cells.
>
> Can anyone show me how to do this, or point to some reference that
> discusses what the OLE commands to Excel are?
>
> I tried
>
> wd 'oleinfo xl;'
>
> xl is the name of the child control created by tables\excel: the sequence is
>
> wd 'cc xl oleautomation:excel.application'
> T__ =: wd 'oleinfo xl;'
>
> but it fails, giving
>
> wd 'qer'
> bad child class : 0
>
> Is oleinfo still supported?
>
> I just can't find any way to get started writing a cell.
>
> Henry Rich
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
>
Here is a fragment I have used for years. Pardon the loops.
require 'system\examples\ole\excel\xlutil.ijs'
foo=. ('Path';'Files';'Bytes';'1st Date';'End Date'), foo\: 2{"1 foo
xlopen ''
xlcmd 'wb add'
xlget 'temp worksheets'
xlid 'ws'
xlget 'ws item sheet1'
xlid 'sh1'
for_i. i.{.$foo do.
for_j. i.{:$foo do.
xlget 'sh1 cells ',": 1+i,j
dat=. >j{i{foo
if. (j>2)*(i>0) do.
dat=.xldatefmt dat
end.
qt=. (2=(3!:0)dat){' "'
if. 0<#dat do.
xlset 'temp value ',qt,(":dat),qt
if. (j=0)*(i>0) do.
xlcmd 'temp activate'
if. ':'={:dat do. dat=.dat,'\' end.
xlwritel '"file://',(":dat),'"'
end.
end.
end.
end.
xlget 'sh1 columns b:c '
xlset 'temp NumberFormat "#,##0"'
xlget 'sh1 columns a:e '
xlcmd 'temp activate'
xlcmd 'temp autofit'
jdir=. '_' ((jdir=':')#i.$jdir)}jdir
jdir=. ('.' ((jdir='\')#i.$jdir)}jdir),'>',(":limit)
xlset 'sh1 name "',((-31<.$jdir){.jdir),'"'
xlget 'sh1 cells ',": 1 1
xlcmd 'temp activate'
xlshow 1
--
cheers,
David Mitchell
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm