Home » Developer & Programmer » Forms » Add Bookmark using Webutil
Add Bookmark using Webutil [message #257723] Thu, 09 August 2007 01:35 Go to next message
Prasad01
Messages: 22
Registered: August 2007
Junior Member
Hi All,
I want to add a bookmark with a range and insert text into it
I can add the normal bookmark which looks like: I
But I want add a bookmark which looks like:[]
In word you can add by
Dim BMRange As Range
'Identify current Bookmark range and insert text
Set BMRange = ActiveDocument.Bookmarks("MyBookmark").Range
BMRange.Text = "Hello world"
'Re-insert the bookmark
ActiveDocument.Bookmarks.Add "MyBookmark", BMRange

Using Webutil here is my code
hRange := WORD.GOTO_BOOKMARK (v_doc, 'My_Bookmark');
client_ole2.SET_PROPERTY( hRange, 'Text', 'Hello World');
-- Since the above statement deletes the bookmark, we need to add it again
v_args:=CLIENT_OLE2.CREATE_ARGLIST;
CLIENT_ole2.add_arg(v_args, 'My_Bookmark');
MyBookMarks := CLIENT_OLE2.GET_OBJ_PROPERTY(v_doc,'Bookmarks');
CLIENT_OLE2.INVOKE(MyBookMarks,'Add',v_args);
CLIENT_OLE2.DESTROY_ARGLIST(v_args);

The output for above code is:
IHello World
But I want to have
[Hello World]

Cheers
Prasad
Re: Add Bookmark using Webutil [message #259254 is a reply to message #257723] Tue, 14 August 2007 20:03 Go to previous messageGo to next message
djmartin
Messages: 10181
Registered: March 2005
Location: Surges Bay TAS Australia
Senior Member
Account Moderator
Please post an 8-bit image of the bookmark with an 'I' and another image with the bookmark, manually created, with '[]'.

David
Re: Add Bookmark using Webutil [message #259257 is a reply to message #259254] Tue, 14 August 2007 21:14 Go to previous messageGo to next message
Prasad01
Messages: 22
Registered: August 2007
Junior Member
Here are the bookmark images.
Can I ask you, why would you need the images??
/forum/fa/2886/0/
  • Attachment: Bookark.JPG
    (Size: 0.78KB, Downloaded 1414 times)
Re: Add Bookmark using Webutil [message #259258 is a reply to message #257723] Tue, 14 August 2007 21:15 Go to previous messageGo to next message
Prasad01
Messages: 22
Registered: August 2007
Junior Member
Here are the bookmark images.
Can I ask you, why would you need the images??
/forum/fa/2887/0/
Re: Add Bookmark using Webutil [message #259259 is a reply to message #259258] Tue, 14 August 2007 21:19 Go to previous messageGo to next message
djmartin
Messages: 10181
Registered: March 2005
Location: Surges Bay TAS Australia
Senior Member
Account Moderator
Because I can't make them appear in my copy of Word. Please take the image of a Word document with these bookmark images, I need to see their context.

David
Re: Add Bookmark using Webutil [message #259261 is a reply to message #257723] Tue, 14 August 2007 21:26 Go to previous messageGo to next message
Prasad01
Messages: 22
Registered: August 2007
Junior Member
Please find the image you requested.
Also did you try word setting 'Show Bookmarks' as Yes?
/forum/fa/2888/0/
Re: Add Bookmark using Webutil [message #259269 is a reply to message #259261] Tue, 14 August 2007 22:25 Go to previous messageGo to next message
djmartin
Messages: 10181
Registered: March 2005
Location: Surges Bay TAS Australia
Senior Member
Account Moderator
Okay. '][' is a bookmark without text and '[xx]' is a bookmark with text.

So what we have to do is work out how to 'highlight'/'select' some text before we do the bookmark thing.

Any ideas?

David
Re: Add Bookmark using Webutil [message #259275 is a reply to message #259269] Tue, 14 August 2007 22:50 Go to previous messageGo to next message
Prasad01
Messages: 22
Registered: August 2007
Junior Member
yes you are right, but no need to highlight or select text, because I am creating bookmark with the text, if you look at my pl/sql code.
In word you select a bookmark and insert a bookmark to get bookmark with a range.
in vba we can achieve this by
Dim BMRange As Range
'Identify current Bookmark range and insert text
Set BMRange = ActiveDocument.Bookmarks("MyBookmark").Range
BMRange.Text = "Hello world"
'Re-insert the bookmark
ActiveDocument.Bookmarks.Add "MyBookmark", BMRange

So we have to insert a bookmark with a range(BMrange in above example)

so in pl/sql we somehow have to be able to pass the range as an argument.
Using Webutil here is my pl/sql code
hRange := WORD.GOTO_BOOKMARK (v_doc, 'My_Bookmark');
client_ole2.SET_PROPERTY( hRange, 'Text', 'Hello World');
-- Since the above statement deletes the bookmark, we need to add it again
v_args:=CLIENT_OLE2.CREATE_ARGLIST;
CLIENT_ole2.add_arg(v_args, 'My_Bookmark');
MyBookMarks := CLIENT_OLE2.GET_OBJ_PROPERTY(v_doc,'Bookmarks');
CLIENT_OLE2.INVOKE(MyBookMarks,'Add',v_args);
CLIENT_OLE2.DESTROY_ARGLIST(v_args);

I am not sure how and where to pass this range when creating a bookmark.
Re: Add Bookmark using Webutil [message #259317 is a reply to message #259275] Wed, 15 August 2007 00:37 Go to previous messageGo to next message
djmartin
Messages: 10181
Registered: March 2005
Location: Surges Bay TAS Australia
Senior Member
Account Moderator
Do you have an online reference to the various Word commands?

David
Re: Add Bookmark using Webutil [message #259323 is a reply to message #259317] Wed, 15 August 2007 01:03 Go to previous messageGo to next message
Prasad01
Messages: 22
Registered: August 2007
Junior Member
No, I just launch MS Word then press Alt+F11 to lauch VB editor and then type keywords.
Re: Add Bookmark using Webutil [message #259328 is a reply to message #259323] Wed, 15 August 2007 01:21 Go to previous messageGo to next message
djmartin
Messages: 10181
Registered: March 2005
Location: Surges Bay TAS Australia
Senior Member
Account Moderator
Okay, there is an argument list to which one argument has been added. Now we just have to find another argument.

David
Re: Add Bookmark using Webutil [message #259333 is a reply to message #259328] Wed, 15 August 2007 01:28 Go to previous messageGo to next message
djmartin
Messages: 10181
Registered: March 2005
Location: Surges Bay TAS Australia
Senior Member
Account Moderator
Have a look at http://www.oraclefans.com/forums/viewtopic.php?p=5273&sid=338797bd47c1133f58db4cf28711e18b where 'invoke_obj' seems to have been used instead of 'GET_OBJ_PROPERTY'.

David
Re: Add Bookmark using Webutil [message #259334 is a reply to message #259333] Wed, 15 August 2007 01:31 Go to previous message
djmartin
Messages: 10181
Registered: March 2005
Location: Surges Bay TAS Australia
Senior Member
Account Moderator
Also have a look at http://www.orafaq.com/forum/t/32526/2/ and search for 'OLE2.set_property(bookmark,'Range',val);'

David
Previous Topic: TNSListener
Next Topic: forms upgrade problem:text line-height in forms 10g
Goto Forum:
  


Current Time: Fri Sep 27 04:16:46 CDT 2024