Основной сайт хуманэмулятор.рф | Демо | Купить | API | Wiki
System / libreofficecalc
set_cell_color_by_position
set_cell_color_by_position($path,$sheet,$cell_position,$foreground_color,$background_color); - Задать цвет шрифта/фона ячейки по позицииФункция на вход принимает параметры:
После выполнения функции возвращаемое значение будет равно одному из двух :
Пример использования
<?php // Scenario: Set cell colors by position 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 C2: \n"; $filePath = "test/test.ods"; $sheetIndex = 0; $cellPosition = "C2"; $fontColor = "#e75322"; $backgroundColor = "#22e74a"; $res1 = SYSTEM::$libreOfficeCalc->set_cell_color_by_position($filePath, $sheetIndex, $cellPosition, $fontColor, $backgroundColor); $res1 = $res1 ? 'true' : 'false'; echo "Colors set: $res1\n"; // Example 2 echo "\n\n2. Set orange font and blue background for cell A5: \n"; $cellPosition = "A5"; $fontColor = "#e75322"; $backgroundColor = "#227ee7"; $res2 = SYSTEM::$libreOfficeCalc->set_cell_color_by_position($filePath, $sheetIndex, $cellPosition, $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_by_position</font><hr>") # 1 echo("1. Установить шрифт оранжевый, фон зеленый для ячейки [2,3]: \n") echo(libreOfficeCalc.set_cell_color_by_position("test\\test.ods", 0, "C2", "#e75322", "#22e74a")) #2 echo("\n2. Установить шрифт оранжевый, фон синий для ячейки [5,1]: \n") echo(libreOfficeCalc.set_cell_color_by_position("test\\test.ods", 0, "A5", "#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_by_position</font><hr>"); // 1 echo("1. Установить шрифт оранжевый, фон зеленый для ячейки [2,3]: \n"); var res1 = libreOfficeCalc.set_cell_color_by_position("test\\test.ods", 0, "C2", "#e75322", "#22e74a"); echo(res1 + "\n"); //2 echo("\n2. Установить шрифт оранжевый, фон синий для ячейки [5,1]: \n"); var res2 = libreOfficeCalc.set_cell_color_by_position("test\\test.ods", 0, "A5", "#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_by_position</font><hr>"); // 1 echo("1. Установить шрифт оранжевый, фон зеленый для ячейки [2,3]: \n"); const res1 = libreOfficeCalc.set_cell_color_by_position("test\\test.ods", 0, "C2", "#e75322", "#22e74a"); echo(res1 + "\n"); //2 echo("\n2. Установить шрифт оранжевый, фон синий для ячейки [5,1]: \n"); const res2 = libreOfficeCalc.set_cell_color_by_position("test\\test.ods", 0, "A5", "#e75322", "#227ee7"); echo(res2 + "\n"); // посмотрим app.shell_execute("open","test\\test.ods"); // Quit app.quit();
=============================================
libreofficecalc Объекты DOM System Vision Web Window
=============================================
если что-то непонятно или необходимо узнать или считаете что надо добавить по работе этой функции, пишите в комментарии или на наш форум
.