OLE and Excel97
Hi everybody,
we're porting our OLEGen-erated code for Excel95 to Excel97 noticing
that with F3 the OLE library has deeeply changed. In particular, we're
getting in troubles "guessing" which settable variable must be set to
reference an arbitrary Excel cell once a Worksheet has been opened and
its default activecell (top-left corner) has been filled.
Any suggestion about how to move to another cell? Shall we address the
Application, the Workbooks or the Range virtual-attributes to achive
that?
On another way, has anyone experienced a Forte app to Office97
data-passing using ActiveX?
begin of the code
app : Application = new();
cl : Workbooks = new();
rng : Range = new();
begin
app.createUsingProgId('Excel.Application.8');// We
have to start it
cl.SetDispatchObject(app.workbooks);// link
a new workbook
app.Visible = true; // make
the application become visible
cl.open(sf.GetLocalName(TRUE,TRUE).value); // issue
an open file
exception
when e:oleexception do
app.createUsingProgId('Excel.Application.8');// We
have to start it
cl.SetDispatchObject(app.workbooks);// link
a new workbook
app.Visible = true; // make
the application become visible
cl.open(sf.GetLocalName(TRUE,TRUE).value); // issue
an open file
sheet.SetDispatchObject(app.Worksheets);// link
the worksheet ole server
sheet.Visible = Variantboolean(value = true); // make
the wokrsheet visible
end;
x : Integer ;
y : Integer;
begin
rng.setdispatchobject(app.activecell);
x = rng.column;
y = rng.row;
exception
when e:usageexception do
x = 1;
y = 1;
end;
Vstring : VariantString = new();
nattr :integer = data.Numattrs;
ColumnName : TextData = new();
fw : FieldWidget;
CWidth : integer;
for j in selectionarray do
i : integer = j.index;
if rec.GetAttr(i) <> NIL and (not j.selected) then
ColumnName = j.FieldName;
Vstringa.Value = ColumnName.Value;
// It's not possible to call Cells method because OleGen
for Office 97
// generates Cells as a read-only virtual attribute.
// The old (perfectly working!) code was:
// rng.setdispatchobject(sheet.cells(y, x));
rng.value = vstring;
if aw.isa(expressarraywindow) then
fw =
(expressarraywindow)(aw).arraywidget.FIELD.GetColumnTemplate(ColumnName)
;
else
fw = aw.window.GetFieldByName(ColumnName);
end if;
if fw <> nil and fw.IsA(DataField) then
CWidth = (DataField)(fw).VisibleColumns;
rng.columnwidth = variantinteger(value =
CWidth);
end if;
x = x + 1;
end if;
end for;
y = y + 1; // looping
end of the code
Any help is really appreciated,
thanks in advance,
Dave
__
Dott. Diemmi Ing. Davide - EMail: diemmi@dsdata.it
DS Data Systems (Italy) - Tel. +39 521 278415
Internet: <a href="http://www.dsdata.com">http://www.dsdata.com</a>

