Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » OLE - Word Basic object - CountBookmarks()
OLE - Word Basic object - CountBookmarks() [message #447874] Mon, 20 December 2004 17:54 Go to next message
Kalman Hazins is currently offline Kalman HazinsFriend
Messages: 76
Registered: July 2009
Member
I am trying to embed a Word Document into my application. I need to import a
word template that has bookmarks in it and replace those bookmarks. I
understand how to get a wordbasic object, and once I get the wordbasic
object, I do the following:

OleAutomation wordBasic = getWordBasic(site);
int[] countBookmarks = wordBasic.getIDsOfNames(new
String[]{"CountBookmarks"});

// I AM getting a value for countBookmarks[0]

// Both of the lines below throw a NullPointerException, i.e. there is no
variant being returned
//int bookmarkCnt = wordBasic.invoke(countBookmarks[0], null).getInt();
//int bookmarkCnt = wordBasic.getProperty(countBookmarks[0]).getInt();

What am I doing wrong?

Thanx,
- Kalman
Re: OLE - Word Basic object - CountBookmarks() [message #447880 is a reply to message #447874] Mon, 20 December 2004 20:15 Go to previous message
Kalman Hazins is currently offline Kalman HazinsFriend
Messages: 76
Registered: July 2009
Member
Never mind ... I figured it out - I was trying to count the bookmarks
before I did

site.doVerb (OLE.OLEIVERB_SHOW);

duh ... of course that's not gonna work ...

"Kalman" <kalman@zikal.com> wrote in message
news:cq73d7$h2l$1@www.eclipse.org...
> I am trying to embed a Word Document into my application. I need to import
a
> word template that has bookmarks in it and replace those bookmarks. I
> understand how to get a wordbasic object, and once I get the wordbasic
> object, I do the following:
>
> OleAutomation wordBasic = getWordBasic(site);
> int[] countBookmarks = wordBasic.getIDsOfNames(new
> String[]{"CountBookmarks"});
>
> // I AM getting a value for countBookmarks[0]
>
> // Both of the lines below throw a NullPointerException, i.e. there is
no
> variant being returned
> //int bookmarkCnt = wordBasic.invoke(countBookmarks[0], null).getInt();
> //int bookmarkCnt = wordBasic.getProperty(countBookmarks[0]).getInt();
>
> What am I doing wrong?
>
> Thanx,
> - Kalman
>
>
Previous Topic:Inserting into TableTree
Next Topic:Running SWTApp
Goto Forum:
  


Current Time: Thu Apr 25 12:34:08 GMT 2024

Powered by FUDForum. Page generated in 0.03567 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top