get_table_text_block_by_index_odt

get_table_text_block_by_index_odt(string file_path, int table_index, int timeout = 300): string

Получить текст таблицы по порядковому номеру (отсчет с 0)

Команда на вход принимает параметры:
  • file_path – путь к файлу
  • table_index – индекс таблицы (отсчет с 0)
  • timeout – таймаут на исполнение операции, сек
После отработки команда возвращает результат своей работы в робот:
  • Текст - текст таблицы или пустая строка, если индекс вне диапазона



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

<?php
// Scenario: Extract table text by index from an ODT document
 
$xhe_host = "127.0.0.1:7010";
 
// подключим функциональные объекты, если еще не подключен
if (!isset($path)){
    // Path to the init.php file for connecting to the XHE API
    $path = "../../../Templates/init.php";
    // Including init.php grants access to all classes and functionality for working with the XHE API
    require($path);
}
 
echo "\n<span >libreOffice->".basename (__FILE__)."</span>\n";
 
// Example 1: Get the first table from a document
echo "\n\nExample 1: Getting the first table from a document\n";
$filePath = "test/test_style.odt";
$tableIndex = 0;
$tableText = SYSTEM::$libreOffice->get_table_text_block_by_index_odt($filePath, $tableIndex);
 
if (!empty($tableText)) {
    echo "Table $tableIndex:\n{$tableText}\n";
} else {
    echo "No table found at index $tableIndex or error occurred.\n";
}
 
// Quit the application
WINDOW::$app->quit();
 
?>