Protect Document using Webutil [message #256062] |
Thu, 02 August 2007 21:10  |
Prasad01
Messages: 22 Registered: August 2007
|
Junior Member |
|
|
Hi,
I am trying to insert section break and protect a word document opened using Webutil.
But its not working. Here is the code:
/* Insert Section Break */
v_args:=CLIENT_OLE2.CREATE_ARGLIST;
CLIENT_OLE2.ADD_ARG(v_args,6); --Contiunous Section Break -
CLIENT_OLE2.INVOKE(:global.v_doc_word,'InsertBreak',v_args);
CLIENT_OLE2.DESTROY_ARGLIST(v_args);
/* Protect the Section */
v_args:=CLIENT_OLE2.CREATE_ARGLIST;
CLIENT_OLE2.ADD_ARG(v_args,0); -- ProtectedForForms = True -
CLIENT_OLE2.INVOKE(:global.v_doc_word,'ProtectedForForms',v_args);
CLIENT_OLE2.DESTROY_ARGLIST(v_args);
Its neither inserting a section nor protecting.
Is there something I am missing out?
Any input would be highly appreciated.
Cheers
Prasad.
|
|
|
|
|
|
Re: Protect Document using Webutil [message #256623 is a reply to message #256619] |
Mon, 06 August 2007 02:32   |
Prasad01
Messages: 22 Registered: August 2007
|
Junior Member |
|
|
I think the problem is not that, the problem is it seems that it is not getting the handle for the sections
Here is my new code:
MySections := CLIENT_OLE2.GET_OBJ_PROPERTY(active_doc,'Sections');
Sections_Count :=CLIENT_OLE2.GET_NUM_PROPERTY(MySections,'Count');
While Sections_Count > 0 Loop
v_args:=CLIENT_OLE2.CREATE_ARGLIST;
CLIENT_OLE2.ADD_ARG(v_args, Sections_count);
mysection:=CLIENT_OLE2.INVOKE_OBJ(MySections,'Item',args);
CLIENT_OLE2.DESTROY_ARGLIST(args);
--get the Index or Number of Section
section_index:=CLIENT_OLE2.GET_CHAR_PROPERTY(mysection,'Index');
If section_index = 1 then
v_args:=CLIENT_OLE2.CREATE_ARGLIST;
CLIENT_OLE2.ADD_ARG(v_args,0); -- ProtectedForForms = True -
CLIENT_OLE2.INVOKE(mysection,'ProtectedForForms',v_args);
CLIENT_OLE2.DESTROY_ARGLIST(v_args);
ElsIf section_index = 2 then
v_args:=CLIENT_OLE2.CREATE_ARGLIST;
CLIENT_OLE2.ADD_ARG(v_args,1); -- ProtectedForForms = False-
CLIENT_OLE2.INVOKE(mysection,'ProtectedForForms',v_args);
CLIENT_OLE2.DESTROY_ARGLIST(v_args);
ElsIf section_index = 3 then
v_args:=CLIENT_OLE2.CREATE_ARGLIST;
CLIENT_OLE2.ADD_ARG(v_args,0); -- ProtectedForForms = True -
CLIENT_OLE2.INVOKE(mysection,'ProtectedForForms',v_args);
CLIENT_OLE2.DESTROY_ARGLIST(v_args);
End If;
sections_Count :=sections_Count-1;
End Loop;
After this I am protecting the document, now whats happening is its only protecting the Header leaving other sections open
Upd mod: Please use 'code' tags.
[Updated on: Mon, 06 August 2007 02:43] by Moderator Report message to a moderator
|
|
|
|
|
Re: Protect Document using Webutil [message #256830 is a reply to message #256827] |
Mon, 06 August 2007 18:57   |
Prasad01
Messages: 22 Registered: August 2007
|
Junior Member |
|
|
When I put the following vb code in a macro in the document it works fine, exactly as I want
ActiveDocument.Sections(1).ProtectedForForms = True
ActiveDocument.Sections(2).ProtectedForForms = False
ActiveDocument.Sections(3).ProtectedForForms = True
But I dont want to use macros.
How can we convert this in PL/SQL
|
|
|
Re: Protect Document using Webutil [message #256894 is a reply to message #256830] |
Tue, 07 August 2007 00:59  |
 |
djmartin
Messages: 10181 Registered: March 2005 Location: Surges Bay TAS Australia
|
Senior Member Account Moderator |
|
|
The following is your code from above:BEGIN
MySections := Client_ole2.Get_obj_Property (Active_Doc, 'Sections');
Sections_Count := Client_ole2.Get_num_Property (MySections, 'Count');
WHILE Sections_Count > 0
LOOP
v_args := Client_ole2.Create_argList;
Client_ole2.Add_arg (v_args, Sections_Count);
MySection := Client_ole2.Invoke_obj (MySections, 'Item', args);
Client_ole2.Destroy_argList (args);
--get the Index or Number of Section
Section_Index := Client_ole2.Get_Char_Property (MySection, 'Index');
IF Section_Index = 1 THEN
v_args := Client_ole2.Create_argList;
Client_ole2.Add_arg (v_args, 0); -- ProtectedForForms = True -
Client_ole2.Invoke (MySection, 'ProtectedForForms', v_args);
Client_ole2.Destroy_argList (v_args);
ELSIF Section_Index = 2 THEN
v_args := Client_ole2.Create_argList;
Client_ole2.Add_arg (v_args, 1); -- ProtectedForForms = False-
Client_ole2.Invoke (MySection, 'ProtectedForForms', v_args);
Client_ole2.Destroy_argList (v_args);
ELSIF Section_Index = 3 THEN
v_args := Client_ole2.Create_argList;
Client_ole2.Add_arg (v_args, 0); -- ProtectedForForms = True -
Client_ole2.Invoke (MySection, 'ProtectedForForms', v_args);
Client_ole2.Destroy_argList (v_args);
ELSE
message('Section_index='||to_char(Section_Index);pause;
END IF;
Sections_Count := Sections_Count - 1;
END LOOP;
END; I suggest adding a 'debug message' statement to it so that you can verify that the numbering is that which you are expecting.
David
|
|
|