Home » Developer & Programmer » Forms » OLE MS Word formatting (Developer 10g+webutil)
OLE MS Word formatting [message #337659] Thu, 31 July 2008 09:27 Go to next message
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;


Re: OLE MS Word formatting [message #339583 is a reply to message #337659] Thu, 07 August 2008 21:12 Go to previous message
djmartin
Messages: 10181
Registered: March 2005
Location: Surges Bay TAS Australia
Senior Member
Account Moderator
I can only suggest searching this forum for 'create_obj' and see what everyone else has done.

David
Previous Topic: how to create pdf file from d2k report 6i
Next Topic: Webutil and Form6i
Goto Forum:
  


Current Time: Fri Sep 27 14:20:07 CDT 2024