4 Replies Latest reply: Nov 15, 2010 10:26 AM by cs01kks RSS

    upload the data from excel sheet to form 6i

    781692
      hi all,
      i am using Forms [32 Bit] Version 6.0.8.24.1 (Production)
      my requirement is to import data from excel to forms.
      i have gone through the help, they have mentioned as below
      To build this demo:
      
      1     Create a spreadsheet containing the initial data and formulae that you want to appear in your form.
      2     In the Layout Editor, click the OLE container tool and drag out the area where you want to display the spreadsheet.
      3     From the pop-up menu on the OLE container, click Insert Object.  
      4     Click Create from File.  Enter the name of the spreadsheet.  Click OK.
      5     In the Object Navigator, attach the library EXCEL.PLL.
      6     To get the value of a cell, call the function GETCELL from the SPREADSHEET package contained in the EXCEL library. 
       To get the value of a cell, call the procedure SETCELL from the same package.
      
      7     To add other interactions with the spreadsheet, use the OLE2 built-in package.  Consult the Excel documentation
       for details of Excel’s object model.
      but if anybody explain this with sample then it will be useful for me..This is first time i am comming such type of requirement across.

      Thanks..
        • 1. Re: upload the data from excel sheet to form 6i
          Andreas Weiden
          Search this forum for EXCEL and OLE, there are lots of code-samples on how to do it.
          • 2. Re: upload the data from excel sheet to form 6i
            781692
            hi,
            i have some sample code(taken from some source)
            DECLARE 
            application ole2.obj_type; 
            workbooks ole2.obj_type; 
            workbook ole2.obj_type; 
            args ole2.list_type; 
            worksheets OLE2.OBJ_TYPE; 
            worksheet OLE2.OBJ_TYPE; 
            BEGIN 
            application:=ole2.create_obj('Excel.Application'); 
            ole2.set_property(application, 'Visible', 'True');
            workbooks := OLE2.GET_OBJ_PROPERTY(application, 'workbooks');
            args:=ole2.create_arglist;
            ole2.add_arg(args, 'FILE_NAME');
            workbook:= ole2.invoke_obj(workbooks, 'Open',args);
            ole2.destroy_arglist(args); 
            args:=ole2.create_arglist; 
            ole2.add_arg(args, 'c:\Pasta1!teste'); --how to pass the arguments
            ole2.invoke(application, 'Run', args); 
            ole2.destroy_arglist(args); 
            ole2.release_obj(workbook); 
            ole2.release_obj(workbooks); 
            ole2.release_obj(application); 
            END; 
            but i don't know how to pass the arguments(i have to pass the excell cell values(data)as an arguments)

            Suggest me to proceed further..

            Thanks..

            Edited by: user13329002 on Nov 13, 2010 1:16 AM
            • 3. Re: upload the data from excel sheet to form 6i
              Andreas Weiden
              Mabe you should do some more search in the forum.
              • 4. Re: upload the data from excel sheet to form 6i
                cs01kks
                hi,
                please use this sample code to get a value from excel.

                     
                                                                     args := client_ole2.CREATE_ARGLIST;
                                         ole2.ADD_ARG(args, i );--row
                                         ole2.ADD_ARG(args, 1 );-- col
                                         MyCell:=ole2.GET_OBJ_PROPERTY(MySheet,'Cells', args); 
                                         ole2.DESTROY_ARGLIST(args); 
                                         row1_col1 := ole2.get_num_property(MyCell,'Value'); 
                               
                If this helped ,please mark the response as anwered/helpful.

                Edited by: cs01kks on Nov 15, 2010 10:26 AM