What findText returns is a list of Text, but that's totally interchangeable with Word. It appears InDesign can switch at will between Characters, Words, Lines, Paragraphs, and Stories.
Text can consist of one single SpecialCharacter (a column break, or a hard return, or any of the SpecialCharacters enumeration), or of a standard JavaScript "String" object -- a simple Unicode string.
The property that 'holds' the text is "contents" -- so, adding all of this up, to 'get' the text that has been found, you'd typically use
next = list.pop();
alert ("The text contents of this one is '"+next.contents+"'");
and you can build further on that -- using it as a HyperlinkDestination URL, or something like that. The Text item -- 'next' -- still points to the 'live' text it was found at, so be careful not to modify it. Doing something like
next.contents = 'hey what happened';
will change the actual text in your document. But it's also useful to add, for example, a hyperlink to the actual position this text was found on.
(A tip regarding changes: if you are to change your document, the original items findText pointed to will be messed up after you changed the first one! To prevent that, work backwards from the last item found to the first. findText(true) will reverse the order of found items, from last to first -- see the JS Help on that.)
As for
| (Also, how do you print the contents of a Word object?) |
that depends on what you mean with 'print'
. To a printer?