Link to home
Start Free TrialLog in
Avatar of rehman123
rehman123

asked on

HOW TO COMMENT EXCEL CELL PROGRAMETICALLY USING ole2.set_property cell

I am trying to comments excel cell programmatically  using forms 6i ole2.set_property.  if some one have idea how to comment excel cell programmatically  using  ole2.set_property cell or any other method plz mail me at salam_1977@hotmail.com
Avatar of rehman123
rehman123

ASKER

please answer  me if someone have any idea about how to insert comments in excel cell programmatically using ole.set_property
abdus.salam@sevenseasgroup.com
Hi rehman123,

I just noticed that noone ever responded to you. I'd be happy to help if you're still interested. Let's start with some code that pviaene posted five years ago. : )

v_object     OLE2.OBJ_TYPE

v_object :=OLE2.CREATE_OBJ('Excel.application.5');
OLE2.set_property(v_object ,'row',4);
OLE2.set_property(v_object,'column',2);
OLE2.set_property(v_object,'insert','This is a test');
OLE2.RELEASE_OBJ(v_object)

https://www.experts-exchange.com/questions/10075134/ole-in-forms4-5.html

Please let me know if I may be of further assistance.
first of all i would like to thank yoy for responding regarding my question but i think something wrong so let me explain what actually i want to do. see i am fetching data into excel file (generating) from oracle table .  during fetching  i want to put some comment  in that cell programmetically. see in excel we can put some cell comments directly to related cell  so suppose i am populating  that cell from oracle table but during populating that cell with orcale data programmetically  i also want to write some comments for that cell programmetically.
Oops, thanks for reminding me about Excel comments (I don't work extensively with Excel). Please work with me on this solution because I cannot currently reinstall Reports6i but feel sure that we can arrive a solution together.

May we start with an excerpt from Oracle's example for setting a VALUE in Excel as borrowed from _Oracle_Developer:_Guidelines_for_Building_Applications_.

====================
/* Create an argument list and insert the specified row and column into the argument list.
*/
lst := ole2.create_arglist;
ole2.add_arg(lst,trow);
ole2.add_arg(lst,col);
/* Call the Cells method to get a handle to the specified cell.
*/
c := ole2.invoke_obj(d,’Cells’,lst);
/* Set the value of that cell. */
ole2.set_property(c,’Value’,val);
====================

Now let's append to that code example based on the OLE2 parameter properties borrowed from _Report_Builder_Reference_.

====================
ole2.set_property(c,'Comment',cmt);
====================

How does that work?
FOR I IN TBL_CUR
  LOOP
        ln_row := ln_row+1;                  
       -- :stat:='Fetching Record('||ln_row||') to Excel.. ';      
    --SYNCHRONIZE;
        ln_col :=  1;
            IF I.deptno IS NOT NULL  THEN      
args := OLE2.CREATE_ARGLIST;
             OLE2.ADD_ARG(args,ln_row);
      OLE2.ADD_ARG(args,ln_col);
      cell := OLE2.GET_OBJ_PROPERTY(worksheet,'Cells',args);
            OLE2.DESTROY_ARGLIST(args);
               OLE2.SET_PROPERTY(cell,'Value',I.deptno);
               ole2.set_property(cell,'Comment','test test test');

see here i am getting value of dept column in excel from dept table.

i tested this ole2.set_property(cell,'Comment','test test test');

but still iam not geting any comments in that cell .actually i want to put cell comments programmatically from d2k. if u are sure then please suggest me on my issue.
Hi rehman123,

Is the _Value_ part of set_property inserted into the defined Excel cell? What happens when you change the command to this.

====================
ole2.set_property(c,'Comments',cmt);
====================

Otherwise this functionality is not available using ole2 and we may look for other solutions.

Barth

PS. There is always a way to program functionality but sometimes/often the solution is more hassle (costly) than it's worth. If it's worthwhile for you to continue working towards a hazily documented procedure, I will work with you.
hey  value part is coming from our table dept ie deptno  after that i wrote  these to put cell comments
===================
ole2.set_property(c,'Comments',cmt);
--------------------------------------------------
but unfortunately when i opened that excel file nothing is coming  as commented. its better first u try  then suggest me. dear suppose
in excel a1 cell i  am populating value of deptno like this
OLE2.SET_PROPERTY(cell,'Value',I.deptno);
now for the same cell i want to put  cell comments.
please try and after getting solution send me feedback.
 
 
ASKER CERTIFIED SOLUTION
Avatar of barthdev
barthdev
Flag of Canada image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
anyway thx for responding me..but  what ever is my issue  just  I want to solve it using d2k.if something is posible in vb or java  that can be also possible from d2k.