Set bookmark Version 1 (Python)

Action group: Office


Description

The action sets a bookmark in the document

Action icon

Settings of parameters

PropertyDescriptionTypeFilling exampleMandatory field
Parameters
ContextContext for working with a documentRobin.OpenTextDo c
Yes
Bookmarks nameThe name of the bookmark to be added to the document. Bookmark names must start with a letter. They can contain numbers and letters, but not spaces.Robin.String
Yes
Insertion textThe text relative to the position of which the bookmark will be addedRobin.String
Yes
Add text toThe location of the bookmark relative to the specified text. The bookmark will be added on the first match of the textRobin.String
Yes
Sequence number of the matchThe ordinal number of the match of the value being searched for. If the field is empty, then the bookmark will be added by the first match of the text. Numbering starts at 1. To find the last match, you must specify -1.Robin.Numeric
No

Special conditions of use

None.

Example of use

Task 

There is a file test (2).docx. with a list of names. You need to add a bookmark to the document after the name "Masha". Then, save the document and close it. 

Solution

Use the "Open", "Set bookmark", "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. Drag the "Set bookmark" action to the workspace and fill in its parameters
    In the "Context" field, specify the context created in step 1.
    In the "Bookmarks name" field specify the value "BookmarkTest".
    In the "Insertion text" field specify the name "Masha". 
    In the "Add text to" field specify the value "After the specified text".
  3. Move the "Save" action to the workspace and set its parameter.
    In the context field specify the context of the open document.
  4. Move the "Close" action to the workspace and set its parameter.


  5. Click "Start" in the top panel.

Result

The program robot completed successfully.

The bookmark is set to the desired location in the text. The file is saved and closed.

  • Нет меток