Action group: Office
The action saves the table from the document to a variable of type Table
Property | Description | Type | Filling example | Mandatory field |
Parameters | ||||
Context | Context for working with a document | Robin.OpenTextDo c | Yes | |
Table number | The number of the table in the document. The order starts from 1. The default value is 1 | Robin.Numeric | No | |
Heading | If the value is «true», the table header will be inserted into the document along with its rows. | Robin.Boolean | true | No |
Remove duplicate header | If the value is «true», indexes will be added to the same column names in the header of the resulting table. Numbering starts from 1. | Robin.Boolean | true | No |
Results | ||||
Result | Result table | Robin.DataTable |
For the "Heading" parameter:
Take table:
If the "Heading" parameter is turned off, the "Insert data table" action will have the following message in the log
If the "Heading" parameter is turned on, the "Insert data table" action will have the following message in the log
Let's consider an example on getting a table and inserting it into a document depending on the configured parameter "Heading".
The robot scheme consists of actions: "Open", '"Get table", "Save", "Insert data table", "Save".
The table shows an example of the result depending on the filling of the "Heading" parameter.
No. | Filling the "Heading" checkbox for the "Get table" action | Filling the "Heading" checkbox in the "Insert data table" action | Result |
---|---|---|---|
1 | true | true | |
2 | false | false | |
3 | true | false | |
4 | false | true |
Thus, if "true", the action will keep the first row of the source table in the header of the returned tabular value, i.e. it will not be the row with the table contents.
When "false", the first row will remain in the table content part, and the default names will be used in the header - 1, 2, 3, etc.
For the "Remove duplicate header" option
Example No.1:
There is a table:
With "Remove duplicate header" = true, and "Heading" = True, the "Take Table" action will return a table of 10 rows and 4 columns. The column names of this table will be "No.", "Robot Name", "Tests1", "Tests2".
Example No.2:
There is a table:
When "Remove duplicate header" = true, and "Heading" = True, the "Take Table" action will return a table of 4 rows and 5 columns. The column names of this table will be:
"Test31", ‘Test21’, ‘Test22’, ‘Test32’, ‘Test1’.
There is a file test.docx. You need to open the document and get the table with data from there (there is only one table in the document). Then, save the document and close it.
Use the "Open", "Get table", "Save", "Close" actions.
The program robot completed successfully.
The table from the document has been successfully saved to a variable. The file is saved and closed.