Skip to Content
author's profile photo Former Member
Former Member

OLE2 how to set a column width of an excel file i'm creating?

how can i set the column width in an excel file i'm creating with ole?

or even, haw can i set the auto-fix properties?

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

2 Answers

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Feb 13, 2009 at 08:26 AM

    Hi,

    You can set the column with using the property 'COLUMNWIDTH'.

    In table OLELOAD under field VERB, you can see the properties which can be used.

    set property...of .. 'COLUMNWIDTH' = ...

    Regards,

    Manoj Kumar P

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member Former Member

      Hallo !

      SORRY MY ENGLISH is very BAD.

      I tried to set page header and footer in Excel sheet with abap ole

      ......

      DATA : BEGIN OF enter,

      x(1) TYPE x VALUE '0D',

      END OF enter.

      DATA : format(255) TYPE c.

      .....

      FORM set_page_sheet.

      CALL METHOD OF excel 'ActiveSheet' = sheet.

      CALL METHOD OF sheet 'PageSetup' = pagesetup.

      SET PROPERTY OF pagesetup 'Orientation' = xllandscape.

      SET PROPERTY OF pagesetup 'PrintTitleRows' = '$9:$12'.

      CLEAR format.

      • ERROR

      CONCATENATE 'PAGESHEET' enter-x 'PAGE &P/&N' INTO format.

      • ERROR

      SET PROPERTY OF pagesetup 'RightHeader' = format.

      CLEAR format.

      CONCATENATE ' Text 1 ' enter-x 'Text 2'

      enter-x 'Text 3 ' INTO format.

      SET PROPERTY OF pagesetup 'RightFooter' = format.

      FREE OBJECT pagesetup.

      ENDFORM. " set_page_sheet

      Activate report -

      ERROR - The enter-x must by data type c or another then data type x

      Thanks for answer.

  • author's profile photo Former Member
    Former Member
    Posted on Feb 13, 2009 at 09:00 AM

    Hi,

    Here all are ole2 object

    1) To change the column width of one particular cell

    CREATE OBJECT h_excel 'EXCEL.APPLICATION' NO FLUSH.
    SET PROPERTY OF h_excel 'Visible' = 1.
    
    CALL METHOD OF h_excel 'Cells' = h_zl EXPORTING #1 = 1 #2 = 1. "Here we are changing 1st R 1st C
    SET PROPERTY OF h_zl 'Columnwidth' = .. "your data

    2)To change the column width of range of cells

    CALL METHOD OF h_excel 'Cells' = h_zl1 EXPORTING #1 = 1 #2 = 1."1st row 1st column
    CALL METHOD OF h_excel 'Cells' = h_zl2 EXPORTING #1 = 100 #2 = 1. "100th row first column
    
    CALL METHOD OF h_excel 'Range' = h_range
    EXPORTING #1 = h_zl1 #2 = h_zl2. "This mmeans that first column of 100 records
    SET PROPERTY OF h_range 'Columnwidth' = ..

    Regards,

    Manoj Kumar P

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.