Activities
latest
false
Banner background image
Document Understanding Activities
Last updated Mar 28, 2024

Read XPS Files

The example below explains how to read an .xps file, extract the data, and provide the output in two message boxes by using Read XPS Text or Read XPS With OCR activities. You can find these activities in the UiPath.PDF.Activities package.

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

      ExactString

      String

       

      ExtractWithOCRString

      String

       
      Note: Add your .xps files to the project directory in order to be able to run the entire process from the same place.
  3. Drag a Read XPS Text activity inside the Sequence container.

    • In the Properties panel, add the expression "XPSTextDemo.xps" in the FileName field.
    • Add the value "All" in the Range field.
    • Add the variable ExactString in the Text field.
  4. Place a Message Box activity below the Read XPS Text activity.

    • In the Properties panel, select the Ok option from the Buttons drop-down list.
    • Add the variable ExactString in the Text field.
    • Select the check box for the TopMost option for always having the message box displayed to the foreground.
  5. Drag a Read XPS with OCR activity below the Message Box activity.

    • In the Properties panel, add the expression "XPSOCRDemo.xps" in the FileName field.
    • Add the value 1 in the DegreeOfParallelism field.
    • Add the value "1" in the Range field.
    • Add the variable ExtractWithOCRString in the Text field.
  6. Place a Microsoft OCR engine inside the Read XPS with OCR activity.
  7. Drag a Message Box activity below the Read XPS with OCR activity.

    • Add the expression ExtractWithOCRString in the Text field.
    • In the Properties panel, select the Ok option from the Buttons drop-down list.
    • Select the check box for the TopMost option for always having the message box displayed to the foreground.
    • This is how your workflow should look:



  8. Run the process. The robot extracts the data using the specified process and provides the output in two message boxes.

Download example from here.

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.