How to get text from opened MS Word document ?

Technology specific object identification, supported applications, web technologies, and 3rd party controls.
ostap_osa
Posts: 1
Joined: Thu Jul 17, 2014 11:55 am

How to get text from opened MS Word document ?

Post by ostap_osa » Thu Jul 17, 2014 12:04 pm

Hi,

I am trying to get text from the MS Word document which is opened.
Actually what I am doing:
1. Open MS Word and create new document
2. Type "some words" on the document page
3. Try to verify text "some words" exists on the page

I need something like .GetText/.Text attribute but it is not available for such container:
Assert.Equals(repo.WordApp.Document.GetText(), "some words")

I have tried to do it by image validation/comparison, but it is not stable solution.

Thanks in advance,
Ostap

User avatar
Support Team
Site Admin
Site Admin
Posts: 12145
Joined: Fri Jul 07, 2006 4:30 pm
Location: Houston, Texas, USA
Contact:

Re: How to get text from opened MS Word document ?

Post by Support Team » Fri Jul 18, 2014 2:44 pm

Hi Ostap,

Have you already added the word process or the specific WordDoc class name to the GDI Capture List as described at the following page: Testing of Legacy Applications?
After you added it you should be able to track the text elements of a Word document.

Regards,
Markus