humanemulator.net — справка. Продукт, демо и покупка — на хуманэмулятор.рф | Демо | Купить | API | Changelog

set_standard_text_block_page_break

set_standard_text_block_page_break($standard_text_block_page_break,$timeout=300); - Задать текст для обозначения разрыва страницы

Функция на вход принимает параметры:

  • $standard_text_block_page_break – Текст для обозначения разрыва страницы
  • $timeout – Таймаут на исполнение операции, сек

    После выполнения функции возвращаемое значение будет равно одному из двух :
  • true – успешно
  • false – не удалось

    Пример использования
    <?php
    /**
     * Example for set_standard_text_block_page_break function
     *
     * This example demonstrates how to set the text used to denote page breaks
     * when extracting content from ODT files using the XHELibreOffice class.
     */
    
    // Scenario: Set the text used to denote page breaks when extracting content from ODT files
    
    $xhe_host = getenv("RPABOT_HOST_URL");
    
    // подключим функциональные объекты, если еще не подключен
    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: Set a custom page break marker
    echo "\n\nExample 1: Setting a custom page break marker\n";
    $customMarker = "=== PAGE BREAK ===";
    $result = SYSTEM::$libreOffice->set_standard_text_block_page_break($customMarker);
    
    if ($result) {
        echo "Successfully set page break marker to: '{$customMarker}'\n";
    } else {
        echo "Error: Failed to set page break marker.\n";
    }
    
    // Example 2: Test the custom marker by extracting page breaks
    echo "\n\nExample 2: Testing the custom marker by extracting page breaks\n";
    $filePath = "test/test_style.odt";
    $pageBreakCount = SYSTEM::$libreOffice->get_page_break_text_blocks_count_odt($filePath);
    
    if ($pageBreakCount > 0) {
        echo "Found {$pageBreakCount} page breaks with custom marker:\n";
        
        for ($k = 0; $k < min(3, $pageBreakCount); $k++) {
            $pageBreakText = SYSTEM::$libreOffice->get_page_break_text_block_by_index_odt($filePath, $k);
            echo "Page break {$k}: {$pageBreakText}\n";
        }
    } else if ($pageBreakCount == 0) {
        echo "No page breaks found in the document.\n";
    } else {
        echo "Error: Failed to count page breaks.\n";
    }
    
    // Quit the application
    WINDOW::$app->quit();
    
    ?>
    # Example for set_standard_text_block_page_break function
    # 
    # This example demonstrates how to set the text used to denote page breaks
    # when extracting content from ODT files using the XHELibreOffice class.
    
    import sys
    sys.path.insert(0, '../../../Templates PY/')
    
    xhe_host = "127.0.0.1:7013"
    from xweb_human_emulator import *
    
    # начало
    echo("<hr><font color=blue>libreOffice.set_standard_text_block_page_break</font><hr>")
    
    # Example 1: Set a custom page break marker
    echo("Example 1: Setting a custom page break marker\n");
    customMarker = "=== PAGE BREAK ===";
    result = libreOffice.set_standard_text_block_page_break(customMarker);
    
    if result:
        echo(f"Successfully set page break marker to: '{customMarker}'\n");
    else:
        echo("Error: Failed to set page break marker.\n");
    
    
    # Quit
    app.quit()
    using System;
    
    /**
     * Example for set_standard_text_block_page_break function
     *
     * This example demonstrates how to set the text used to denote page breaks
     * when extracting content from ODT files using the XHELibreOffice class.
     */
    
    // Scenario: Set the text used to denote page breaks when extracting content from ODT files
    
    namespace XHELibreOfficeExamples
    {
        class SetStandardTextBlockPageBreakExample
        {
            static void Main(string[] args)
            {
                string xheHost = "127.0.0.1:7010";
    
                // Initialize XHE API connection
                // In C#, you would initialize the XHE API client here
                // This is equivalent to including init.php in PHP
    
                Console.WriteLine("\nlibreOffice->set_standard_text_block_page_break.cs");
    
                // Example 1: Set a custom page break marker
                Console.WriteLine("\n\nExample 1: Setting a custom page break marker");
                string customMarker = "=== PAGE BREAK ===";
                bool result = libreOffice.set_standard_text_block_page_break(customMarker);
    
                if (result)
                {
                    Console.WriteLine($"Successfully set page break marker to: '{customMarker}'");
                }
                else
                {
                    Console.WriteLine("Error: Failed to set page break marker.");
                }
    
                // Example 2: Test the custom marker by extracting page breaks
                Console.WriteLine("\n\nExample 2: Testing the custom marker by extracting page breaks");
                string filePath = "test/test_style.odt";
                int pageBreakCount = libreOffice.get_page_break_text_blocks_count_odt(filePath);
    
                if (pageBreakCount > 0)
                {
                    Console.WriteLine($"Found {pageBreakCount} page breaks with custom marker:");
    
                    for (int i = 0; i < Math.Min(3, pageBreakCount); i++)
                    {
                        string pageBreakText = libreOffice.get_page_break_text_block_by_index_odt(filePath, i);
                        Console.WriteLine($"Page break {i}: {pageBreakText}");
                    }
                }
                else if (pageBreakCount == 0)
                {
                    Console.WriteLine("No page breaks found in the document.");
                }
                else
                {
                    Console.WriteLine("Error: Failed to count page breaks.");
                }
    
                // Quit the application
                app.quit();
            }
        }
    }
    /**
     * Example for set_standard_text_block_page_break function
     * 
     * This example demonstrates how to set the text used to denote page breaks
     * when extracting content from ODT files using the XHELibreOffice class.
     */
    
    xhe_host = "127.0.0.1:7013";
    
    // подключим функциональные объекты, если еще не подключен
    require("../../../Templates JS/init.js");
    
    // начало
    echo("<hr><font color=blue>libreOffice.set_standard_text_block_page_break</font><hr>");
    
    
    // Example 1: Set a custom page break marker
    echo("Example 1: Setting a custom page break marker\n");
    const customMarker = "=== PAGE BREAK ===";
    const result = libreOffice.set_standard_text_block_page_break(customMarker);
    
    if (result) {
        echo("Successfully set page break marker to: '" + customMarker + "'\n");
    } else {
        echo("Error: Failed to set page break marker.\n");
    }
    
    // Example 2: Test the custom marker by extracting page breaks
    echo("\nExample 2: Testing the custom marker by extracting page breaks\n");
    const filePath = "test/test_style.odt";
    const pageBreakCount = libreOffice.get_page_break_text_blocks_count_odt(filePath);
    
    if (pageBreakCount > 0) {
        echo("Found " + pageBreakCount + " page breaks with custom marker:\n");
        
        for (let i = 0; i < pageBreakCount; i++) {
            let pageBreakText = libreOffice.get_page_break_text_block_by_index_odt(filePath, i);
            echo("Page break {i}: {pageBreakText}\n");
        }
    } else if (pageBreakCount === 0) {
        echo("No page breaks found in the document.\n");
    } else {
        echo("Error: Failed to count page breaks.\n");
    }
    
    // Quit
    app.quit()

    =============================================
    libreoffice    Объекты    DOM  System  Vision  Web  Window        
    =============================================
    если что-то непонятно или необходимо узнать или считаете что надо добавить по работе этой функции, пишите в комментарии или на наш форум
    .