Additional Blogs by Members
cancel
Showing results for 
Search instead for 
Did you mean: 
Former Member
0 Kudos

In many application scenarioes we can't store the documents always in mimes folder.We would like open documents dynamically .Here we will see how can we use FileUpload along with OfficeControl.

We can reuse the code from weblog Office control in WebDynpro - I for basic operations like opening and closing the document. Here we will look into the properties of Office UIElement and File Upload and we will see how can we convert/pass the data from FileUpload UIElement to Office control.

First we look into the FileUpload .For this control we have attribute called "resource" which can be bound to a value attribute of type "Resource" (Dictionay Simple Type)

Basically we need to convert "Resource" type to byte array which is the data source for Office UIElement

Lets look into the IWDResource API. It has a read(boolean) method which will return InputStream. Once we get InputStream then half of the job is done !! Just we need to convert this InputStream into a byte array.

Find the code below to convert from InputStream to ByteArray.Before that lets design the UI. Create fileUpload UIElement and create valueattribute of type "Resource". Create a button with label "Load" and create an action and bind it to the "Load" button



Here is the snapshot of the application where the user is allowed to open documents using Fileupload and onclick of Load button he can able view the document in OfficeControl reagion.


6 Comments