Сравнение версий

Ключ

  • Эта строка добавлена.
  • Эта строка удалена.
  • Изменено форматирование.

...

Get table Version 10 (Net)

Группа действийAction group: Word

Описание

Сохраняет таблицу из документа в переменную типа Таблица.

Иконка

Image Removed

Параметры

Входные параметры

Контекст                                   Уникальный идентификатор сеанса, к которому будет применено действие.

Номер таблицы                       Порядковый номер таблицы в документе.

С заголовком                           Если значение «true», первая строка таблицы будет выделена отдельно как заголовок и не будет входить в строки с содержимым таблицы.

Убрать дубли заголовка          Если значение «true», в заголовке полученной таблицы к одинаковым названиям столбцов будут добавлены индексы.

Выходные параметры

Результат В результате получаем таблицу.

Настройки

...

Свойство

...

Англ. наименование

...

Описание

...

Тип

...

Порядковый номер таблицы в документе.

Порядок начинается с 1.

Значение по умолчанию "1"

...

Heading

...

Логический

...

true

...

Нет

...

true

...

Нет

...

Особые условия использования

Для чек-бокса "С заголовком": 

Работа параметра: При значении "true" действие первую строку исходной таблицы сохранит в заголовок возвращаемого табличного значения, т.е. она не будет являться строкой с содержимым таблицы.
 При "false" первую строку оставит в части с содержимым таблицы, а в заголовке будут использоваться названия по умолчанию - 1, 2, 3 и т.д.

Пример:

Забираем таблицу:
Image Removed

При включенном параметре в логе будет указано "Столбцов: 3; строк: 2", т.к. Первая строка взятой области стала заголовком с названиями столбцов "№", "Название" и "Тесты". К этим заголовкам нельзя обратиться как к строке данных, чтобы прочитать, но можно использовать имена столбцов, чтобы обратиться к конкретной ячейке или столбцу (действиями из группы "Таблицы"). Если параметр выключен, то в логе будет указано "Столбцов: 3; строк: 3", названия столбцов в заголовке будут "1", "2" и "3".

Для чек-бокса "Убрать дубли заголовка": 

...

Description

The action saves the table from the document in the Table type variable.

Action icon

Image Added

Settings of parameters

ParameterDescription
ContextThe unique session identifier of the session to which the action will be applied.
Table numberSerial number of the table in the document.
HeadingIf the value is "true", the table header will be inserted into the document along with its rows.
Remove duplicate headerIf the value is "true", indexes will be added to the same column names in the header of the resulting table.

Output parameters 

Result - result table.

Settings

PropertyDescriptionTypeFilling exampleMandatory field
Parameters
Word-documentAn instance of the Word document.Robin.WordWord contextYes
Table numberSerial number of the table in the document. Order starts at 1. Default is "1"Robin.Numeric
No
HeadingIf the value is "true", the table header will be inserted into the document along with its rows.Robin.BooleantrueNo
Remove duplicate headerIf 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.BooleantrueNo
Results
ResultResult tableRobin.DataTable

Special conditions of use

For "Heading" checkbox:

Parameter in action: if true, the action will save the first row of the source table into the header of the returned table value, i.e. it will not be a row with the table contents.
If "false", the first row will leave the table content part and the heading will use the default names - 1, 2, 3, etc.

Example:

Get the spreadsheet:
Image Added

With this parameter enabled, the log will show "Columns: 3; rows: 2" because the first row of the taken area has become a header with the column names "No.", "Title", and "Tests". These headings cannot be accessed as a row of data to read, but you can use the column names to access a specific cell or column (actions from the Tables group). If the option is off, the log will show "Columns: 3; rows: 3", the column names in the header will be "1", "2" and "3".


For "Remove duplicate header" checkbox:

  • If "true", the heading of the table value that the actions return as a result will have indexes added to the same column names. The numbering starts from 1. 
    Example No.1:

    You have a table:

    Image Added
    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:
    You have a table:
    Image Added
    When "Remove duplicate header" = true, and "Heading" = true, the "Get 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".
  • If "false", the column names will remain the same. Actions on net that return/process such tables with duplicated column names will crash with an error, because net cannot have a header with the same column names.
  • For example, the source table has columns "Test1", "Test" and "Test". If we add indexes only to the current doubles, the names will become "Test1", "Test1" and "Test2", i.e. new doubles with the name "Test1" will appear. Therefore, when renaming a particular column, the action should check if another column already has such a name and if there is such a match, the current column should have the next index. That is, in this case the action will rename the columns as "Test1", "Test2" and "Test3".

Example of use

Task

Save the table from the Word-document to a Table type variable.

Image Added

Solution

Use the "Open document", "Get table", "Close document" actions.

Implementation

  1. Assemble a robot scheme with the "Word" action group actions.
    Image Added

  2. Set the "Open document" action parameters.
  3. Image Added

  4. Set the "Get table" action parameters.
    Image Added

  5. Set the "Close document" action parameter.
    Image Added

  6. Start the robot by clicking "Start" in the top panel.

Result

The program robot completed successfully. The table was obtained.

Image Added

  • При значении "false", названия столбцов останутся прежними. Действия на net, которые возвращают\обрабатывают такие таблицы с задублированными названиями столбцов, будут падать с ошибкой, т.к. в net не может быть заголовка с одинаковыми названиями столбцов.
  • Например, в исходной таблице есть столбцы "Тест1", "Тест" и "Тест". Если добавлять индексы только к текущим дублям, то названия станут такими "Тест1", "Тест1" и "Тест2", т.е. в итоге появятся новые дубли с названием "Тест1". Поэтому действие при переименовании конкретного столбца должно проверять, нет ли уже такого названия у другого столбца и при наличии таких совпадений проставлять у текущего столбца следующий по счету индекс. Т.е. в данном случае действие переименует столбцы как "Тест1", "Тест2" и "Тест3".

Пример использования 

Задача

Необходимо сохранить таблицу из документа Word в переменную типа "таблица". 

Image Removed

Решение

Воспользоваться действиями: "Открыть", "Взять таблицу", "Закрыть". 

Реализация

...

Результат

Программный робот отработал успешно. Таблица получена. 

Image Removed