activities
latest
false
UiPath logo, featuring letters U and I in white
Document Understanding Activities
Last updated Nov 21, 2024

Read XPS files

The example after 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.
Steps
  1. Open Studio and create a new Process.
  2. Drag a Sequence container in the Workflow Designer.
    • Create the variables from the following table:
      Table 1. Variables to be created
       

      Variable Type

      Default Value

      ExactString

      String

      N/A

      ExtractWithOCRString

      String

      N/A
      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 after the Read XPS Text activity.
    • In the Properties panel, select the Ok option from the Buttons dropdown 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 after 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 after 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.
  8. Run the process. The robot extracts the data using the specified process and provides the output in two message boxes.
Visit the following link to download the example in a ZIP format: Example.

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.