Get bookmarks Version 1 (Python)
Action group: Office
Description
The action retrieves a list of bookmark names from the document
Action icon
Settings of parameters
Property | Description | Type | Filling example | Mandatory field |
Parameters | ||||
Context | Context for working with a document | Robin.OpenTextDo c | Yes | |
Results | ||||
Result | Collection of names of existing bookmarks | Robin.Collection |
Special conditions of use
None.
Example of use
Task
There is a file test (2).docx. A bookmark with the name "Bookmark1" is set in it. It is necessary to get the name of the bookmark into a variable and enter the text after the bookmark "New text". Then, save the document and close it.
Solution
Use the "Open", "Get bookmarks", "Enter text", "Save", "Close" actions.
Implementation
- Move the "Open" action to the workspace and set its parameters.
In the "Path to file" field specify the path to file test (2).docx. - Move the "Get bookmarks" action to the workspace and set its parameters.
In the variable "Context" specify the context of the opened document.
In the variable "Result" specify a variable of the type "Collection" (in this case "Name bookmarks"). - Move the "Enter text" action to the workspace and set its parameters
In the "Context" field, specify the context created in step 1.
In the "Text" field specify the value "New text".
In the "Add text to" field specify the value "After the bookmark".
In the "Bookmark name" field, specify the "Name bookmarks 1" variable created earlier.
Checkbox=true in the "On a new line" field. - Move the "Save" action to the workspace and set its parameter.
In the context field specify the context of the open document. - Move the "Close" action to the workspace and set its parameter.
- Click "Start" in the top panel.
Result
The program robot completed successfully.
Text is added to the document after the bookmark. The file is saved and closed.
Обзор
Инструменты контента