2 Replies Latest reply on May 24, 2004 12:22 PM by 167634

    How to draw lines (border) from form to excel?

    37999
      Dear all,
      I have the following code in form but it doesn't work. Any help? Thanks a lot!!!

      PROCEDURE Draw_line
      (P_OLE_OBJECT IN OLE2.OBJ_TYPE,
      P_ROW IN NUMBER,
      P_COLUMN IN NUMBER,
      ) IS

      V_OLE_OBJECT OLE2.OBJ_TYPE := P_OLE_OBJECT;
      V_ROW NUMBER(10) := P_ROW;
      V_COLUMN NUMBER(10) := P_COLUMN;

      LINE OLE2.OBJ_TYPE;
      ARGS OLE2.LIST_TYPE;

      BEGIN

      ARGS:=OLE2.CREATE_ARGLIST;
      OLE2.ADD_ARG(ARGS, V_ROW);
      OLE2.ADD_ARG(ARGS, V_COLUMN);

      LINE := OLE2.GET_OBJ_PROPERTY(V_OLE_OBJECT, 'BORDERS', ARGS);
      OLE2.DESTROY_ARGLIST(ARGS);

      OLE2.SET_PROPERTY(LINE, 'LINESTYLE', 1); -- 1 = xlContinuous

      OLE2.RELEASE_OBJ(LINE);

      END;

      Regards,
      Catherine
        • 1. Re: How to draw lines (border) from form to excel?
          317027
          Hello Catherine,

          What is a parameter P_OLE_OBJECT? I think, It's a worksheet object. Am I right?

          1. But there isn't the Borders property in Worksheet objects. You can use the Borders property just with Range objects.
          2. Index of object in the Borders collection isn't a cell number. It can be one of the following Excell constants: xlInsideHorizontal, xlInsideVertical, xlDiagonalDown, xlDiagonalUp, xlEdgeBottom, xlEdgeLeft, xlEdgeRight, or xlEdgeTop. You can use the Cells property of a Worksheet object to get the Range object for the cell.

          Try to use following code (I suppress variable declaration and importless code):

          -- Get the Range object for the cell
          args:=OLE2.CREATE_ARGLIST;
          OLE2.ADD_ARG( args, ROW );
          OLE2.ADD_ARG( args, COL );
          MyRange:=OLE2.GET_OBJ_PROPERTY(MySheet, 'Cells', args );
          OLE2.DESTROY_ARGLIST(args);
          -- Get the Borders object
          MyBorders:=OLE2.GET_OBJ_PROPERTY( MyRange, 'Borders' );
          -- Set the LineStyle property (for all borders)
          --
          -- xlContinuous 1
          -- xlLineStyleNone -4142
          -- xlDash -4115
          -- etc..
          OLE2.SET_PROPERTY( MyBorders, 'LineStyle', 1 );

          OLE2.RELEASE_OBJ(.. etc..
          • 2. Re: How to draw lines (border) from form to excel?
            167634
            How to set either of left / right / top / bottom border of cell ?