What I´m trying to do is access data that I´ve specified inside Excel (xlsx) files from inside a user code module (I´m running Ranorex 4.1.1). All files have only one column, but vary in their number of rows. I want to read all the rows inside this first column.
I thought the easiest way would be to add all excel files using the "Manage Data Sources" menu, and access them later by their names defined there (e.g. NewConnector).
So after adding them, the first thing I tried was
Code: Select all
Ranorex.Core.Data.DataCache dataSource = DataSources.Get("NewConnector");
Then I read about the IList<DataCache> DataConnectorCache and thought I could access the files directly from inside the DataCache:
Code: Select all
var dataCache = TestSuite.Current.DataConnectorCaches;
Anyways, since that didn´t work either, I´ve then tried to access the files directly as described in this example.
Code: Select all
Ranorex.Core.Data.ExcelDataConnector excelConnector = new Ranorex.Core.Data.ExcelDataConnector("excelConnector",@"..\..\TestData\ScriptServiceControl\DeviceTypesToAssociatedScripts\" + pureDeviceName + ".xlsx","Tabelle1","",0);
Ranorex.Core.Data.ColumnCollection columnCollection;
Ranorex.Core.Data.RowCollection rowCollection;
excelConnector.LoadData(out columnCollection, out rowCollection);
Maybe someone else has already experience in doing this and can give me a few hints?