| || |
Paste from Clipboard to Active Data Table
I am trying to copy data from a source to the windows clipboard and then paste it into an Excel Active Data Table. I currently do not know of any SilkTest function for pasting from an active clipboard to an Active Table.
Any advice would be greatly appreciated
Thanks in Advance
Re: Paste from Clipboard to Active Data Table
So I have managed to piece together some code to copy data from a clipboard and write it to the Active Table for each row of a defined column (see bottom of message). This works well.
However, What I would like to do now is copy data to a clipboard from an "Excel Type" grid to the Active Data Table (SilkTest cannot recognise this Grid structure) regardless of its structure. The column by row structure can vary, for example in one instance it may be 4*2, or 6*10 in another. Currently, if I copy and paste manually from Our Application Grid to Excel, the Data Structure is preserved, e.g. if there are 2 columns and 4 rows copied; then the excel structure after pasting from the clipboard is the same,2*4.
So unlike in the example below, I cannot use a String type to copy from and writing to the active data table. I also would not need to paste the data for each row of a column as shown in the example below, but instead paste in on the first available cell of my active data table (this should always be an empty spreadsheet- I need to do this in order to use this data from this spreadsheet for other parts of the test). ATM I do not know how to do either of these. Perhaps there may even be a way to create and dump an Excel Data file containing data from the clipboard? -This is starting to make my brain hurt...
Public Module Main
Dim _desktop As Desktop = Agent.Desktop
Public Sub Main()
Using a As ActiveData = Workbench.LoadActiveData("MyActiveTable")
Dim row As ActiveDataRow
For Each row In a
Public Function GetClipboardText() As String
Dim objClipboard As IDataObject = Clipboard.GetDataObject()
If .GetDataPresent(DataFormats.Text) Then Return _
Public Sub SetClipboardText(ClipText As String)