humanemulator.net — справка.
Продукт, демо и покупка — на
хуманэмулятор.рф
|
Демо
|
Купить
|
API
|
лог изменений
get_cell
get_cell($path,$sheet,$row,$col); - Прочитать текст заданной ячейкиФункция на вход принимает параметры:
После выполнения функции возвращаемое значение будет равно одному из двух :
Пример использования
<?php $xhe_host = "localhost:7010"; // Connect functional objects if not already connected if (!isset($path)){ $path = "../../../Templates/init.php"; require($path); } // Scenario: Demonstrate getting cell values from an Excel file // info echo "\n<span >keyboard->" . basename (__FILE__) . "</span>\n"; // Kill any existing Excel processes SYSTEM::$excel->kill(); // Example 1: Get cell value at row 1, column A (index 1) echo("\n\nExample 1: Get cell value at row 1, column A\n"); $filePath = "test/test.xlsx"; $sheetIndex = 0; $rowIndex = 1; $colIndex = 1; echo("File path: $filePath, Sheet index: $sheetIndex, Row: $rowIndex, Column: $colIndex\n"); $cellValue = SYSTEM::$excelDataReader->get_cell($filePath, $sheetIndex, $rowIndex, $colIndex); echo("Cell value: $cellValue\n"); // Example 2: Get cell value at row 2, column B (index 2) echo("\nExample 2: Get cell value at row 2, column B\n"); $filePath = "test/test.xlsx"; $sheetIndex = 0; $rowIndex = 2; $colIndex = 2; echo("File path: $filePath, Sheet index: $sheetIndex, Row: $rowIndex, Column: $colIndex\n"); $cellValue = SYSTEM::$excelDataReader->get_cell($filePath, $sheetIndex, $rowIndex, $colIndex); echo("Cell value: $cellValue\n"); // Example 3: Get cell value at row 1, column C (index 3) echo("\nExample 3: Get cell value at row 1, column C\n"); $filePath = "test/test.xlsx"; $sheetIndex = 0; $rowIndex = 1; $colIndex = 3; echo("File path: $filePath, Sheet index: $sheetIndex, Row: $rowIndex, Column: $colIndex\n"); $cellValue = SYSTEM::$excelDataReader->get_cell($filePath, $sheetIndex, $rowIndex, $colIndex); echo("Cell value: $cellValue\n"); // Example 4: Get cell value with invalid column index (error case) echo("\nExample 4: Get cell value with invalid column index (error case)\n"); $filePath = "test/test.xlsx"; $sheetIndex = 0; $rowIndex = 5; $colIndex = 25; echo("File path: $filePath, Sheet index: $sheetIndex, Row: $rowIndex, Column: $colIndex (invalid)\n"); $cellValue = SYSTEM::$excelDataReader->get_cell($filePath, $sheetIndex, $rowIndex, $colIndex); echo("Cell value: $cellValue\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>excelDataReader.get_cell</font><hr>") # 1 echo("\n1. Получим текст ячейки (1 A): ") echo(excelDataReader.get_cell("test/test.xlsx", 0, 1, 1)) # 2 echo("\n2. Получим текст ячейки V1: ") echo("[1, 22] = " + excelDataReader.get_cell("test/test.xlsx", 0, 1, 22)) # 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 = "localhost:7010"; InitXHE(); // начало echo("<hr><font color=blue>excelDataReader.get_cell</font><hr>"); // 1 echo("\n1. Получим текст ячейки (1 A): "); echo(excelDataReader.get_cell("test/test.xlsx", 0, 1, 1)); // 2 echo("\n2. Получим текст ячейки (2 B): "); echo(excelDataReader.get_cell("test/test.xlsx", 0, 2, 2)); // 3 echo("\n3. Получим текст ячейки (1 C): "); echo(excelDataReader.get_cell("test/test.xlsx",0, 1, 3)); // 4 echo("\n4. Получим текст ячейки (ошибка больше чем доступно колонок): "); echo(excelDataReader.get_cell("test/test.xlsx", 0, 5, 25)); // конец echo("\n\n"); app.quit(); } }
xhe_host="127.0.0.1:7010";
require("../../../Templates JS/init.js");
// начало
echo("<hr><font color=blue>excelDataReader.get_cell</font><hr>");
// 1
echo("\n1. Получим текст ячейки (1 A): ");
echo(excelDataReader.get_cell("test/test.xlsx", 0, 1, 1));
// 2
echo("\n2. Получим текст ячейки V1: ");
echo("[1, 22] = " + excelDataReader.get_cell("test/test.xlsx", 0, 1, 22));
// посмотрим
app.shell_execute("open","test/test.xlsx");
// Quit
app.quit();=============================================
excelDataReader Объекты DOM System Vision Web Window
=============================================
если что-то непонятно или необходимо узнать или считаете что надо добавить по работе этой функции, пишите в комментарии или на наш форум
.