Call Excel SpreadSheet using OLE and set format = text

Hi All,
I am working on an object, where I need to call Excel SpreadSheet using OLE.
In SpreadSheet, I need to show data as text (Without Excel Internal Modifications).
i.e
if i pass 03/2007 as month in excel, it should show  01/2007 not jan-07.
I am trying to use the code as below.
call method of cell 'SET_FORMAT' = text.
set property of text 'CATEGORY' = 4.
this code is not giving me desired output.
Is there any other method i can call? or property I can set?
can somebody pls send me a document with list of all formattiong methods and properties. I will really appreciate the help.
Regards,
Hardik

Hi, you should concatenate the character ( ' ) into your text, example
CONCATENATE '''' text INTO text.
Then print the variable Text into excel and you will see the format as Text,
Thanks and regards.
David Carballido
PD: Sry for my bad English

Similar Messages

  • I have a problem in formatting cells in Excel while using OLE method.

    Hi All,
    I have a problem in formatting cells in Excel while using OLE method.
    My requirement is to have certain fields of a cell as text and amount fields should be in number format.
    How to format a cell in Excel in OLE method of downloading data to excel.
    For example I have plant field whose value is 0002 in internal table while coming to excel it is showing as 2 .
    I want that field to be shown as 0002.(text format)
    Material field whose value in internal table is 000000000000000051 is shown as 51 which has to be shown as
    000000000000000051.(text format).
    Amount field should be in number format so that totalling is possible .
    So I need some cells in text format and some in number format.
    Please suggest a sloution.
    Thanks in advance,
    Regards,
    vidyulatha.U

    https://forums.sdn.sap.com/click.jspa?searchID=21931962&messageID=6852860
    hope this helps.

  • Regading Excel Creation using OLE

    hi friends,
    i got a new requirement where i have to create the Excel document using OLE. one more thing is some cells has to be filled with some colour and in some cells the text has to come in Vertical manner, this text is used for Header purpose.
    please help me urgently...
    Suitable Answers will get more points..........

    Hello,
    Also take a look at this code
    *& Report  ZKRIS_OLE3_PALETTE
    *& Displays the full OLE color range in excel
    REPORT  ZKRIS_OLE3_PALETTE.
    TYPE-POOLS ole2 .
    DATA:  count TYPE i,
           count_real TYPE i,
           application TYPE ole2_object,
           workbook TYPE ole2_object,
           excel     TYPE ole2_object,
           sheet TYPE ole2_object,
           cells TYPE ole2_object.
    CONSTANTS: row_max TYPE i VALUE 256. " change to 16384 for excel 2007
    DATA index TYPE i.
    DATA:
          h_cell        TYPE ole2_object,        " cell
          h_f           TYPE ole2_object,        " font
          h_int         TYPE ole2_object,
          h_width       TYPE ole2_object,
          h_columns     TYPE ole2_object,
          h_rows        TYPE ole2_object,
          h_font        TYPE ole2_object,
          h_entirecol   TYPE ole2_object.
    DATA: h_range       TYPE ole2_object.
    DATA: h_merge       TYPE ole2_object.
    CREATE OBJECT excel 'EXCEL.APPLICATION'.
    IF sy-subrc NE 0.
      WRITE: / 'No EXCEL creation possible'.
      STOP.
    ENDIF.
    SET PROPERTY OF excel 'DisplayAlerts' = 0.
    CALL METHOD OF excel 'WORKBOOKS' = workbook .
    SET PROPERTY OF excel 'VISIBLE' = 1.
    * creating workbook
    SET PROPERTY OF excel 'SheetsInNewWorkbook' = 1.
    CALL METHOD OF workbook 'ADD'.
    CALL METHOD OF excel 'WORKSHEETS' = sheet
      EXPORTING
        #1 = 1.
    SET PROPERTY OF sheet 'NAME' = 'Color Palette'.
    CALL METHOD OF sheet 'ACTIVATE'.
    DATA: col TYPE i VALUE 1,
    row TYPE i VALUE 2,
    col1 TYPE i VALUE 2,
    col_real TYPE i VALUE 1.
    row = 1.
    col = 3.
    CALL METHOD OF excel 'Cells' = h_cell
      EXPORTING
        #1 = row
        #2 = col.
    SET PROPERTY OF h_cell 'Value' = 'No.'.
    col = col + 1.
    CALL METHOD OF excel 'Cells' = h_cell
      EXPORTING
        #1 = row
        #2 = col.
    SET PROPERTY OF h_cell 'Value' = 'Background'.
    col = col + 1.
    CALL METHOD OF excel 'Cells' = h_cell
      EXPORTING
        #1 = row
        #2 = col.
    SET PROPERTY OF h_cell 'Value' = 'Foreground with white background'.
    col = col + 1.
    CALL METHOD OF excel 'Cells' = h_cell
      EXPORTING
        #1 = row
        #2 = col.
    SET PROPERTY OF h_cell 'Value' = 'Foreground with black background'.
    CALL METHOD OF excel 'Rows' = h_rows
      EXPORTING
        #1 = '2:2'.
    SET PROPERTY OF h_rows 'WrapText' = 1.
    col = 9.
    CALL METHOD OF excel 'Cells' = h_cell
      EXPORTING
        #1 = row
        #2 = col.
    SET PROPERTY OF h_cell 'Value' = 'No.'.
    col = col + 1.
    CALL METHOD OF excel 'Cells' = h_cell
      EXPORTING
        #1 = row
        #2 = col.
    SET PROPERTY OF h_cell 'Value' = 'Background'.
    col = col + 1.
    CALL METHOD OF excel 'Cells' = h_cell
      EXPORTING
        #1 = row
        #2 = col.
    SET PROPERTY OF h_cell 'Value' = 'Foreground with white background'.
    SET PROPERTY OF h_cell 'Bold' = 1.
    col = col + 1.
    CALL METHOD OF excel 'Cells' = h_cell
      EXPORTING
        #1 = row
        #2 = col.
    SET PROPERTY OF h_cell 'Value' = 'Foreground with black background'.
    CALL METHOD OF excel 'Rows' = h_rows
      EXPORTING
        #1 = '1:1'.
    SET PROPERTY OF h_rows 'WrapText' = 1.
    GET PROPERTY OF h_rows 'Font' = h_font.
    SET PROPERTY OF h_font 'Bold' = 1.
    count = 1.
    count_real = count.
    row = 2.
    col = 3.
    DO 56 TIMES.
      PERFORM write_num_and_color.
    ENDDO.
    * autofit
    CALL METHOD OF excel 'Columns' = h_columns
      EXPORTING
        #1 = 'C:L'.
    GET PROPERTY OF h_columns 'EntireColumn' = h_entirecol.
    SET PROPERTY OF h_entirecol 'Autofit' = 1.
    * write palette on lhs
    *range
    CALL METHOD OF excel 'Range' = h_range
      EXPORTING
        #1 = 'A2'
        #2 = 'A20'.
    CALL METHOD OF h_range 'Merge' = h_merge .
    CALL METHOD OF excel 'Cells' = h_cell
      EXPORTING
        #1 = 2
        #2 = 1.
    SET PROPERTY OF h_cell 'Value' = 'Palette'.
    SET PROPERTY OF h_cell 'Orientation' = 90.         "angled.
    SET PROPERTY OF h_cell 'HorizontalAlignment' = 3.  "center align
    GET PROPERTY OF h_cell 'Font'    = h_f.
    SET PROPERTY OF h_f 'Bold' = 1.                    "bold
    SET PROPERTY OF h_f 'Name' = 'Comic Sans MS'.
    SET PROPERTY OF h_f 'Size' = '14'.
    SET PROPERTY OF h_cell 'VerticalAlignment' = 2.  "center align
    * autofit
    CALL METHOD OF excel 'Columns' = h_columns
      EXPORTING
        #1 = 'A:A'.
    GET PROPERTY OF h_columns 'EntireColumn' = h_entirecol.
    SET PROPERTY OF h_columns 'ColumnWidth' = 4.
    *&      Form  write_num_and_color
    *       text
    FORM write_num_and_color.
      index = row_max * ( row - 1 ) + col.
      CALL METHOD OF sheet 'Cells' = cells
        EXPORTING
          #1 = index.
      SET PROPERTY OF cells 'Value' = count_real.
      col = col + 1.
      CALL METHOD OF excel 'Cells' = h_cell
        EXPORTING
          #1 = row
          #2 = col.
      GET PROPERTY OF h_cell 'Interior'   = h_int.
      SET PROPERTY OF h_int  'ColorIndex' = count_real.
      col = col + 1.
      CALL METHOD OF excel 'Cells' = h_cell
        EXPORTING
          #1 = row
          #2 = col.
      SET PROPERTY OF h_cell 'Value' = 'Sample Text'.
      GET PROPERTY OF h_cell 'Font'    = h_f.
      SET PROPERTY OF h_f 'ColorIndex' = count_real.
      col = col + 1.
      CALL METHOD OF excel 'Cells' = h_cell
        EXPORTING
          #1 = row
          #2 = col.
      GET PROPERTY OF h_cell 'Interior'   = h_int.
      SET PROPERTY OF h_int  'ColorIndex' = 1.
      SET PROPERTY OF h_cell 'Value' = 'Sample Text'.
      GET PROPERTY OF h_cell 'Font'    = h_f.
      SET PROPERTY OF h_f 'ColorIndex' = count_real.
      row = row + 1.
      col = col - 3.
      count = count + 1.
      IF count = 29.
        count = 1.
        row = 2.
        col = col + 6.
      ENDIF.
      count_real = count_real + 1.
    ENDFORM.                    "write_num_and_color

  • Data download to multiple sheets in Excel without using OLE

    Hi,
    Please let me know if it is possible to download data to multiple sheets in excel without using OLE method
    I am in SRM system and the OLE methods are not working
    Please share some sample code or reference links if any
    Thanks
    SekharJ
    Edited by: SekharJ on Sep 8, 2009 8:43 AM

    Here is my code
      LOOP AT it_final INTO wa_final.
        AT FIRST.
          l_ixml = cl_ixml=>create( ).
          l_document = l_ixml->create_document( ).
          l_element_flights  = l_document->create_simple_element(
                      name = 'PO_Details'
                      parent = l_document ).
        ENDAT.
        l_element_airline  = l_document->create_simple_element(
                    name = 'PO'
                    parent = l_element_flights  ).
        l_value = wa_final-object_id.
        l_rc = l_element_airline->set_attribute( name = 'Objectid' value =
                                                             l_value ).
        l_value = wa_final-description.
        l_rc = l_element_airline->set_attribute( name = 'Description' value =
                                                             l_value ).
        l_value = wa_final-number_int.
        l_rc = l_element_airline->set_attribute( name = 'Item' value =
                                                             l_value ).
        l_value = wa_final-description1.
        l_rc = l_element_airline->set_attribute( name = 'Description1' value =
                                                             l_value ).
        l_value = wa_final-quantity.
        l_rc = l_element_airline->set_attribute( name = 'Quantity' value =
                                                             l_value ).
        l_value = wa_final-capex.
        l_rc = l_element_airline->set_attribute( name = 'Capex' value =
                                                             l_value ).
        l_value = wa_final-ser_num.
        l_rc = l_element_airline->set_attribute( name = 'SerialNo' value =
                                                             l_value ).
        l_value = wa_final-plant.
        l_rc = l_element_airline->set_attribute( name = 'Plant' value =
                                                             l_value ).
        l_value = wa_final-loc.
        l_rc = l_element_airline->set_attribute( name = 'Location' value =
                                                             l_value ).
        l_value = wa_final-bundle.
        l_rc = l_element_airline->set_attribute( name = 'Bundle' value =
                                                             l_value ).
      ENDLOOP.
      l_streamfactory = l_ixml->create_stream_factory( ).
      l_ostream = l_streamfactory->create_ostream_itable( table =
    l_xml_table ).
      l_renderer = l_ixml->create_renderer( ostream  = l_ostream
                                            document = l_document ).
      l_rc = l_renderer->render( ).
      l_xml_size = l_ostream->get_num_written_raw( ).
        CALL METHOD cl_gui_frontend_services=>gui_download
          EXPORTING
            bin_filesize = l_xml_size
            filename     = 'c:\temp\flights.xlsx'
            filetype     = 'BIN'
          CHANGING
            data_tab     = l_xml_table
          EXCEPTIONS
            OTHERS       = 24.
        IF sy-subrc <> 0.
          MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
                     WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
        ENDIF.
    Edited by: SekharJ on Sep 8, 2009 12:04 PM
    Edited by: SekharJ on Sep 8, 2009 12:15 PM

  • Is it possible to create Excel Sheet using OLE automation in App server

    Hi,
       Is it possible to create Excel Sheet using OLE automation in Application server(Open Dataset)
    Thanks in advance...

    Unless your application server is on Windows OS, or it is connected to a Windows server by RFC. What is the requirement exactly, I don't understand?

  • I updated to yosemite and now if someone is using imessage and sends a text message to my phone it doesn't show up on my phone but does on my computer.  I don't want messages on my computer!  How do I get this to go away and work like it used to?

    I updated to yosemite and now if someone is using imessage and sends a text message to my phone it doesn't show up on my phone but does on my computer.  I don't want messages on my computer!  How do I get this to go away and work like it used to?

    Follow the instructions under the heading "How to unlink a phone number" on this page.

  • My iphone 4s keeps freezing up. I have restored it as a new phone. Done numerous resets. But it still keeps freezing up when im using apps and trying to text. Its really annoying.

    My iphone 4s keeps freezing up. I have restored it as a new phone. Done numerous resets. But it still keeps freezing up when im using apps and trying to text. Its really annoying.

    Oh OisinC7,
         I'm aslo experiencing similar problem. Tell me your country and what apps make your phone freeze?

  • Setting the aixs minimum in excel chart using OLE.

    Hi All,
              The problem am facing is that say if all the values in the chart data range is high  then excel adjusts itself so that the axis minimum doesn't start from zero. But i need the axis to always start from zero. How do i set this using OLE?

    Hi
    Here is ur expected coding...
    REPORT ZCREATEEXCEL.
    TYPE-POOLS OLE2.
    DATA: EXCEL TYPE OLE2_OBJECT,
    WORKBOOKS TYPE OLE2_OBJECT,
    WORKBOOK TYPE OLE2_OBJECT.
    DATA: FILENAME LIKE RLGRAP-FILENAME.
    START THE EXCEL APPLICATION
    CREATE OBJECT EXCEL 'EXCEL.APPLICATION'.
    PERFORM ERR_HDL.
    PUT EXCEL IN FRONT
    SET PROPERTY OF EXCEL 'VISIBLE' = 1.
    PERFORM ERR_HDL.
    INFORM USER OF THE CURRENT STATUS
    CALL FUNCTION 'SAPGUI_PROGRESS_INDICATOR'
    EXPORTING
    PERCENTAGE = 0
    TEXT = TEXT-I08
    EXCEPTIONS
    OTHERS = 1.
    CREATE AN EXCEL WORKBOOK OBJECT
    CALL METHOD OF EXCEL 'WORKBOOKS' = WORKBOOKS.
    PERFORM ERR_HDL.
    CALL METHOD OF WORKBOOKS 'ADD' = WORKBOOK.
    PERFORM ERR_HDL.
    EXCEL FILENAME
    CONCATENATE SY-REPID '_' SY-DATUM6(2) '_' SY-DATUM4(2) '_'
    SY-DATUM(4) '_' SY-UZEIT '.XLS' INTO FILENAME.
    CALL METHOD OF WORKBOOK 'SAVEAS' EXPORTING #1 = FILENAME.
    FORM ERR_HDL.
    IF SY-SUBRC <> 0.
    WRITE: / 'OLE ERROR: RETURN CODE ='(I10), SY-SUBRC.
    STOP.
    ENDIF.
    ENDFORM.
    Reward if usefull

  • With one click, can one upload an entire folder containing at least 7GB of Excel spreadsheet to ICloud and then be able to view them on an Ipad using Numbers. Also, would this cause one to have to pay for over 5GB of space?

    Want to travel only with my Ipad.  Would like to easily upload, with one click, large 7GB folders of both Excel spreadsheets and Word documents to ICloud and then be able to view, change and create individual spreadsheets and documents using Numbers and Pages on my Ipad through the internet? Also, this would exceed the 5GB offered free, but someone said if I am only syncing and not backing up there would be no charge.  Please explain.

    You can't
    Pages and Numbers can save to iCloud, Word and Excel can not.

  • Create Excel sheet using OLE

    Hi All,
           Can any one help me to create an multiple excel sheet in an work book using OLE. I want to create more than 3 sheets in excel, which is default sheets in excel when we one excel.

    Hi,
    Check the below sample code.
    Here I'm downloading the same table twice into 2 different sheets for example purpose.
    TYPE-POOLS ole2.
    DATA: wf_cell_from  TYPE ole2_object,
          wf_cell_from1 TYPE ole2_object,
          wf_cell_to    TYPE ole2_object,
          wf_cell_to1   TYPE ole2_object,
          wf_excel      TYPE ole2_object,   " Excel object
          wf_mapl       TYPE ole2_object,   " list of workbooks
          wf_map        TYPE ole2_object,   " workbook
          wf_worksheet  TYPE ole2_object,   " Worksheet
          wf_cell       TYPE ole2_object,   " Cell Range
          wf_cell1      TYPE ole2_object,
          wf_range      TYPE ole2_object,   " Range of cells to be formatted
          wf_range2     TYPE ole2_object,
          wf_column1    TYPE ole2_object.   " Column to be Autofit
    DATA: BEGIN OF t_hex,
          l_tab TYPE x,
          END OF t_hex.
    DATA: wf_deli(1) TYPE c,            "delimiter
          wf_action TYPE i,
          wf_file TYPE string,
          wf_path TYPE string,
          wf_fullpath TYPE string.
    TYPES: t_data1(1500) TYPE c,
           int_ty TYPE TABLE OF t_data1. "line type internal table
    *All the data was prepared as line type internal tables for faster
    *download
    DATA: int_matl  TYPE int_ty ,
          int_matl1 TYPE int_ty ,
          wa_matl   TYPE t_data1.
    TYPES: BEGIN OF ty_mara,
           matnr TYPE matnr,
           mtart TYPE mtart,
           matkl TYPE matkl,
           meins TYPE meins,
           END OF ty_mara.
    DATA: int_mara TYPE STANDARD TABLE OF ty_mara,
          wa_mara TYPE ty_mara.
    FIELD-SYMBOLS: <fs> .
    DATA: wc_sheets LIKE sy-index.  "no.of sheets
    DATA: it_tabemp TYPE filetable,
          gd_subrcemp TYPE i.
    CONSTANTS wl_c09(2) TYPE n VALUE 09.
    CLEAR wc_sheets.
    DEFINE ole_check_error.
      if &1 ne 0.
        message e001(zz) with &1.
        exit.
      endif.
    END-OF-DEFINITION.
    SELECTION-SCREEN BEGIN OF BLOCK block1 WITH FRAME TITLE text-001.
    PARAMETERS: p_file   LIKE rlgrap-filename.
    SELECTION-SCREEN END OF BLOCK block1.
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.
      REFRESH: it_tabemp.
      CALL METHOD cl_gui_frontend_services=>file_save_dialog
        EXPORTING
          window_title         = 'Select File'
    *      default_extension    = 'xls'
          default_file_name    = 'Material Details'
    *      with_encoding        =
          file_filter          = '*.xls'
          initial_directory    = 'C:\'
          prompt_on_overwrite  = ' '
        CHANGING
          filename             = wf_file
          path                 = wf_path
          fullpath             = wf_fullpath
          user_action          = wf_action
    *      file_encoding        =
        EXCEPTIONS
          cntl_error           = 1
          error_no_gui         = 2
          not_supported_by_gui = 3
          OTHERS               = 4
      IF sy-subrc <> 0.
    *   MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *              WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
      IF wf_action EQ 9.
        MESSAGE 'No File have been Selected' TYPE 'S'.
      ELSE.
        p_file = wf_fullpath.
        PERFORM create_excel.
      ENDIF.
    *&      Form  create_excel
    *       text
    FORM create_excel.
      LOOP AT it_tabemp INTO p_file.
      ENDLOOP.
    * START THE EXCEL APPLICATION
      CREATE OBJECT wf_excel 'EXCEL.APPLICATION'.
      PERFORM err_hdl.
    * PUT EXCEL IN FRONT
      SET PROPERTY OF wf_excel  'VISIBLE' = 1.
      PERFORM err_hdl.
    * CREATE AN EXCEL WORKBOOK OBJECT
      CALL METHOD OF wf_excel 'WORKBOOKS' = wf_mapl.
      PERFORM err_hdl.
      SET PROPERTY OF wf_excel 'SheetsInNewWorkbook' = 3. "no of sheets
      PERFORM err_hdl.
      CALL METHOD OF wf_mapl 'ADD' = wf_map.
      PERFORM err_hdl.
    *Assign the Delimiter to field  symbol.
      ASSIGN wf_deli TO <fs> TYPE 'X'.
      t_hex-l_tab = wl_c09.
      <fs> = t_hex-l_tab.
      CLEAR int_matl.
      REFRESH int_matl.
      SELECT matnr
           mtart
           matkl
           meins
          FROM mara
          INTO CORRESPONDING FIELDS OF TABLE int_mara.
    *first the headings will be displayed  in the excel sheet
      CONCATENATE 'Material Number'
      'Material type'
      'Material Group'
      'Base Unit of Measure'
      INTO wa_matl
      SEPARATED BY wf_deli.
      APPEND wa_matl TO int_matl.
      LOOP AT int_mara INTO wa_mara.
        CONCATENATE wa_mara-matnr
                    wa_mara-mtart
                    wa_mara-matkl
                    wa_mara-meins
                    INTO wa_matl
                    SEPARATED BY wf_deli.
        APPEND wa_matl TO int_matl.
        CLEAR wa_matl.
      ENDLOOP.
    *Copyng thae same contents to another table to display in
    *new sheet
      MOVE int_matl TO int_matl1.
      PERFORM f_material_details
      TABLES int_matl
      USING  1.
      PERFORM f_material_details
      TABLES int_matl
      USING  2.
      GET PROPERTY OF wf_excel 'ActiveSheet' = wf_map.
      GET PROPERTY OF wf_excel 'ActiveWorkbook' = wf_mapl.
      CALL FUNCTION 'FLUSH'
        EXCEPTIONS
          cntl_system_error = 1
          cntl_error        = 2
          OTHERS            = 3.
      IF sy-subrc = 0.
        CALL METHOD OF wf_map 'SAVEAS'
          EXPORTING #1 = p_file.
      ENDIF.
      CALL METHOD OF wf_mapl 'CLOSE'.
      CALL METHOD OF wf_excel 'QUIT'.
      FREE OBJECT wf_mapl.
      FREE OBJECT wf_map.
      FREE OBJECT wf_excel.
    ENDFORM.                    "create_excel
    *&      Form  ERR_HDL
    *       text
    FORM err_hdl.
      IF sy-subrc <> 0.
        WRITE: / 'OLE ERROR: RETURN CODE ='(i10), sy-subrc.
        STOP.
      ENDIF.
    ENDFORM.                    "ERR_HDL
    *-- End of Program
    *&      Form  f_material_details
    *       text
    *  -->  p1        text
    *  <--  p2        text
    FORM f_material_details
       TABLES lint_matl
      USING l_sheet_no TYPE i.
      DATA: lv_lines TYPE i,
            lv_sheet_name(50) TYPE c.
      wc_sheets = l_sheet_no.
      CASE l_sheet_no.
        WHEN 1.
          lv_sheet_name = 'Material_sheet1'.
        WHEN 2.
          lv_sheet_name = 'Material_sheet2'.
      ENDCASE.
    *-- activating the worksheet and giving a  name to it
      CALL METHOD OF wf_excel 'WORKSHEETS' = wf_worksheet
        EXPORTING
        #1 = wc_sheets.
      CALL METHOD OF wf_worksheet 'ACTIVATE'.
      SET PROPERTY OF wf_worksheet 'NAME' = lv_sheet_name.
    *--formatting the cells
      CALL METHOD OF wf_excel 'Cells' = wf_cell_from
        EXPORTING
        #1 = 1
        #2 = 1.
      DESCRIBE TABLE lint_matl LINES lv_lines.
      CALL METHOD OF wf_excel 'Cells' = wf_cell_to
        EXPORTING
        #1 = lv_lines
        #2 = 4.
    *--range of cells to be formatted (in this case 1 to 4)
      CALL METHOD OF wf_excel 'Range' = wf_cell
        EXPORTING
        #1 = wf_cell_from
        #2 = wf_cell_to.
    *--formatting the cells
      CALL METHOD OF wf_excel 'Cells' = wf_cell_from1
        EXPORTING
        #1 = 1
        #2 = 1.
      DESCRIBE TABLE lint_matl LINES lv_lines.
      CALL METHOD OF wf_excel 'Cells' = wf_cell_to1
        EXPORTING
        #1 = lv_lines
        #2 = 1.
      CALL METHOD OF wf_excel 'Range' = wf_cell1  " Cell range for first
                                                  " column(Material)
        EXPORTING
        #1 = wf_cell_from1
        #2 = wf_cell_to1.
      SET PROPERTY OF wf_cell1 'NumberFormat' = '@' . "To disply zeros
      "in Material number
      DATA l_rc TYPE i.
    *DATA download into excel first sheet
      CALL METHOD cl_gui_frontend_services=>clipboard_export
        IMPORTING
          data         = lint_matl[]
        CHANGING
          rc           = l_rc
        EXCEPTIONS
          cntl_error   = 1
          error_no_gui = 2
          OTHERS       = 4.
      CALL METHOD OF wf_worksheet 'Paste'.
      CALL METHOD OF wf_excel 'Columns' = wf_column1.
      CALL METHOD OF wf_column1 'Autofit'.
      FREE OBJECT wf_column1.
    ENDFORM.                    " f_material_details
    Regards,
    Manoj Kumar P
    Edited by: Manoj Kumar on Mar 5, 2009 11:25 AM

  • Prevent copy of excel cells using OLE

    Hi All,
    I have protected my excel worksheet. But the cells can be copied. I want to prevent this copy of cells using OLE.
    I have gone through the EXCEL proerties. But dont know how to exact use them?
    Thanks in Advance
    -neha

    Hello Neha,
    I don't think CutCopyMode is the correct answer
    Try the below code. It prevents the selection of cells, hence preventing copying.
    REPORT  zkris_ole_protectsheet.
    *                  Start of Selection                                  *
    START-OF-SELECTION.
      TYPE-POOLS ole2 .
      DATA:
             workbook TYPE ole2_object,
             excel     TYPE ole2_object,
             sheet TYPE ole2_object,
             cells TYPE ole2_object.
      CREATE OBJECT excel 'EXCEL.APPLICATION'.
      IF sy-subrc NE 0.
        WRITE: / 'No EXCEL creation possible'.
        STOP.
      ENDIF.
      SET PROPERTY OF excel 'DisplayAlerts' = 0.
      CALL METHOD OF excel 'WORKBOOKS' = workbook .
      SET PROPERTY OF excel 'VISIBLE' = 1.
    * creating workbook
      SET PROPERTY OF excel 'SheetsInNewWorkbook' = 1.
      CALL METHOD OF workbook 'ADD'.
      CALL METHOD OF excel 'WORKSHEETS' = sheet
        EXPORTING
        #1 = 1.
    * naming and activating the index sheet
      SET PROPERTY OF sheet 'NAME' = 'Index'.
      CALL METHOD OF sheet 'ACTIVATE'.
      CALL METHOD OF sheet 'Cells' = cells
        EXPORTING
        #1 = 3
        #2 = 3.
      SET PROPERTY OF cells 'Value' = 'You cannot select me'.
      CALL METHOD OF sheet 'PROTECT'
        EXPORTING
          #1 = 'pass' " Password
          #2 = 1 " Protect Drawing Objects
          #3 = 1 " Protect Contents
          #4 = 1." Protect Scenarios
      SET PROPERTY OF sheet 'EnableSelection' = -4142.

  • To Display Logo on all the pages of Excel Sheet using OLE

    Dear friends,
                         I have developed one report using OLE which display output in Excel. I have display logo using OLE.
    I am able to display logo on first page of excel sheet. but I am not able to display it on all the pages.
                        Need your help. Please, suggest any good solution.
    Thanks & Regards,
    Sandip Sonar

    Excel repeats only HEADER and FOOTER information on every page. The data on cell is relevant only for that page.
    If you want to print something on every page in Excel, you will have to include it on HEADER/FOOTER section of the excel file.
    To check this, go to excel, on meny go to File->PageSetup. Then select Header/Footer Tab... select Custom Header or custom footer. 
    Whatever you inset here (including image) will be printed on every page of Excel. Don't know OLE property to set this but I feel something should be available to set custom header footer for your file.

  • Problem  in  excel  download using  OLE concept

    Hi ,
        i am trying to  create two sheets using OLE concept.
    i am able to create the excel successfully but i can't save it .
    i have one problem .
    GET PROPERTY OF excel 'ActiveSheet' = sheet.
    CALL METHOD OF sheet 'FILESAVEAS' EXPORTING #1 = w_filename1.
    IF sy-subrc eq 0.
    the sy-subrc value comes as  2.
    i am passing 'C:\SKD.XLS'  to  w_filename.
    is anything wrong.
    how can check  this method  and it's exceptions.

    i am getting the file name from user input using the  method
    *"Calling method for getting file name as saved by the user.
      CALL METHOD cl_gui_frontend_services=>file_save_dialog
        EXPORTING
          window_title         = w_title
        CHANGING
          filename             = w_filnam
          path                 = w_path
          fullpath             = w_filename1
        EXCEPTIONS
          cntl_error           = 1
          error_no_gui         = 2
          not_supported_by_gui = 3
          OTHERS               = 4.
    w_filename1 is of sting type .
    i am passing the  full  path to  it .
    please  let  me  i am doing anything wrong .

  • How do I format a linked Excel file in InDesign and maintain formatting when the Excel is modified?

    I'm in CS5.5 . I have no problem placing an Excel spreadsheet with the cell range I want and applying cell formatting in InDesign. I am trying to build eight similar documents that will pull data in several tables from a document specific Excel spreadsheet. The only difference is the data itself. I want to build one master InDesign document (master.indd) that links to a corresponding master Excel file (master.xlsx). I'll then do all the table formatting in master.indd once before saving as the eight individual files I need (doc1.indd, doc2.indx, etc.). Soon I'll receive the specific Excel files (doc1.xlxs, doc2.xlsx, doc3.xlxs, etc.) and I will open each InDesign file and relink master.xlxs to the appropriately numbered and corresponding Excel spreadsheet.
    My problem is all the formatting of the imported tables is stripped away when I relink. There are at least 60 tables being imported. I'd prefer to format 60 tables versus 480. I've tried importing the Excel as formatted, unformatted, I've applied cell styles in Excel and InDesign but can't catch a break. Can anyone help?

    Or alternatively, do all the formatting in Excel and place as a formatted table.
    Bob

  • I can't copy and paste formatted text within the same or between Word and Excel documents

    I run Microsoft Office Professional Plus 2010 (English) (Student Select)
    when I try to copy any formatted text or tables within the same or different Word documents I will always loose the formatting. This is also true if I try to copy formats or formatted tables within Excel or from Excel to Word, see example screenshot:
    When I have a look at my paste options via 'Alt', 'e', 's' or 'Paste special' it only lets me choose between "Unformatted Text" or "Unformatted Unicode Text", see screenshot:
    Here is what I tried already:
    - In the advance options menu all options are on "keep formatting"
    - I uninstalled and reinstalled the entire office suit but keep having the same problem!
    Any ideas?
    Thanks in advance,
    Boston

    I found the solution on another site, superuser.com, so I can't claim the solution as my own, but it worked for me. Kent Ng says: 
    I face the similar issue with Excel 2003. If you have installed Skype-Click-to-Call, just removed it to resolve this issue.

Maybe you are looking for

  • After 1 hr of music playback, 2 month new, 30gig iPod needs charging

    Hello, I have a 5th generation 30 gig iPod. I've took it out of its box in the last week of July 2006. Most times, the iPod is plugged in to the USB cable and is recharging. I leave it plugged in even when the display shows that it's fully charged. O

  • Pass parameter from OnInitialisation to OnInputProcessing

    Hi, I have asked this before but I closed that thread and awarded all the points. I'm still having trouble with it, so I post it again for clarification. I have a BSP, a.bsp in the Page Attributes I have a parameter error1 which is a string with the

  • Enhancing logical database PNPCE

    Dear all, my client wants to include a few z_tables to the standard selection screen and output in their ad hoc reporting infoset in HR. Is there a way to include z_fields to the standard selection screen (PNPCE) as well as output of the ad hoc repor

  • Possible cfdocument header/footer bug in CF8

    All- I'm experiencing a problem with header and footers containing dynamic/ query variables in the header/footer text. The header and footer are sort of being cached or not being updated appropriately when a query variable is inserted into the conten

  • Editing iPhoto book pages

    I'm making a book in iphoto11. Why can't I select an individual page for editing? Double click does nothing. Thanx for your help