Add Bookmark using Webutil [message #257723] |
Thu, 09 August 2007 01:35 ![Go to next message Go to next message](/forum/theme/orafaq/images/down.png) |
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 #259275 is a reply to message #259269] |
Tue, 14 August 2007 22:50 ![Go to previous message Go to previous message](/forum/theme/orafaq/images/up.png) ![Go to next message Go to next message](/forum/theme/orafaq/images/down.png) |
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.
|
|
|
|
|
|
|
|