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>

[3256 byte] By [709320] at [2007-11-25 5:00:59]
# 1

> De: Diemmi Davide <diemmi@dsdata.it>

> A: 'kamranamin@yahoo.com' <forte-users@Sagesoln.com>

> CC: Sidoli Paolo <sidoli@dsdata.it>; Vezzani Gabriella

<vezzani@dsdata.it>

> Asunto: OLE and Excel97

> Fecha: jueves 27 de noviembre de 1997 17:58

>

> 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?

>

> [deleted]

>

May be the following can help you, although we only have been successful in

communicating with Excel 5.0. The same program did not work with Excel97.

For accesing an arbitrary cell we use:

-- This inserts a string named etiqueta into cell A2

Range.SetDispatchObject (Worksheet2.Cells (VariantI2 (value = 2, mechanism=

VARIANT_INOUT),VariantString(value='A',mechanism=VARIANT_INOUT)));

Range.Value = VariantString (value=etiqueta);

Regards,

Jesus Zamarreno

EAM Sistemas Informáticos S.L.

C/ Padre Llanos, 33 47014 Valladolid

Tlf.: +34 83 352922 Fax: +34 83 352115

e-mail: open@eam.es

709320 at 2007-6-29 9:20:00 > top of Java-index,Application & Integration Servers,Integration Servers...