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

set_cell_color

set_cell_color($path,$sheet,$row,$col,$foreground_color,$background_color); -

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

  • $path
  • $sheet
  • $row
  • $col
  • $foreground_color
  • $background_color

    :
  • true
  • false

    Пример использования
    <?php
    // Scenario: Set cell colors in LibreOffice Calc spreadsheet
    
    $xhe_host = getenv("RPABOT_HOST_URL");
    // Connect functional objects if not already connected
    if (!isset($path)){
      $path = "../../../Templates/init.php";
      require($path);
    }
    // info
    echo "\n<span >libreOfficeCalc->" . basename (__FILE__) . "</span>\n";
    
    // Example 1
    echo "1. Set orange font and green background for cell [2,3]: \n";
    $filePath = "test/test.ods";
    $sheetIndex = 0;
    $row = 2;
    $column = 3;
    $fontColor = "#e75322";
    $backgroundColor = "#22e74a";
    $res1 = SYSTEM::$libreOfficeCalc->set_cell_color($filePath, $sheetIndex, $row, $column, $fontColor, $backgroundColor);
    $res1 = $res1 ? 'true' : 'false';
    echo "Colors set: $res1\n";
    
    // Example 2
    echo "\n\n2. Set orange font and blue background for cell [5,1]: \n";
    $row = 5;
    $column = 1;
    $fontColor = "#e75322";
    $backgroundColor = "#227ee7";
    $res2 = SYSTEM::$libreOfficeCalc->set_cell_color($filePath, $sheetIndex, $row, $column, $fontColor, $backgroundColor);
    $res2 = $res2 ? 'true' : 'false';
    echo "Colors set: $res2\n";
    
    
    
    // end
    echo "\n";
    
    // Quit the application
    WINDOW::$app->quit();
    ?>
    # Additional paths
    import sys
    sys.path.insert(0, '../../../Templates PY/')
    
    xhe_host = "127.0.0.1:7010"
    from xweb_human_emulator import *
    
    # начало
    echo("<hr><font color=blue>libreOfficeCalc->set_cell_color</font><hr>")
    
    # 1
    echo("1. Установить шрифт оранжевый, фон зеленый для ячейки [2,3]: \n")
    echo(libreOfficeCalc.set_cell_color("test\\test.ods", 0, 2, 3, "#e75322", "#22e74a"))
    
    #2
    echo("\n2. Установить шрифт оранжевый, фон синий для ячейки [5,1]: \n")
    echo(libreOfficeCalc.set_cell_color("test\\test.ods", 0, 5, 1, "#e75322", "#227ee7"))
    
    # посмотрим
    app.shell_execute("open","test\\test.ods")
    
    # Quit
    app.quit()
    #region using
    
    using System;
    using System.Diagnostics;
    using System.Collections.Generic;
    using System.Linq;
    using System.IO;
    using System.Text;
    using System.Threading;
    
    using XHE;
    using XHE.XHE_DOM;
    using XHE.XHE_System;
    using XHE.XHE_Window;
    using XHE.XHE_Web;
    
    #endregion
    
    class Program : XHEScript
    {
        static void Main(string[] args)
        {
            // init XHE
            server = Environment.GetEnvironmentVariable("RPABOT_HOST_URL");
            InitXHE();
    
            // начало
            echo("<hr><font color=blue>libreOfficeCalc->set_cell_color</font><hr>");
    
            // 1
            echo("1. Установить шрифт оранжевый, фон зеленый для ячейки [2,3]: \n");
            var res1 = libreOfficeCalc.set_cell_color("test\\test.ods", 0, 2, 3, "#e75322", "#22e74a");
            echo(res1 + "\n");
    
            //2
            echo("\n2. Установить шрифт оранжевый, фон синий для ячейки [5,1]: \n");
            var res2 = libreOfficeCalc.set_cell_color("test\\test.ods", 0, 5, 1, "#e75322", "#227ee7");
            echo(res2 + "\n");
    
            // посмотрим
            app.shell_execute("open", "test\\test.ods");
    
            // Quit
            app.quit();
        }
    }
    xhe_host = "127.0.0.1:7010";
    
    // подключим функциональные объекты, если еще не подключен
    require("../../../Templates JS/init.js");
    
    // начало
    echo("<hr><font color=blue>libreOfficeCalc->set_cell_color</font><hr>");
    
    // 1
    echo("1. Установить шрифт оранжевый, фон зеленый для ячейки [2,3]: \n");
    const res1 = libreOfficeCalc.set_cell_color("test\\test.ods", 0, 2, 3, "#e75322", "#22e74a");
    echo(res1 + "\n");
    
    //2
    echo("\n2. Установить шрифт оранжевый, фон синий для ячейки [5,1]: \n");
    const res2 = libreOfficeCalc.set_cell_color("test\\test.ods", 0, 5, 1, "#e75322", "#227ee7");
    echo(res2 + "\n");
    
    // посмотрим
    app.shell_execute("open","test\\test.ods");
    
    // Quit
    app.quit();

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