cancel
Showing results for 
Search instead for 
Did you mean: 

Accessing Clipboard

Former Member
0 Kudos

Hi all,

I want to get Access to Clipboard in Windows.

Normally We can get Clipboard data as follows.

<i>Clipboard clip = Toolkit

.getDefaultToolkit()

.getSystemClipboard();

Transferable clipcont = clip

.getContents(System.class);

String output = (String)clipcont

.getTransferData(DataFlavor.stringFlavor);</i>

I couldnot get contents of clipboard with this way.

How can I Access to Clipboard.

Please tell me some idea.

Regards,

Nobuhiro Koyama.

Accepted Solutions (1)

Accepted Solutions (1)

htammen
Active Contributor
0 Kudos

Hi,

which clipboard do you want to access? I think the clipboard of the client. The clipboard of the server wouldn´t make sense.

Your Web Dynpro application is running at the server. I don´t think that it is possible to access the client clipboard from an application running at the server. To make it possible the Web Dynpro framework would have to send all clipboard data from the client to the server with each server request.

Another possible way would be to use Javascript at the clientside but you can´t use Javascript within your Web Dynpro applications.

Best regards

Helmut

Former Member
0 Kudos

Hi,Helmut.

Thank you for your kindness response.

you're right.

To get Clipbord Contents from Client,

I'll prepare a paste area with TextEdit UIElement

as it is very primitive.

thank you.

Regards,

Nobuhiro Koyama

But, Can we send clipboard data from the client to the server?

Message was edited by: Nobuhiro Koyama

hideyuki_amari
Explorer
0 Kudos

Hello Nobuhiro,

Would you describe why this function is required?

Do you want to use javascript to paste your clipboard data to a hidden inputfield (and then this data will be sent to server)?

I beleive we must not do such a thing, but technically it is possible to execute javascript if you use LinkToURL.

I'll show you how to do, but don't use it. I just want to know whether this kind of behavior meets your requirement or not.

<b>**** ONLY FOR TESTING. DON'T USE THIS! ****</b>

0. Create View (ex. SomeView)

1. Create LinkToURL

2. Create InputField which has string-type context.

(ex. InputField1 )

3. Change LinkToURL properties

target -> _self

reference ->

javascript:document.getElementById("KFHO.SomeView.InputField1").setAttribute("value",clipboardData.getData("Text"));

4. deploy app and run

5. click LinkToURL then your clipboard data will be transfered to InputField1

*With this sample, user has to click LinkToURL to execute javascript. But if we use iframe, we could execute javascript automatically and access the attribute of InputField1.value. (ex. parent.getElementById(.. )

Is this what you want to realize?

Regards,

Hideyuki

Former Member
0 Kudos

Just don't do it. This relies on internal HTML id's and does not conform to the Web Dynpro programming model.

Armin

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi, All.

Thank you for your answers.

I wish I would paste clipboard from Excel to Table UIElement,

Like "Paste From Clipbord" Button on R/3.

It seems Table UIElement cannnot treat Continuous data with line feed.

for example,

clipbord data:"ABC\nDEF\nGHI".

we could get only First Line;"ABC" when paste on Table UIElement.

I found,

Using "Link to URL" UIElement must not be used,

and Using WDPortalEventing API would be very Realistic solution.

I'll try. thank you all.

Regards, Nobuhiro.

hideyuki_amari
Explorer
0 Kudos

Hi,

Why don't you use OfficeControl?

With this UI element, you can embed excel ActiveX control in your Web Dynpro Application.

Users can paste their excel cell data.

And you can access excel data with Jakarta POI.

http://jakarta.apache.org/poi/hssf/index.html

*Latest HSSF can handle Japanese characters correctly. I tested this library and Web Dynpro combination. So far, there is no problem.

Regards,

Former Member
0 Kudos

A possible solution would be to write a Java applet that would use the WDPortalEventing API to send the contents of the clipboard to your application. (Most likely embedded in htmlb). You would put a small iFrame in your page that would navigate to your clipboardhandler whenever the content is needed.