activities
latest
false
UiPath logo, featuring letters U and I in white

Productivity Activities

Last updated Dec 6, 2024

Manipulate Word Documents

The example below explains how to read the text from a Word file, write it into another document, add a picture, and convert it from Word to PDF by using activities such as Word Application Scope / Use Word File,Read Text, Append Text, Add Picture, or Save Document as PDF. You can find these activities in the UiPath.Word.Activities package.

Note: Download the example presented on this page in order to have access to all the files needed as Input for the explained workflow.

This is how the automation process can be built:

  1. Open Studio and create a new Process.
  2. Drag a Sequence container in the Workflow Designer.

    • Create the following variables:

      Variable Name

      Variable Type

      Default Value

      sourceDocument

      String

      "Raw Text.docx"

      destinationDocument

      String

      "About Samoyed.docx"

      rawTextFromSource

      String

      N/A
  3. Drag a Word Application Scope activity inside the Sequence container.

    • Add the variable sourceDocument in the Document path field.
  4. Drag a Read Text activity inside the Word Application Scope activity.

    • Add the variable rawTextFromSource in the Text field.
  5. Drag a Word Application Scope activity below the previous Word Application Scope activity.

    • Add the variable destinationDocument in the Document path field.
    • Select the Do container and create the following variables:

      Variable Name

      Variable Type

      Default Value

      picturePath

      String

      "Samoyed Picture.jpg"

      exportedDocToPdf

      String

      "About Samoyed.pdf"

  6. Drag an Append Text activity inside the Do container of the Word Application Scope activity.

    • Add the variable rawTextFromSource in the Text field.
  7. Drag an Add Picture activity below the Append Text activity.

    • In the Properties panel, add the variable picturePath in the PicturePath field.
  8. Drag an Export To PDF activity below the Add Picture activity.

    • Add the variable exportedDocToPdf in the File path field.
  9. Run the process. The robot reads the text from one document, writes it into another document, adds a picture. and converts it from Word to PDF.

Was this page helpful?

Get The Help You Need
Learning RPA - Automation Courses
UiPath Community Forum
Uipath Logo White
Trust and Security
© 2005-2024 UiPath. All rights reserved.