Re: Newbie: Accessing an Excel worksheet from a Collection

Morten Andersen <[email protected]>
Newsgroups gmane.comp.windows.devel.jawin
Organization Arosii Information Systems A/S
Message-ID <[email protected]>
Hi Keith

A few, hopefully clarifying, comments to the get(), getN(), invoke()
questions (I am sorry I can't help with the Excel stuff - depending on
what you are using Excel for, have you considered looking at POI
http://jakarta.apache.org/poi/).

Keith McAlpine wrote:
[SNIP]
>
> Is there somewhere that clarifies the usage of the get, getObject, invoke
> and getN methods? I had thought that, given a DispatchPtr object:
>
> get() was for retrieving a property from it that was a primitive type;

Or any other type - after retrieval the caller has to know the returned
type and cast it correctly. Eg. to retrieve a int property:

int prop = ((Integer)dispatchPtr.get("someProperty")).intValue();

> getObject()  was for retrieving a property from it that was another
> DispatchPtr;

Correct it was implemented as:
        return (DispatchPtr) get(prop);

So the method getObject() has been removed from the coming 2.x branch of
Jawin as all get()-values should be cast correctly afterwards, so I
didn't think there was any reason in supplying a special method for
DispatchPtr (especially not since it had a misleading name).

> invoke() was for invoking a method call on the object.

Correct.

And finally getN() is just the general get() for usage for properties
taking additional "indexes" to identify the exact property. Eg. one
could imagine retrieving a value of a single cell in a spreadsheet,
where two "indexes" (row and column) are needed for identifying the
cell. (I don't know if it is this way in Excel, it is just an example).

I have recently added javadoc for these methods, and some additional
documentation about dispatch interfaces in Jawin to the file
docs/jawinuserguide_dispatch.html in the most recent CVS-version.

If you want, feel free to check this out of CVS by following the
guidelines at http://jawinproject.sourceforge.net/jawindeveloper.html,
but please notice that your existing code will probably not compile
without a few changes (mostly due to the removal of the
getObject()-method, but a lot of other refactorings have also been taken
place, please see the list in docs/jawinrevisions.html).

I am right now putting a last hand on the above mentioned javadoc and
documentation, so when I hopefully check it into CVS in a few hours, it
will be available on the public CVS-server in approximately 5 hours.

Hope this answers some of your questions
Best Regards
Morten
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.