Hi Ilhan,
You can use the script below:
function WriteStringToDOC(path, str) {
var WordObject = Sys.OleObject("Word.Application");
WordObject.Documents.Open(path);
WordObject.ActiveDocument.Content = str;
WordObject.ActiveDocument.SaveAs(path);
WordObject.ActiveDocument.Close();
WordObject.Quit();
WordObject = null;
while (Sys.WaitProcess("WINWORD", 500).Exists) {
Delay(500);
}
}
// ...
WriteStringToDOC('c:\\input.doc', 'Sample String');
// ...
As for exporting the test log to Microsoft Word, I can suggest you some resources which can help you accomplish your task:
* First of all, I recommend that you take a look at the
"Scripting Access to the Test Log Contents" help topic - it contains a sample script which can be used to export a test log to a text file.
* A sample project showing how you can work with Word from TestComplete is shipped with the tool. You can find information on that sample in the "MSOffice" section of the
"Miscellaneous Samples" help topic.
* To insert retrieved data into a Word document, you can work with Microsoft Word via COM. Refer to the
Word Object Model MSDN Library article.
I hope this helps.