cancel
Showing results for 
Search instead for 
Did you mean: 

how to fill a Context attribute of type "binary"?

Former Member
0 Kudos

Hello,

I have a certain data that is being collected to a Context and displayed in a table.

I would like to display this data in Office Integrated Component and I see that this View Component expects a Context attribute of type "binary".

Can someone please show me a code example how to fill a Context attribute of type "binary"?

Thanx,

Roy

Message was edited by: Armin Reichert

(Marked as question)

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

The runtime equivalent of DDIC type binary is byte[]. Perhaps this helps.

Armin

Former Member
0 Kudos

Hey Armin,

Well, I have a problem here:

I bound the Office Control to an attribute "test" of type "bynary" and I see an empty word document. So far so good, but when I try to fill this attribute with content like this:

wdContext.currentContextElement().setTest(new String("hello").getBytes());

The Control is not being displayed, all I see is white square where it should be. Any idea why?

Roy

Former Member
0 Kudos

hi,

I think thats because when u read a word doc using file upload that will have details related to type of file etc., also in binary.. so when u give a string directly and try to give it as binary input for word doc it wont work .

Regards

Bharathwaj

Former Member
0 Kudos

Hey Bharathwaj,

So what you're basicly saying that I must write the data inside the context to a file, upload it again to the Context and then assign it to the Office Control? Sounds very wasted method, are you sure this is the only solution here?

Former Member
0 Kudos

Hi ,

Office control is for opening word and excel files only. If we give a word or excel file in binary format it will open .Otherwise it cant.

(Make sure that ur ActiveX settings are enabled in the browser when using office control...)

And what is u r scenario.. ???why do you want office control to display any binary data.. du u want to show some preview kinda stuff.. please elobarate the scenario

regards

Bharathwaj

Former Member
0 Kudos

Hey Bharathwaj,

Consider the following scanario:

I have a table filled with some details, for simplicilty let's say each row represents a User and the coloums are his/her details.

I would like to create an option for the user to export this data to Word/Excel file and to preview the data before exporting it. For that I need to fill to Office Control with the data present at the Context node bounded to the table. Now how do I do that?

(THe ActiveX settings are already enabled 10X )

Former Member
0 Kudos

Hi,

I dont think there is any direct way available.Giving string directly wont work. why cant you create a look alike(rather similar) view in webdynpro adn show preview in it..

Regards

Bharathwaj

Former Member
0 Kudos

Hi,

But even if I create a look alike view, I would like the user to be able to save it to an excel file. More than that the Office Control has most of the excel built-in functions in it, you don't suggest I'll develop this by myself...

Former Member
0 Kudos

Hi,

Thats very true. you can save your document programatically..But the options are unlimited if u use a office control..

Better create and share it with us..

Former Member
0 Kudos

Is it essential that the previewer is a Web Dynpro UI element and not Excel itself?

A very simple way to export Web Dynpro table data to Excel (works with Office 2003, not sure about earlier versions) is to convert the data to XML and use the IWDCachedWebResource API to create an URL. Pointing a LinkToURL element to this URL will open Excel.

Bertram Ganz has extended the table tutorial to demonstrate this feature.

Armin

Former Member
0 Kudos

Hey Armin,

Do you have a reference to this extended tutorial?

Roy

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi Roy ,

1. Please write the data into a file

2. Create contextattrib of type binary

3. Use fileUpload control to select the file and set its datasource property to above ContextAttrib.

4. Set the OfficeControl datasource to the same context attrib.

Regards, Anilkumar

Former Member
0 Kudos

Hey Anilkumar,

But why writing the data into a file and then uploading it again when it is alreay inside the Context, can't I simply move and change the content in the context to an attribute of type binary?

Message was edited by: Roy Cohen