Основной сайт хуманэмулятор.рф | Демо | Купить | API | Wiki
System / excelfile
set_col_format
set_col_format($path,$sheet,$col,$format,$is_predefined=false,$except_header=false); - Задать формат столбца (устаревшая ф-ия исп. set_col_number_format())Таблица форматов: https://github.com/ClosedXML/ClosedXML/wiki/NumberFormatId-Lookup-Table
Функция на вход принимает параметры:
После выполнения функции возвращаемое значение будет равно одному из двух :
Пример использования
<?php // Scenario: Set column formats in Excel file $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); } echo "\n<span >excelfile->" . basename(__FILE__) . "</span>\n"; // Initialize Excel SYSTEM::$excel->kill(); // Example 1: Set column type echo("Example 1: Set column type : "); // Extract method arguments into variables $filePath = "test/test.xlsx"; $sheetNumber = 0; $columnLetter = "B"; $cellType = "Number"; $result = SYSTEM::$excelfile->set_col_type($filePath, $sheetNumber, $columnLetter, $cellType); if ($result === true) echo("true\n"); else echo("false\n"); // Example 2: Set column format (built-in) echo("\nExample 2: Set column format (built-in) : "); // Extract method arguments into variables $cellValue = "65.2311212"; SYSTEM::$excelfile->set_cell($filePath, $sheetNumber, 5, $columnLetter, $cellValue); $formatIndex = 5; $isBuiltIn = true; $result = SYSTEM::$excelfile->set_col_format($filePath, $sheetNumber, $columnLetter, $formatIndex, $isBuiltIn); if ($result === true) echo("true\n"); else echo("false\n"); // View the result // End of script echo "\n"; // Quit application WINDOW::$app->quit(); ?>
=============================================
excelfile Объекты DOM System Vision Web Window
=============================================
если что-то непонятно или необходимо узнать или считаете что надо добавить по работе этой функции, пишите в комментарии или на наш форум
.