Quantcast
Channel: SCN : All Content - ABAP Development
Viewing all articles
Browse latest Browse all 8332

Color the font in Excel with the OLE

$
0
0

I just started to download some data via the OLE technology to Excel .

 

I can make the font BOLD , change the SIZE , make it ITALIC , but i can't do the font Red for example BUT without change the background .

Can someone help me ?

 

Here my code :

.....

INCLUDE OLE2INCL.

DATA:  APPLICATION TYPE OLE2_OBJECT,

       WORKBOOK TYPE OLE2_OBJECT,

       SHEET TYPE OLE2_OBJECT,

       CELLS TYPE OLE2_OBJECT.

CONSTANTS: ROW_MAX TYPE I VALUE 256.

DATA INDEX TYPE I.

 

DATA : BORDERS TYPE OLE2_OBJECT,

       BUTTON  TYPE OLE2_OBJECT,

       INT     TYPE OLE2_OBJECT,

       FONT    TYPE OLE2_OBJECT,

       ROW     TYPE OLE2_OBJECT,

       COLOR   TYPE OLE2_OBJECT.

....

......

.....

  CALL METHOD OF SHEET 'RANGE' = CELLS EXPORTING #1 = 'A1'.

<b> PERFORM FONT USING 1 '12' 0.

  PERFORM FILL_CELL USING '6' '-1' 2</b>.

  SET PROPERTY OF CELLS 'VALUE' = 'Name'.

  FREE OBJECT CELLS.

....

.....

----


  • FORM font *

----


  • ........ *

----


  • --> bold *

  • --> size *

----


FORM FONT USING BOLD SIZE ITALIC.

  CALL METHOD OF CELLS 'FONT'   = FONT.

  SET PROPERTY OF FONT 'BOLD'   = BOLD.

  SET PROPERTY OF FONT 'SIZE'   = SIZE.

  SET PROPERTY OF FONT 'ITALIC' = ITALIC.

  FREE OBJECT FONT.

ENDFORM.

 

----


  • FORM fill_cell *

----


  • ........ *

----


  • --> color *

  • --> pattern *

----


FORM FILL_CELL USING COLOR PATTERN ALIGN.

  CALL METHOD OF CELLS 'INTERIOR'  = INT.

  SET PROPERTY OF INT 'ColorIndex' = COLOR.

  SET PROPERTY OF INT 'Pattern'    = PATTERN.

  SET PROPERTY OF INT 'Align'      = ALIGN.

  FREE OBJECT INT.

ENDFORM.

 

 

 

Point will be rewarded (As usual) !!!


Viewing all articles
Browse latest Browse all 8332

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>