Home » Developer & Programmer » Forms » Positioning an image on XLS file using ole2 (Forms 6.0.8)
Positioning an image on XLS file using ole2 [message #616383] Mon, 16 June 2014 08:11 Go to next message
dallagnese
Messages: 2
Registered: June 2014
Location: Brasil
Junior Member

Hello.
I need to insert an image on a new XLS file (what I've already done), but I have to define the position where I need to place that image.
I was able to insert the image in the top left position with the following code. As I'll attach my file to an e-mail, without user interference, I need to position the image in a specific location, or even in a specific cell.

Can anyone help me?

Tks.
Daniel Dallagnese


PROCEDURE insert_image (p_filename in varchar2) IS
args ole2.List_Type;
picture ole2.obj_type;
pictures ole2.obj_type;
BEGIN
ole2.DESTROY_ARGLIST(args);
pictures := ole2.invoke_obj(worksheet,'Pictures');
args := ole2.create_arglist;
ole2.add_arg(args, p_filename);
picture := ole2.invoke_obj(pictures, 'Insert', args);
ole2.destroy_arglist(args);
END;
Re: Positioning an image on XLS file using ole2 [message #620495 is a reply to message #616383] Sun, 03 August 2014 03:43 Go to previous message
Rigthback
Messages: 1
Registered: August 2014
Location: South Africa
Junior Member
Take the parts you need.


row_count := (row_count + 1);
row_n := row_count;

if v_image_count is not null then
if v_image_count > 0 then

col_n := 7;
--ADJUST HEIGHT OF ROW TO ALLOW FOR PICTURE

args := OLE2.CREATE_ARGLIST;
OLE2.ADD_ARG(args,row_n );
row := OLE2.GET_OBJ_PROPERTY(worksheet, 'rows', args);
OLE2.SET_PROPERTY(row,'ROWHEIGHT' , 100);
OLE2.RELEASE_OBJ(row);

--GET CELL POSITION
args := ole2.create_arglist;
ole2.add_arg (args, row_n);
ole2.add_arg (args, col_n);
cell := ole2.get_obj_property (worksheet, 'Cells',args);
ole2.destroy_arglist (args);

cel_data := 100;
cel_data2 :=85;

-- GET POSITION TOP LEFT
cel_data3 := ole2.get_num_property (cell, 'Left');
cel_data4 :=ole2.get_num_property (cell, 'Top');

-- INSERT PICTURE
pictures := OLE2.INVOKE_obj(worksheet,'Pictures');
args := OLE2.CREATE_ARGLIST;
OLE2.ADD_ARG(args, v_image_file);
picture := OLE2.INVOKE_obj(pictures,'Insert',args);
OLE2.SET_PROPERTY(picture,'Height' , cel_data);
OLE2.SET_PROPERTY(picture,'Width' , cel_data2);
OLE2.SET_PROPERTY(picture,'Left' , cel_data3);
OLE2.SET_PROPERTY(picture,'Top' , cel_data4);
OLE2.DESTROY_ARGLIST(args);
OLE2.RELEASE_OBJ(picture);
OLE2.RELEASE_OBJ(cell);

end if;
end if;
Previous Topic: How to query a block based on a procedure
Next Topic: List of value to add_parameter
Goto Forum:
  


Current Time: Thu Apr 18 22:41:12 CDT 2024