Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

cl_gui_html_viewer method load_data

Former Member
0 Likes
1,395

Hi,

I use use the mentioned method to load the documentation of the program into a container. Is it possible to change the background of this? I get only a white background, what I want is a different colour.

Thanks.

8 REPLIES 8
Read only

naimesh_patel
Active Contributor
0 Likes
1,121

Try this way:


    APPEND '<HTML>< body style="background-color:#c3d9ff;" >' TO raw_html.
    APPEND '</BODY></HTML>' TO raw_html.

check this http://html-color-codes.info/ for color information.

Regards,

Naimesh Patel

Read only

0 Likes
1,121

Hi Naimesh,

I have this coding in my report:


  CALL FUNCTION 'DOC_OBJECT_GET_HTML'
    EXPORTING
      docuid     = 'RE'
      docuobject = sy-repid
    TABLES
      html_page  = l_t_html_page.

  CREATE OBJECT html_viewer
    EXPORTING
      parent = container.

  CALL METHOD html_viewer->load_data
    IMPORTING
      assigned_url = l_f_url
    CHANGING
      data_table   = l_t_html_page.

  CALL METHOD html_viewer->show_url
    EXPORTING
      url = l_f_url.

where can I insert the background colour?

Read only

0 Likes
1,121

  CALL FUNCTION 'DOC_OBJECT_GET_HTML'
    EXPORTING
      docuid     = 'RE'
      docuobject = sy-repid
    TABLES
      html_page  = l_t_html_page.
 
"<- here
"just look for <BODY> tag inside table L_T_HTML_PAGE and modify it accordingly (as suggested by Naimesh)

  CREATE OBJECT html_viewer
    EXPORTING
      parent = container.
 
  CALL METHOD html_viewer->load_data
    IMPORTING
      assigned_url = l_f_url
    CHANGING
      data_table   = l_t_html_page.
 
  CALL METHOD html_viewer->show_url
    EXPORTING
      url = l_f_url.

Regards

Marcin

Read only

0 Likes
1,121

How can I look to the body tag. Shall I have to modify the first line in the hmtl table?

Read only

0 Likes
1,121

Loop at the table, and check each line if


CS  '<BODY>'

then use that line and statements FIND or SEARCH to get its position in a line. Next use offset specification to modify that <BODY ...> and finally modify entire line in table.

Regards

Marcin

Read only

0 Likes
1,121

Hello Marcin,

this is my html:


<BODY BGCOLOR="WHITE" TEXT="BLACK" LINK="BLUE" VLINK="#3366CC" ALINK="RED">
<TABLE BORDER="0" CELLPADDING="2" WIDTH="100%" BGCOLOR="#3366CC"><TR><TD><FONT COLOR="#FFFFFF" SIZE="5">

</FONT></TD></TR></TABLE>
<H2>Dokumentation</H2>
<H2></H2>
<P>Einleitung:</P>
</FONT></BODY></HTML>

now I have to make:


loop at html into wa_html.
if wa_html-TDLINE cs 'BODY'.
.....
endif.
endloop.

but how can I say that he only change the value of BGCOLOR?

Read only

0 Likes
1,121

You can do it like


SEARCH it_html FOR 'BODY'.
IF sy-subrc = 0.
  DELETE it_html INDEX sy-tabix. "sy-tabix automatically set by SEARCH
  it_html = '< BODY style="background-color:#c3d9ff" TEXT="BLACK" LINK="BLUE" VLINK="#3366CC" ALINK="RED" >'.
  INSERT it_html INDEX sy-tabix. "new style applies here
ENDIF.

Regards

Marcin

Read only

0 Likes
1,121

Hello Marcin,

now I have this one:


    LOOP AT l_t_html_page INTO l_r_html_page.
      SEARCH l_r_html_page FOR 'BODY'.
      IF sy-subrc = 0.
        l_r_html_page-tdline = '<BODY BGCOLOR="WHITE" TEXT="GREEN" LINK="BLUE" VLINK="#3366CC" ALINK="RED">'.
        MODIFY l_t_html_page FROM l_r_html_page.
        CLEAR l_r_html_page.
      ENDIF.
    ENDLOOP.

and it works, thanks a lot.