Hi -
I am using QTP 10, TestAdvantage vol 2010.3 and Infragistics controls v 10.3.
My issue is exporting the contents of the grid to Excel. I don't see a way to specify the export path for the Excel file. I see that there is a SwfTable("grid").Object.Export method which takes an "exporter" object as an argument. How do I use this within QTP?
The only way I can accomplish this task is to right click and interact via the context menu, but this does not allow us to specify the path of the Excel file created.
I would appreciate it if you could help me out on this.
I have created a Custom Server class and added the method as below , which works good
public int ExportToExcel(string strFilePath) { UltraGrid objUltraWinGrid = (UltraGrid)SourceControl; UltraGridExcelExporter objUltraGridExcelExporter = new UltraGridExcelExporter();
objUltraGridExcelExporter.Export(objUltraWinGrid, strFilePath) return 0; }
but the issue here is that since testadvantage has the dll reference for Ultragrid I can't refer my DLL , eventually either of my dll or the vendor dll can be referenced . Is there any way by which we can have multiple reference dll for the same type of object in SwfConfig.xml (QTP config file for customer server references)? Or is there any other alternative?
Unfortunately this is currently not possible, albeit it is an interesting feature request. Although to be honest it is one that may have too many hurdles in its path to implement. First and foremost being, the Excel Exporter is part of a separate DLL then that of the UltraGrid DLL. Likely the only way you would be able to get the effect that you are looking for is to have your developer create a sub class of the UltraGrid and add a export method to it that takes a string for a path as its only argument and implements their own IUltraGridExporter or includes the ExcelExporter.