humanemulator.net — справка.
Продукт, демо и покупка — на
хуманэмулятор.рф
|
Демо
|
Купить
|
API
|
лог изменений
get_row
get_row($path,$sheet,$row); - Получить строку как массивФункция на вход принимает параметры:
После выполнения функции возвращаемое значение будет равно одному из двух :
Пример использования
<?php $xhe_host = "localhost:7010"; // Connect functional objects if not already connected if (!isset($path)){ $path = "../../../Templates/init.php"; require($path); } // Scenario: Demonstrate getting a row as an array from an Excel file // info echo "\n<span >excelDataReader->" . basename (__FILE__) . "</span>\n"; // Kill any existing Excel processes SYSTEM::$excel->kill(); // Example 1: Get row 2 as an array echo("\n\nExample 1: Get row 2 as an array\n"); $filePath = "test/test.xlsx"; $sheetIndex = 0; $rowIndex = 2; echo("File path: $filePath, Sheet index: $sheetIndex, Row index: $rowIndex\n"); $items = SYSTEM::$excelDataReader->get_row($filePath, $sheetIndex, $rowIndex); $itemsCount = count($items); echo("Number of items in row: $itemsCount\n"); // Create alphabet characters for column labels $alphachar = range('A', 'Z'); $alphacharCount = count($alphachar); // Display each cell value with column label for ($k = 0; $k < $itemsCount; $k++) { if ($alphacharCount > $k) echo("Column " . $alphachar[$k] . " (" . ($k + 1) . ") => " . $items[$k] . "\n"); else echo("Column " . ($k + 1) . " => " . $items[$k] . "\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_row</font><hr>") # 1 echo("1. Получим 1 строку как массив: ") items = excelDataReader.get_row("test/test.xlsx", 0, 1) itemsCount = len(items) alphachar = list(map(chr, range(ord('A'), ord('Z') + 1))) for k in range(itemsCount): if len(alphachar) > k: echo(alphachar[k] + "(" + str(k + 1) + ") =>" + items[k] + "\n") else: echo(str(k + 1) + "=>" + items[k] + "\n") # посмотрим app.shell_execute("open", "test/test.xlsx") # 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_row</font><hr>"); // 1 echo("\n1. Получим 1 строку как массив: "); echo(excelDataReader.get_row("test/test.xlsx", 0, 2)); // конец echo("\n\n"); app.quit(); } }
xhe_host = "127.0.0.1:7010"; // подключим функциональные объекты, если еще не подключен require("../../../Templates JS/init.js"); // начало echo("<hr><font color=blue>excelDataReader->get_row</font><hr>"); // 1 echo("1. Получим 1 строку как массив: "); const items = excelDataReader.get_row("test/test.xlsx", 0, 1); const itemsCount = items.length; const alphachar = "ABCDEFGHIJKLMNOPQRSTUVWXYZ".split(""); for (let k = 0; k < itemsCount; k++) { if (alphachar.length > k) echo(alphachar[k] + "(" + (k + 1) + ") =>" + items[k] + "\n"); else echo((k + 1) + "=>" + items[k] + "\n"); } // посмотрим app.shell_execute("open", "test/test.xlsx"); // Quit app.quit();
=============================================
excelDataReader Объекты DOM System Vision Web Window
=============================================
если что-то непонятно или необходимо узнать или считаете что надо добавить по работе этой функции, пишите в комментарии или на наш форум
.