Forum Discussion

blearyeye's avatar
blearyeye
Contributor
14 years ago

Support for Crystal Reports viewer

I have a C# 4.0 winform application that uses the Crystal Reports viewer. Is there any way to pick off report data with TestComplete 8? The TC object browser doesn't seem to expose that, and I can't find anything relevant in TC-related help.

  • Hi Bill,





    It is possible to export a report's contents to an Excel file and read data from the file after that. You can read Excel files either using the Data-Driven Testing feature (DDT), or via OLE. Please see the Using DDT Drivers help topic for more information on using DDT.





    The following function demonstrates how to use OLE:







    function ExcelOLE()

    {

      var OLEObj = Sys.OleObject("Excel.Application");

      OLEObj.Workbooks.Open("C:\\book.xls");

      OLEObj.Worksheets("Sheet1").Activate();

      

      var row = 3, col = 4;

      var cell_text = OLEObj.ActiveSheet.Cells(row, col).Text;

      OLEObj.Quit();

    }







    In addition to that, you can try using the Text Recognition feature of TestComplete (see the Using Text Recognition Technology help topic for more information).


  • Thanks. How do I export the report contents as an Excel file? Do I do that in C# or in a TC script?

  • Hi Bill,





    You should be able to export the report contents using your apllication's GUI - just record and playback the needed actions with TestComplete.