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

    upload the data from excel sheet to form 6i

      hi all,
      i am using Forms [32 Bit] Version (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.

        • 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
            i have some sample code(taken from some source)
            application ole2.obj_type; 
            workbooks ole2.obj_type; 
            workbook ole2.obj_type; 
            args ole2.list_type; 
            worksheets OLE2.OBJ_TYPE; 
            worksheet OLE2.OBJ_TYPE; 
            ole2.set_property(application, 'Visible', 'True');
            workbooks := OLE2.GET_OBJ_PROPERTY(application, 'workbooks');
            ole2.add_arg(args, 'FILE_NAME');
            workbook:= ole2.invoke_obj(workbooks, 'Open',args);
            ole2.add_arg(args, 'c:\Pasta1!teste'); --how to pass the arguments
            ole2.invoke(application, 'Run', args); 
            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..


            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
                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); 
                                         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