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

cell_add_annotation_by_position

cell_add_annotation_by_position($path,$sheet,$cell_position,$annotation_author,$annotation_comment,$json_annotation_settings=''); - Добавить комментарий к ячейке по позиции

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

  • $path – Путь к файлу
  • $sheet – Номер Листа
  • $cell_position – Позиция ячейки (A[20] или F12)
  • $annotation_author – Автор комментария
  • $annotation_comment – Комментарий
  • $json_annotation_settings – AnnotationSettings JSON

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

    Пример использования
    <?php
    // Scenario: Add annotation to a cell 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. Add annotation to cell C2[2, 3]: \n");
    $filePath = "test/test.ods";
    $sheetIndex = 0;
    $cellPosition = "C2";
    $author = "Author";
    $comment = "Comment 1";
    $annotationSettings = '{"x": "2cm", "y": "4cm"}';
    
    $res1 = SYSTEM::$libreOfficeCalc->cell_add_annotation_by_position($filePath, $sheetIndex, $cellPosition, $author, $comment, $annotationSettings);
    $res1 = $res1 ? 'true' : 'false';
    echo("Annotation added: $res1\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->cell_add_annotation_by_position</font><hr>")
    
    # 1
    echo("1. Установить всплывающую подсказку для ячейки С2[2, 3]: \n")
    annotationSettings = '{"x": "2cm", "y": "4cm"}'
    echo(libreOfficeCalc.cell_add_annotation_by_position("test\\test.ods", 0, "C2", "Author", "Comment 1", annotationSettings))
    
    
    # посмотрим
    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->cell_add_annotation_by_position</font><hr>");
    
            // 1
            echo("1. Установить всплывающую подсказку для ячейки С2[2, 3]: \n");
            var annotationSettings = @"{'x': '2cm', 'y': '4cm'}";
            var res1 = libreOfficeCalc.cell_add_annotation_by_position("test\\test.ods", 0, "C2", "Author", "Comment 1",
                annotationSettings);
            echo(res1 + "\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->cell_add_annotation_by_position</font><hr>");
    
    // 1
    echo("1. Установить всплывающую подсказку для ячейки С2[2, 3]: \n");
    const annotationSettings = '{"x": "2cm", "y": "4cm"}';
    const res1 = libreOfficeCalc.cell_add_annotation_by_position("test\\test.ods", 0, "C2", "Author", "Comment 1", annotationSettings);
    echo(res1 + "\n");
    
    // посмотрим
    app.shell_execute("open", "test\\test.ods");
    
    // Quit
    app.quit();

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