OLE MS Word formatting [message #337659] |
Thu, 31 July 2008 09:27 ![Go to next message Go to next message](/forum/theme/orafaq/images/down.png) |
rlockard
Messages: 19 Registered: April 2008 Location: Baltimore, MD
|
Junior Member |
|
|
I am trying to do some simple formatting using OLE and keep getting errors. I know this has got to be something simple and I must be over looking something.
So step one:
Set a heading to bold
pkg_report.section_label('Projects: ');
pkg_report.add_txt(proj_rec.name || c.tab ||
'Status: ' || v_status);
The add_txt portion works. However; section_label does not work.
Oh, another thing; I would also prefer that I can keep the label on the same line with the text to follow.
Here is what I have so far.
PACKAGE pkg_report IS
/*
globals
*/
app client_ole2.obj_type; --application
doc client_ole2.obj_type; --document
docs client_ole2.obj_type; --document collection
par client_ole2.obj_type; --paragraph
pars client_ole2.obj_type; --paragraph collection
selection client_ole2.obj_type; --selection
rng client_ole2.obj_type; --range
args client_ole2.list_type;
procedure init_word;
procedure add_header(pTxt in varchar2);
procedure add_txt(pTxt in varchar2);
procedure add_table(pNumColumns in number,
pNumRows in number,
pQuery in varchar2);
procedure section_label(pTxt in varchar2);
END;
PACKAGE BODY pkg_report IS
procedure init_word is
begin
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');
end;
/*fixme put some text in the word header section.*/
procedure add_header(pTxt in varchar2) is
begin
null;
end;
procedure add_txt(pTxt in varchar2) is
v_args client_ole2.LIST_TYPE;
begin
v_args := client_ole2.CREATE_ARGLIST;
client_ole2.ADD_ARG(v_args, pTxt);
client_ole2.INVOKE(selection, 'TypeText', v_args);
client_ole2.DESTROY_ARGLIST(v_args);
client_ole2.INVOKE(selection, 'TypeParagraph');
exception when others then
message('pkg_report.add_txt ' || pTxt);
raise form_trigger_failure;
end;
/*fixme bold the text.*/
procedure section_label(pTxt in varchar2) is
begin
args := client_ole2.create_arglist;
client_ole2.add_arg(args, 1);
client_ole2.set_property(selection, 'bold', true);
client_ole2.set_property(selection, 'text', pTxt);
null;
end;
/*fixme add a table to the document*/
procedure add_table(pNumColumns in number,
pNumRows in number,
pQuery in varchar2) is
begin
null;
end;
END;
|
|
|
|