开发者

How to copy multiple elements to clipboard in Flex?

My aim is to copy multiple row content from Flex datagrid, to a clipboard enabling users to take pieces of information and pasting them were they are necessary. I bumped into a problem that in Flex (as far 开发者_C百科as I know) its not possible to paste whole array of information in the clipboard.

At the moment, I pass selected datagrid items to a textfield, and then run "System.setClipboard(text_area.text);"

I was wonderng if there is a way to pass it to multiple Clipboard directories, without overwriting previous entry, similar as when you can copy multiple items from different location into a clipboard, pile them up and then paste all at once?


Flex can put any string value into a clipboard. It doesn't support--as far as I know--complex values, such as arrays. That said, you can convert your array into something along the lines of a comma or tab delimited file.

Separate rows using carriage return and line feeds. Separate columns using commas tabs. Conceptually something like this:

resultString += row1Column1 + ',' + row1Column2 + '\r\n';
resultString += row2Column1 + ',' + row2Column2 + '\r\n';

You didn't tell us how / why you want to preserve formatting. I know cutting and pasting from Flex to Excel will recongnize the carriage return / line feeds as rows. I do not know if it will automatically detect multiple columns using a comma or tab, though.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜