Основной сайт хуманэмулятор.рф | Демо | Купить | API | Wiki
System / excel
get_sheet
get_sheet($path,$sheet,$timeout=3000,$only_visible=false,$use_value2=true); - Получить содержимое заданного Листа Excel файла как двумерный массивФункция на вход принимает параметры:
После выполнения функции возвращаемое значение будет равно одному из двух :
Пример использования
<?php // Scenario: Demonstrates how to get the content of an entire Excel sheet as an array $xhe_host = getenv("RPABOT_HOST_URL"); // Connect functional objects if not already connected if (!isset($path)){ // Path to the init.php file for connecting to the XHE API $path = "../../../Templates/init.php"; // Including init.php grants access to all classes and functionality for working with the XHE API require($path); } // Set variables for method arguments $filePath = "test/test.xlsx"; $sheetIndex = 0; $maxCells = 3000; $visibleOnly = true; // Kill any existing Excel processes SYSTEM::$excel->kill(); // Example 1: Get content of a sheet as array echo("\nExample 1: Get content of a sheet as array\n"); $sheetData = SYSTEM::$excel->get_sheet($filePath, $sheetIndex); if ($sheetData !== null) { echo("Successfully retrieved sheet data from sheet #$sheetIndex\n"); echo("Sheet content:\n"); var_export($sheetData); } else { echo("Failed to get sheet data from sheet #$sheetIndex\n"); } // Example 2: Get content of a sheet as array (only visible cells) echo("\nExample 2: Get content of a sheet as array (only visible cells)\n"); $sheetDataVisible = SYSTEM::$excel->get_sheet($filePath, $sheetIndex, $maxCells, $visibleOnly); if ($sheetDataVisible !== null) { echo("Successfully retrieved visible sheet data from sheet #$sheetIndex\n"); echo("Visible sheet content:\n"); var_export($sheetDataVisible); } else { echo("Failed to get visible sheet data from sheet #$sheetIndex\n"); } // Quit the application WINDOW::$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>excelfile.set_sheet_name</font><hr>"); // 1 echo("1. Получить лист как массив: "); echo(excel.get_sheet("test/test.xlsx",0)); // конец echo("\n\n"); app.quit(); } }
xhe_host="127.0.0.1:7023";
echo=require("../../../Templates JS/init.js");
// начало
echo("<hr><font color=blue>excelfile.get_cell</font><hr>");
// 1
echo("\n1. Получим соедержимое листа как массив: ");
console.log(excel.get_sheet("test\\test.xlsx",0));
// 2
echo("\n2. Получим видимое содержимое листа как массив: ");
console.log(excel.get_sheet("test\\test.xlsx",0,3000,true));
// конец
echo("\n");
// Quit
app.quit();=============================================
excel Объекты DOM System Vision Web Window
=============================================
если что-то непонятно или необходимо узнать или считаете что надо добавить по работе этой функции, пишите в комментарии или на наш форум
.