Comparing Word field exchange to testcomplate value
I'm busy with creating a automated test to compare the field exchange values of a word document to text on a website.
There I'm stuck and don't know how to make testcomplete open the word document or print it out.
I've just provided example code of opening a word document (document not provided); display number of paragraphs and output the first paragraph. It should be enough to get you started.
A better version of the example code,
function Test4() { var word = getActiveXObject("Word.Application"); word.Documents.Open('C:\\Temp\\Word.docx'); word.Visible = true; var paragraphs = word.ActiveDocument.Paragraphs; for (var i = 1; i <= paragraphs.Count; i++) { Log.Message(paragraphs.Item(i)); } word.Quit(false); }
which outputs all paragraphs.
If the document structure is always the same, but the content is different. Then instead of having paragraphs output to log, you can store each paragraph into an array, which you can then use afterward e.g. to compare date, select fields etc.
You need to define your data structure, and decide which values you intent to use, operation to perform etc. if applicable.