Slow generation of Excel doc from Forms6

From: Álvaro Palma Aste <queria_direccion_at_el.perla.invalid>
Date: Thu, 26 Sep 2002 21:50:40 +0000 (UTC)
Message-ID: <amvvfg$mct$1_at_localhost.localdomain>



As the title says, I´ve a Forms program which create an Excel doc using OLE commands as:

PROCEDURE crear_excel IS

  application ole2.obj_type;
  workbooks   ole2.obj_type;
  workbook    ole2.obj_type;
  worksheets  ole2.obj_type;
  worksheet   ole2.obj_type;
  cell        ole2.obj_type;
  args        ole2.list_type;


  cursor Vcursor .....etc.

BEGIN
  application := ole2.create_obj('Excel.Application');   ole2.set_property(application, 'Visible', 'False');

  workbooks   := ole2.get_obj_property(application, 'Workbooks');
  workbook    := ole2.get_obj_property(workbooks,   'Add');
  worksheets  := ole2.get_obj_property(workbook, 'Worksheets');
  worksheet   := ole2.get_obj_property(worksheets,  'Add');

  row := 1;
  col := 1;

  for i in Vcursor -- Open Cursor, that returns "value" value   loop
    args := ole2.create_arglist;

    ole2.add_arg(args, row);
    ole2.add_arg(args, col);

    cell := ole2.get_obj_property(worksheet, 'Cells', args);

    ole2.destroy_arglist(args);

    ole2.set_property(cell, 'Value', i.value);

    row := row+1;
    col := col+1;
  end loop; -- Close cursor

  args := ole2.create_arglist;

  ole2.add_arg(args, 'c:\tmp\EXAMPLE.XLS');
  ole2.invoke(workbook, 'SaveAs', args);
  ole2.destroy_arglist(args);
  ole2.invoke(application, 'Quit');
  ole2.release_obj(cell);
  ole2.release_obj(worksheet);
  ole2.release_obj(worksheets);
  ole2.release_obj(workbook);
  ole2.release_obj(workbooks);
  ole2.release_obj(application);

END; But this is really slow, in fact, it hangs up for over 5.000 records (which is the average lenght of the Excel files I need to create). In my perception, this slowness can be due to the fact of create-destroy arglist in each loop of the cursor. So my question is:

Am I right in the reason of the slowness? Is there an alternative way to recicle the arglist without the need to recreate it each time? Or is just that Excel is slow by definition? :-(

Thanks a lot for your help

-- 
Atte.
Álvaro Palma Aste
Grupo de Ing. Biomédica
Depto. de Ing. Eléctrica - U. de Chile
******************************************************
It's the only form of protest they're allowed 
I've seen their silent faces scream so loud 
If they were to speak these words they'd go missing too 
Another woman on a torture table what else can they do

Sting - They Dance Alone...
Received on Thu Sep 26 2002 - 23:50:40 CEST

Original text of this message