Entering content frame

Object documentation Web Dynpro OfficeControl API – IWDOfficeControl Locate the document in its SAP Library structure

Definition

The OfficeControl UI element allows you to add an Office document to a view. This allows you to display the following Office documents in a Web Dynpro application:

·        Microsoft Word documents

·        Microsoft Excel documents

.

The OfficeControl UI element is made available as an ActiveX control, so that the UI element can be displayed in browsers that support ActiveX controls.

For browsers which do not support ActiveX controls, the following runtime exception is raised: Office Integration through Applet is not supported.

This means that:

·        The ActiveX control enables display of the following documents:

¡        Microsoft Word documents with the doc file extension

¡        Microsoft Excel documents with the xls file extension

The implementation of the OfficeControl UI element supports:

·        Opening a new document by calling the method ShowDocument:
WDOfficeControlMethods.showDocument(IWDController refToTheController,  String strControlId

·        Opening an existing document by calling the method ShowDocument:
WDOfficeControlMethods.showDocument(IWDController refToTheController,  String strControlId

·        Saving the document by calling the method SaveDocument:
WDOfficeControl.saveDocument(IWDController refToTheController,  String strControlId

·        Closing the document by calling the method CloseDocument:
WDOfficeControlMethods.closeDocument(IWDController refToTheController,  String strControlId

The prerequisite for using the OfficeControl UI element is the installation of one of the following software programs:

·        Microsoft Office 2000

·        Microsoft Office XP

.

You can find an example of creating the OfficeControl UI element at Structure linkExample of Using an Office Document.

Note

If you have Microsoft Internet Explorer installed, check your Internet Options to find our whether the ActiveX control elements for executing and initializing are enabled. To do this, choose Internet Options ® Security ® Custom level ® ActiveX controls and plug-ins ® Enable. Otherwise, the Microsoft Word or Excel document cannot be displayed.

Description of the UI Element Properties

·        activateInPlace
Controls whether the document appears in the browser window or the system opens the Office application linked to the document type in a separate window to display the document. If you have assigned the value
false to the activateInPlace property and the value ms_word to the documentType property, the Microsoft Word application opens and display the content in the Microsoft Word user interface. The default value for this property is true.

Note
If you have assigned the value
false to this property, you should then make sure that you assign small values to the height and width properties, because these values are not ignored and act as placeholders in the view of the Web Dynpro application. In the view, the UI element takes up as much empty space as you have specified for the values of the height and width properties. You should therefore overwrite the default value of 300 with a smaller number, for example, 5.
If you have assigned the value
true to this property, you should use suitable values for displaying the document, so that the document is readable and the user does not have to scroll too often, because he or she cannot increase the size of the document in the browser window at runtime.

·        controlID
At the moment, you should not use this property.

·        dataSource
This property is used to specify the data source. You can use it to specify the path to the context attribute, which makes the data available. The context attribute must be of type
binary.

·        documentName
You can use this property to describe the document name.

·        documentName
You can use this property to describe the document type that is to appear. The
documentType property can take the following values and is represented by the list type WDOfficeDocumentType:

ms_word

Microsoft Word document with the doc file extension

ms_excel

Microsoft Excel document with the xls file extension

·        enableReadWrite
Determines the mode of the document to be opened and controls whether the user can edit the document and save it back with changed content.

·        showDecoration
This property does not currently affect the appearance of the document.

Overview of Inherited and Additional Properties

Name

Interface

Type

Initial Value

Bindable

Value Required

activateInPlace

IWDOfficeControl

boolean

true

bindable

No

controlId

IWDOfficeControl

String

 

not_bindable

No

dataSource

IWDOfficeControl

Object

 

bindable_mandatory

Yes

documentName

IWDOfficeControl

String

 

bindable

No

documentType

IWDOfficeControl

WDOfficeDocumentType

ms_word

bindable

No

enableReadWrite

IWDOfficeControl

boolean

true

bindable

No

enabled

IWDUIElement

boolean

true

bindable

No

height

IWDAbstractActiveComponent

String

300px

bindable

No

showDecoration

IWDOfficeControl

boolean

true

bindable

No

tooltip

IWDUIElement

String

 

bindable

No

visible

IWDUIElement

WDVisibility

visible

bindable

No

width

IWDAbstractActiveComponent

String

300px

bindable

No

Events

·        onClose
Describes the action that is executed when the document is closed. This is the case, when the document is displayed in a separate window and the user chooses either the key combination
Alt + F4 or the Close icon on the toolbar of the Office application to close the document. The onClose event is also triggered when the Web Dynpro application calls the method DOfficeControl.closeDocument(IWDController refToTheController,  String strControlId aufruft.

·        onSave
Describes the action that is executed when the document is saved. This is the case, when the user chooses either the key combination
Cntl + S or the Save icon on the toolbar of the Office application. The onSave event is also triggered when the Web Dynpro application calls the method WDOfficeControl.saveDocument(IWDController refToTheController,  String strControlId aufruft.

Data Binding

The dataSource property must be bound to a context attribute. The context attribute to which the dataSource UI element property is bound, must be of type binary.

For information about binding the UI element properties, see Structure linkExample of Using an Office Document.

Methods in the Web Dynpro IWDOfficeControl API

Method Name

Parameter

Return Value

Description

bindActivateInPlace

(String path)

 

Binds the value of the activateInPlace property to the content element specified by the path.

bindDataSource

(String path)

 

Binds the dataSource property to the context node specified by a path.

bindDocumentName

(String path)

 

Binds the value of the documentName property to the content element specified by the path.

bindDocumentType

(String path)

 

Binds the value of the documentType property to the content element specified by the path.

bindEnableReadWrite

(String path)

 

Binds the value of the enableReadWrite property to the content element specified by the path.

bindingOfActivateInPlace

 

String

Returns the path of the content element to which the activateInPlace property is bound. Returns NULL if no binding exists.

bindingOfDataSource

 

String

Returns the path of the context element to which the dataSource property is bound. Returns NULL if no binding exists.

bindingOfDocumentName

 

String

Returns the path of the content element to which the documentName property is bound. Returns NULL if no binding exists.

bindingOfDocumentType

 

String

Returns the path of the content element to which the documentType property is bound. Returns NULL if no binding exists.

bindingOfEnableReadWrite

 

String

Returns the path of the content element to which the enableReadWrite property is bound. Returns NULL if no binding exists.

bindingOfShowDecoration

 

String

Returns the path of the content element to which the showDecoration property is bound. Returns NULL if no binding exists.

bindShowDecoration

(String path)

 

Binds the value of the showDecoration property to the content element specified by the path.

getActivateInPlace

 

boolean

Returns the value of the activateInPlace property.

getControlId

 

String

Returns the value of the controlId property.

getDataSource

 

Object

Returns the value of the dataSource property.

getDocumentName

 

String

Returns the value of the documentName property.

getDocumentType

 

WDOfficeDocumentType

Returns the value of the documentType property.

getEnableReadWrite

 

boolean

Returns the value of the enableReadWrite property.

getOnClose

 

IWDAction

Returns the action that is executed when the event onClose is triggered.

getOnSave

 

IWDAction

Returns the action that is executed when the event onSave is triggered.

getShowDecoration

 

boolean

Returns the value of the showDecoration property.

mappingOfOnClose

 

IWDParameterMapping

Returns the parameter mapping for the onClose action.

mappingOfOnSave

 

IWDParameterMapping

Returns the parameter mapping for the onSave action.

setActivateInPlace

(boolean activateInPlace)

 

Sets the value of the activateInPlace property.

setControlId

(String controlId)

 

Sets the value of the controlId property.

setDataSource

(Object dataSource)

 

Sets the value of the dataSource property.

setDocumentName

(String documentName)

 

Sets the value of the documentName property.

setDocumentType

(WDOfficeDocumentType documentType)

 

Sets the value of the documentType property.

setEnableReadWrite

(boolean enableReadWrite)

 

Sets the value of the enableReadWrite property.

setOnClose

(IWDAction action)

 

Sets the action that is executed when the event onClose is triggered.

setOnSave

(IWDAction action)

 

Sets the action that is executed when the event onSave is triggered.

setShowDecoration

(boolean showDecoration)

 

Sets the value of the showDecoration property.

Additional methods described in the following APIs are available using inheritance: IWDAbstractActiveComponent, IWDUIElement, IWDViewElement.

  

  

 

Leaving content frame