Object spy Word 2013 text

Ranorex Spy, Recorder, and Studio.
Matthias005
Posts: 4
Joined: Mon May 18, 2015 8:20 am

Object spy Word 2013 text

Post by Matthias005 » Mon May 18, 2015 8:37 am

Hello,

I'm doing research to the possibilities of Ranorex to test Word 2013 add-ins. These add-ins can create for instance templates. The problem I have is that when I want to verify text in a new opened template with document name: Document2 that I can't select specific text in de document. I can only add the whole page to my repository with all the text with the object spy. Does anybody knows how to add a specific line of text in the word document to my repositroy?
Thanks in advance.

krstcs
Ranorex Guru
Posts: 2683
Joined: Tue Feb 07, 2012 4:14 pm
Location: Austin, Texas, USA

Re: Object spy Word 2013 text

Post by krstcs » Mon May 18, 2015 1:44 pm

There are several forum posts asking similar questions, please search the forum before posting as you might find the answer.

For example: http://www.ranorex.com/forum/automation ... t6550.html
Shortcuts usually aren't...

Matthias005
Posts: 4
Joined: Mon May 18, 2015 8:20 am

Re: Object spy Word 2013 text

Post by Matthias005 » Tue May 19, 2015 8:37 am

I have tried serveral thing with the raw text for instance but I can't add specific lines of text to my repository. I've also added the Mircrosoft.Office.Interop.Word reference and use this:
var document1 = repo.Document1Word.Document1;
var wordDocObj = document1.GetWordDocumentObject();
var words = wordDocObj.Words;
foreach(Word.Range word in words)
{
Report.Info(word.Text);
}
It reports all the words that are in my word document but how can I validate these words or add then to my repository?

krstcs
Ranorex Guru
Posts: 2683
Joined: Tue Feb 07, 2012 4:14 pm
Location: Austin, Texas, USA

Re: Object spy Word 2013 text

Post by krstcs » Tue May 19, 2015 1:24 pm

I'm not sure what you mean by "add them to my repository". Could you explain what you mean by that? What are you trying to accomplish?

As for validation, you will need to do some string manipulation to pull out each word individually and validate that it is correct based on what you expect. That will require user-code most likely.
Shortcuts usually aren't...