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

PropertyDescriptionTypeFilling exampleMandatory field
Parameters
ContextContext for working with a documentRobin.OpenTextDo c
Yes
Results
ResultCollection of names of existing bookmarksRobin.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

  1. 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.

  2. 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"). 
  3. 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. 

  4. Move the "Save" action to the workspace and set its parameter.
    In the context field specify the context of the open document.

  5. Move the "Close" action to the workspace and set its parameter.


  6. 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.

  • Нет меток