How to set font to the word document [message #423194] |
Tue, 22 September 2009 10:48 |
bsingam
Messages: 7 Registered: March 2009
|
Junior Member |
|
|
Hello all,
I'm tring to copy the text from notepad to the word document .I want to change the font of the copied text in the word document.
Below is the following code
DECLARE
app CLIENT_OLE2.OBJ_TYPE;
docs CLIENT_OLE2.OBJ_TYPE;
doc CLIENT_OLE2.OBJ_TYPE;
selection CLIENT_OLE2.OBJ_TYPE;
hfont CLIENT_OLE2.OBJ_TYPE;
v_bor CLIENT_OLE2.OBJ_TYPE;
args CLIENT_OLE2.LIST_TYPE;
fname varchar2(200) := null;
num number;
BEGIN
-- create a new document
app := CLIENT_OLE2.CREATE_OBJ('Word.Application');
CLIENT_OLE2.SET_PROPERTY(app, 'Visible', 1);
docs := CLIENT_OLE2.GET_OBJ_PROPERTY(app, 'Documents');
doc := CLIENT_OLE2.INVOKE_OBJ(docs, 'add');
selection := CLIENT_OLE2.GET_OBJ_PROPERTY(app, 'Selection');
---header
args := client_ole2.create_arglist;
client_ole2.add_arg (args,'c:\hqsecy.doc');
selection := CLIENT_OLE2.GET_OBJ_PROPERTY(app, 'Selection');
client_ole2.invoke( selection, 'InsertFile', args);
client_ole2.destroy_arglist (args);
----change the font of copied text file---
V_Bor := client_ole2.GET_OBJ_PROPERTY( selection, 'font');
client_ole2.set_property(v_bor, 'Name' , 'Times New Roman');
client_ole2.set_PROPERTY( V_Bor,'Size',15);
args := client_ole2.create_arglist;
client_ole2.add_arg (args,'c:\response.txt');
client_ole2.invoke( selection, 'TypeText', args);
client_ole2.destroy_arglist (args);
args := client_ole2.create_arglist;
client_ole2.add_arg (args,'c:\footnote.doc');
client_ole2.invoke( selection, 'InsertFile', args);
client_ole2.destroy_arglist (args);
-- save document as example.tmp
args := CLIENT_OLE2.CREATE_ARGLIST;
CLIENT_OLE2.ADD_ARG(args, 'c:\text.txt');
-- CLIENT_OLE2.INVOKE(hfont, 'SaveAs', args);
CLIENT_OLE2.INVOKE(doc, 'SaveAs', args);
CLIENT_OLE2.DESTROY_ARGLIST(args);
CLIENT_OLE2.RELEASE_OBJ(selection);
CLIENT_OLE2.RELEASE_OBJ(doc);
CLIENT_OLE2.RELEASE_OBJ(docs);
-- exit MSWord
CLIENT_OLE2.INVOKE(app,'Quit');
END;
Please help me out.
Thanks,
Bhavana
|
|
|
Re: How to set font to the word document [message #423426 is a reply to message #423194] |
Thu, 24 September 2009 02:28 |
|
djmartin
Messages: 10181 Registered: March 2005 Location: Surges Bay TAS Australia
|
Senior Member Account Moderator |
|
|
Please use 'code' tags.
Search this forum 'client_ole', I expect someone has done it.
For MS-Word facilities search an MS-Word forum or the Word help system.
David
|
|
|