Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo

Close

#4 Word selection issue

open
nobody
None
5
2004-09-22
2004-09-22
Anonymous
No

Hi Philippe,

the problem is that I have no idea how to create a
selection-object!
Each time I get a JCom-Exception.

Here is the code where I tried to create a
selection-object:

First trial/ test:
IDispatch wordselection = (IDispatch)
wdDocument.get("Selection");

Second trial/ test:
IDispatch wordContent1 = (IDispatch)
wdDocument.get("Content");
IDispatch wordselection = (IDispatch)
wordContent1.get("Selection");

Third trial/ test:
IDispatch wdSelections =
(IDispatch)wdApp.get("Selection");

But I always get a JCom Exception!!!!!!
Where is the error??

---------------------------------------------------------------------------------------------------------------

And when I should have the selection-object, can I do
the EndKey-Method?
like this?

Object[] macroEndKey = ;
macroEndKey = new Object[1];
macroEndKey[0]= 8;
wordselection.method("run", makroEndKey);
_________________________________________________________________

And can I use the InsertFile-Methode in a
selection-Object to insert several documents in the
first document??????
like this?

Object[] insertArray1 = new Object[]{
hilf, // name of the next document
new String(""),
new Boolean(false),
new Boolean(false),
new Boolean(false),
};*/
wordselection.method("run",insertArray1);

Discussion