cancel
Showing results for 
Search instead for 
Did you mean: 

How to show the content of a word doc in an Office Control UI element

0 Kudos

Hi,

I would like to display the content of a word, an Excel and an Pdf document in the office control ui element.

I have used an upload ui element that is bounded to context node UPLOAD attribute upload of type xstring.

The office control ui element (called OFFICE) is bounded to context node UPLOAD attribute show of type xstring.

Two attributes are added to the view:

DOCUMENT of type ref

IF_IOS_DOCUMENT and

FACTORY of type ref

IF_IOS_FACTORY

A button is added in the view in order to display the content.

The following code is added in the action of the button.

   IF wd_this->document IS INITIAL.
    wd_this->factory->get_document_proxy( IMPORTING proxy = wd_this->document  ).
    ASSERT ID sios_demo CONDITION wd_this->document IS BOUND.
  ENDIF.

  wd_this->document->opendocument( ).

  DATA lo_nd_upload TYPE REF TO if_wd_context_node.

  DATA lo_el_upload TYPE REF TO if_wd_context_element.
  DATA ls_upload  TYPE wd_this->Element_upload.

* navigate from <CONTEXT> to <UPLOAD_DOC> via lead selection
  lo_nd_upload = wd_context->get_child_node( name = wd_this->wdctx_upload ).

* @TODO handle non existant child
* IF lo_nd_upload_doc IS INITIAL.
* ENDIF.

* get element via lead selection
  lo_el_upload = lo_nd_upload->get_element( ).
* @TODO handle not set lead selection
  IF lo_el_upload IS INITIAL.
  ENDIF.

* get all declared attributes
  lo_el_upload->get_static_attributes(
    IMPORTING
      static_attributes = ls_upload ).

   ls_upload-show = ls_upload-upload.

   lo_el_upload->set_static_attributes(
    EXPORTING
      static_attributes = ls_upload ).

In the DOONmodify method is following code added:

   DATA: office TYPE REF TO cl_wd_view_element.
*get the office control

  office ?= view->get_element( 'OFFICE' ).
  ASSERT ID sios_demo CONDITION  office IS BOUND.

*get the IOS interface
  wd_this->factory ?= office->_method_handler.

After uploading a file the user is assumed to hit the Show button, but nothing happens. No file content is displayed in the office ui element.Anyone that sees the error or could help me to explain what I need to do in order to see the content of the document?

Thank you a lot and regards Lena

Accepted Solutions (1)

Accepted Solutions (1)

chengalarayulu
Active Contributor
0 Kudos

check the below component

IOS_TEST_WORDPROCESSING

Answers (0)