Not able to grab data from Excel using TestComplete with wrapped text using Excel.Open("filename")..
We are using the Excel.Open("FileName").SheetByIndex(0).Cell("A",6).Value to grab data from excel. The method works overall, but does not capture the wrapped text from Excel. The result of the data gets only the top row of data in the cell if the data has multiple rows within the cell due to format wrapping.
I also want to include that we are not using the full version of Excel. We are only using the runtime available from Microsoft:
We are also referring to the example provided in the SmartBear documentation:
Specifically, the section about Excel Object.
I think your Excel data seems to have a carriage return.
Log.Message() method will not display multiple lines.
If you try the code example from Excel.Open Method, and inspect the variable values in debug mode, it will contain the full value.
Also, avoid many Excel.Open methods like you have done - unless you are just showing an example of the issue.
Can you hover your mouse of the message, it should show a tooltip containing the entire string.
I would think that the WordWrap is causing the issue. Not sure we can go about fixing this problem at this point. We tried to remove the \n carriage return, but it was more related to the wrap.
Try some modify your code:
var excel = Sys.OleObject("Excel.Application"); excel["Workbooks"].Open(path_to_excel_file); excel["Sheets"](name_of_sheet).Select(); //Get value from cell with rowIndex = 6, columnIndex = 1 var text_from_cell = aqConvert.VarToStr(excel["Cells"](6,1));
We are trying to not have Excel loaded onto the VM and use the Excel method from SmartBear. We have already used the "Excel.Application" before and it was working.