ni.com is currently undergoing scheduled maintenance.

Some services may be unavailable at this time. Please contact us for help or try again later.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Control that supports copy-paste from Excel?

Solved!
Go to solution

Hi!

 

Is there a control that supports simple cell copy-paste from Excel?  I'm making a program and a lot of data I can envision my user copy-pasting from Excel spreadsheets.

 

Arrays don't work and Table controls don't work...

 

I've found an ActiveX control called "Microsoft Office Spreadsheet 11.0."  That works, but I don't like the idea of my code being dependent on a particular version of Office being installed.

 

Any help is appreciated!

 

-nic

0 Kudos
Message 1 of 7
(4,473 Views)
Solution
Accepted by topic author hecmar.arreola

Hi,

 

You can use an invoke node App.Clipboard Read to get the data in tab-delimited format. You can then manipulate this string data into your array or table.

 

cheers

 

David

Message 2 of 7
(4,464 Views)

Thanks for the response, David.

 

I'm browsing through the various events available, and not seeing what I am looking for.  Is there a way to detect a "paste" event into my table control.  I could do some "Key Down" type events  I suppose.  I could also use a button "paste into table" or something...

 

-Nic

0 Kudos
Message 3 of 7
(4,457 Views)
Apparently "Ctrl-V" will not generate a "Key Down" event because there is a Menu shortcut with Ctrl-V....
0 Kudos
Message 4 of 7
(4,455 Views)

I think using a button to action the paste of the data will be your easiest option to try and see if it works out OK for you functionally.

0 Kudos
Message 5 of 7
(4,452 Views)

Nickerbocker wrote:
Apparently "Ctrl-V" will not generate a "Key Down" event because there is a Menu shortcut with Ctrl-V....

If you use a 'Menu Selection? (App)' event, you can look for the 'APP_PASTE' ItemTag, discard the usual event and do your own paste.

Message 6 of 7
(4,448 Views)

Weeeeee..... well, that was fun.

 

The only issue with the "Menu Selection? (App)" event is if I wanted to have paste features elsewhere.  I think I'll end up using a button for pasting...there is an issue with the attached code that if the user is "in" a cell, that cell doesn't get the pasted data.  There is also an issue if the user wants to paste a single string to a cell in my table as oppose to strings from an excel spreadsheet.

 
Paste from Excel into Table.png

-nic

Message 7 of 7
(4,423 Views)