RPA.Word.Application

Word.Application is a library for controlling the Word application.

Examples

Robot Framework

*** Settings *** Library RPA.Word.Application Task Setup Open Application Suite Teardown Quit Application *** Tasks *** Open existing file Open File old.docx Write Text Extra Line Text Write Text Another Extra Line of Text Save Document AS ${CURDIR}${/}new.docx ${texts}= Get all Texts Close Document

Python

from RPA.Word.Application import Application app = Application() app.open_application() app.open_file('old.docx') app.write_text('Extra Line Text') app.save_document_as('new.docx') app.quit_application()

Caveats

This library works on a Windows operating system with UI enabled only, and you must ensure that you open the app first with Open Application before running any other relevant keyword which requires to operate on an open app. The application is automatically closed at the end of the task execution, so this can be changed by importing the library with the autoexit=${False} setting.

*** Settings *** Library RPA.Excel|Outlook|Word.Application autoexit=${False}

If you're running the Process by Control Room through a custom self-hosted Worker service, then please make sure that you enable an RDP session by ticking "Use Desktop Connection" under the Step configuration.

If you still encounter issues with opening a document, please ensure that file can be opened first manually and dismiss any alert potentially blocking the process.

Check the documentation below for more info:

Importing

Initialize the library instance by wrapping the COM Windows app.

param autoexit:Automatically close the app when the process finishes.