on 12-11-2008 4:52 PM
Hi,
there is a ms word file in local computer, i want to set password to that file and save again.
we are creating ms word file with ole with following codes;
*-- create word file
DATA: gs_word TYPE ole2_object ,
gs_documents TYPE ole2_object ,
gs_newdoc TYPE ole2_object ,
gs_selection TYPE ole2_object ,
gs_application TYPE ole2_object ,
gs_actdoc TYPE ole2_object .
CREATE OBJECT gs_word 'WORD.APPLICATION' .
IF sy-subrc NE 0 .
MESSAGE s000(su) WITH 'Error while creating OLE object!'.
LEAVE PROGRAM .
ENDIF .
SET PROPERTY OF gs_word 'Visible' = '0' .
CALL METHOD OF gs_word 'Documents' = gs_documents.
CALL METHOD OF gs_documents 'Add' = gs_newdoc.
call method of gs_newdoc 'Activate' = gs_actdoc.
CALL METHOD OF gs_word 'ActiveDocument' = gs_actdoc .
GET PROPERTY OF gs_actdoc 'Application' = gs_application .
GET PROPERTY OF gs_word 'Selection' = gs_selection.
CALL METHOD OF gs_actdoc 'SaveAs'
EXPORTING
#1 = p_file "'C:\file.doc' "filename
#2 = 1 "fileFormat
#3 = 0 "LockComments
#4 = sy-uname "password to open a workbook
#5 = 0 "AddToRecentFiles
#6 = sy-uname. "password for write access
*CALL METHOD OF gs_actdoc 'PrintOut' .
CALL METHOD OF gs_word 'Quit' .
FREE: gs_word, gs_actdoc, gs_documents , gs_newdoc .
*--
this code is creating a blank file that has been in pc and hadn't been a blank file but has a password.
i think it happens with this code ;
CALL METHOD OF gs_documents 'Add' = gs_newdoc.
is there another method instead of 'Add'? or how can i set password to ms word file that has been in pc?
Thanks.
wrong thread
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Is this question Web Dynpro ABAP related? I don't see anything pertaining to Web Dynpro ABAP here. The OLE interface you are using is dependent upon the SAPGUI and wouldn't work within Web Dynpro ABAP. Please make sure that you have posted this to the correct forum.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
87 | |
10 | |
10 | |
9 | |
7 | |
7 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.