Skip to Main Content

Oracle Forms

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Forms10g Java OLE Integration - Word bookmarks

John RobertsAug 24 2009 — edited Aug 27 2009
Hi all,

I'm converting a Forms6i C/S OLE procedure library to use a JavaBean in Forms10g rather than webutil client_ole2.

I've been working through the [Client Side OLE Integration|http://www.oracle.com/technology/products/forms/pdf/ClientSideOLE.pdf] document as an example and it's working OK. The example opens a new Word document, prints "Hello", saves it. All simple stuff.

I'm now adding to the Bean to open an existing Word document, insert text at various bookmarks, print the document and then quit word without saving changes. It's all working OK so far, except for navigating to Word bookmarks.

I get the following error on the Java console:

oracle.forms.demos.ole.MSWordBean com.jacob.com.ComFailException: Invoke of: GoTo
Source: Microsoft Word
Description: Bad parameter

This is the bit of PLL that I started with:

PROCEDURE prt$word_bookmark (p_bookmark IN VARCHAR2)
IS
BEGIN
-- VBA Syntax: Selection.Goto(What, Which, Count, Name)
-- Which and Count are optional and are specified only because the values
-- of the parameters are position dependent.
--
-- What => constant 'wdGoToBookmark' = -1
-- Which => 0
-- Count => 0
-- Name => bookmark name

prt$global.g_args := client_ole2.create_arglist;
client_ole2.add_arg (prt$global.g_args, -1);
client_ole2.add_arg (prt$global.g_args, 0);
client_ole2.add_arg (prt$global.g_args, 0);
client_ole2.add_arg (prt$global.g_args, p_bookmark);
client_ole2.invoke (prt$global.g_myselec,'GoTo',prt$global.g_args);
client_ole2.destroy_arglist (prt$global.g_args);
END;

and this is the bit of JavaBean:

public void GoToBookmark(String bookmark)
{
Dispatch.call(document,"GoTo",bookmark);
}

From the error log, I've obviously messed up the parameter passing, but I don't know how to fix it. This is my first ever JavaBean (and first use of JDeveloper) , so I've learnt some new stuff today.

Can someone point me in the right direction.

Thanks

John
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Sep 24 2009
Added on Aug 24 2009
1 comment
1,008 views