Forum Discussion

Saira16's avatar
Saira16
Occasional Contributor
5 years ago

Working with Word document and identifying the last line

Dear All

Thanks for all your suggestions for my previous query. I have a new query, request you to help on this. Currently i am planning to create a report in word file, where i can add text and also screenshot for detailing. I have found way to add text and also to add screenshot to word. But when the log gets added, text is getting placed in same line and in sameway screenshots are also placed over the same line. So everything falls in a cluster.

 

Please help me to know how to add text and screenshot in next line to the previous line. I tried to activate the document and give keyboard action using Sys.Keys("[Enter]"), which dint work out. Also there are very less content regarding working with word, so i got stuck here.

 

Thanks

Saira

  • Could you tell us how you access Word and more information on the work already done ?

     

    Did u follow the TC sample:

    <TestComplete 14 Samples>\Common\MSOffice\JScript\Word_JScript

     

     

     

     

  • BenoitB's avatar
    BenoitB
    Community Hero

    Could you tell us how you access Word and more information on the work already done ?

     

    Did u follow the TC sample:

    <TestComplete 14 Samples>\Common\MSOffice\JScript\Word_JScript

     

     

     

     

    • Saira16's avatar
      Saira16
      Occasional Contributor

      Sorry for late reply, i tried with link you shared and got what i wanted. Thanks for your help.

  • Wamboo's avatar
    Wamboo
    Community Hero

    Hi

     

    As BenoitB said before. An example You can see these lines of code:

     

     

      // Makes the title 
      SelectFont("Arial", 24, wdBlue, true, false);
      MsWord.Selection.InsertAfter("TestComplete Report");
      Doc.Paragraphs.Add();
      MsWord.Selection.MoveDown(wdParagraph, 1);

     

    Based on this example you will achieve the desired result.

     

    • TanyaYatskovska's avatar
      TanyaYatskovska
      SmartBear Alumni (Retired)

      Thanks for the suggestions, guys!

       

      Saira16, was the issue resolved? Please let us know if you need any more assistance.

      • Saira16's avatar
        Saira16
        Occasional Contributor

        Yes, by trying out one of the method as suggested above in the link i was able to move forward. Thanks

    • Saira16's avatar
      Saira16
      Occasional Contributor

      Thanks for your suggestion, i will also try to use this. Currently  i have tried the solution provided above by BenoitB. I will also try your suggestion.