Skip to Content
Author's profile photo Former Member

Office Control in WebDynpro II

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.

image

Assigned Tags

      6 Comments
      You must be Logged on to comment or reply to a post.
      Author's profile photo Former Member
      Former Member
      Hi Anil,
          good blog and helpful information. Thanks!
      Author's profile photo Former Member
      Former Member
      Thanks Venkat for your comments .

      Regards,Anilkumar

      Author's profile photo Former Member
      Former Member
      The information given regarding Office controll in WebDynPro is really excellent.  Keep going with innovation. 
      Best Regards,
      VENUGOPAL
      Author's profile photo Former Member
      Former Member
      The information given regarding Office controll in WebDynPro is really excellent.  Keep going with innovation. 
      Best Regards,
      VENUGOPAL
      Author's profile photo Former Member
      Former Member
      Thanks Venu for your motivating comments 🙂
      -Anilkumar
      Author's profile photo vaishali dhayalan
      vaishali dhayalan
      Hi,

      Need help for this scenario:

      I need to read an xml file and display it in a table.

      i need to choose the file using the file browser window.

      I have used the fileupload UI element. Through this i can browse the file location adn the path is seen in the input field beside the browse button. Please can i know how can i access this path in my code.

      i need to get the path in a string and then my rest of the logic follows.

      Help REquired.Urgent.

      Thanks,
      Vaishali