Not able to grab data from Excel using TestComplete with wrapped text using Excel.Open("filename")..
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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:
https://urldefense.com/v3/__https://support.microsoft.com/en-us/office/download-and-install-microsof... <https://urldefense.com/v3/__https://support.microsoft.com/en-us/office/download-and-install-microsof...>
We are also referring to the example provided in the SmartBear documentation:
https://urldefense.com/v3/__https://support.smartbear.com/testcomplete/docs/testing-with/working-wit... <https://urldefense.com/v3/__https://support.smartbear.com/testcomplete/docs/testing-with/working-wit...>
Specifically, the section about Excel Object.
- Labels:
-
Desktop Testing
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Do you expect that the variable should be able to store that value with the carriage return ? We're trying to get the return value to compare it.
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The values in debug mode do not show up as expected somehow. Do we need to reference Excel differently using a Javascript method or something?
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Are you able to attach your Excel spreadsheet, so that I can have a quick look?
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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));
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Using the same code as you have written, all the text is shown. I can see from the tooltip, that there is a carriage return in some of your cells.
