http://www.ranorex.com/blog/transfering-data-to-and-from-a-net-control
The FarPoint Spread is an Excel-like spreadsheet control that has several rows and columns that all contain some data. I am attempting to use the InvokeRemotely method to retrieve a 2-dimensional array of values representing the cells in the spread. The code I have come up with is as follows:
- Code: Select all
Ranorex.Control spread = new Ranorex.Control(spreadControl.Element);
string[][] cellValues = (string[][])spread.InvokeRemotely(
delegate(System.Windows.Forms.Control control, object input)
{
StandardSpreadsheetControl ssc = (StandardSpreadsheetControl)control;
FarPoint.Win.Spread.SheetView sv = ssc.ActiveSheet;
string[,] values = new string[sv.Rows.Count, sv.Columns.Count];
for (int row = 0; row < sv.Rows.Count; row++)
{
for (int col = 0; col < sv.Columns.Count; col++)
{
values[row, col] =
sv.Cells[row, col].Value.ToString();
}
}
return values;
});
However, this code will not execute. Anytime I try to execute this code, I receive the following exception:
Ranorex.ActionFailedException: Action 'invokeremotely' failed on element '{Unknown:fpSpread}'. ---> System.Runtime.Serialization.SerializationException: Failed to get data from remote process.
at Ranorex.Plugin.WinFormsFlavorElement.InvokeRemotely(RemotelyInvokedDelegate deleg, Object inputData, Duration timeout)
at Ranorex.Plugin.WinFormsFlavorElement.InvokeAction(Element element, String name, Object[] args)
at Ranorex.Core.Element.InvokeAction(String name, Object[] args)
Is the code that I have posted above incorrect, or is it just not possible to use the InvokeRemotely method with this third party control?