Основной сайт хуманэмулятор.рф  |  Демо  |  Купить  |  API  |  Wiki



System / excelfile



remove_sheet_by_number

remove_sheet_by_number($path,$number); - Удалить Лист по номеру в файле Excel

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

  • $path – Путь к файлу Excel
  • $number – Номер листа

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

    Пример использования
    <?php $xhe_host = getenv("RPABOT_HOST_URL");
    
    // Scenario: Remove sheets by number in Excel file
    
    
    // Connect functional objects if not already connected
    if (!isset($path))
      $path = "../../../Templates/init.php";
    require($path);
    
    echo "\n<span >excelfile->".basename (__FILE__)."</span>\n";
    
    // Initialize Excel
    SYSTEM::$excel->kill();
    
    // Example 1: Add sheet
    echo("Example 1: Add sheet : ");
    // Extract method arguments into variables
    $filePath = "test/test.xlsx";
    $sheetName = "new sheet1";
    $result = SYSTEM::$excelfile->add_sheet($filePath, $sheetName);
    if ($result === true)
        echo("true\n");
    else
        echo("false\n");
    
    // Example 2: Get number of sheets
    echo("\nExample 2: Get number of sheets : ");
    $sheetCount = SYSTEM::$excelfile->get_sheets_count($filePath);
    echo($sheetCount . "\n");
    
    // Example 3: Remove sheet by number
    echo("\nExample 3: Remove sheet by number : ");
    $result = SYSTEM::$excelfile->remove_sheet_by_number($filePath, $sheetCount);
    if ($result === true)
        echo("true\n");
    else
        echo("false\n");
    
    // Example 4: Get number of sheets
    echo("\nExample 4: Get number of sheets : ");
    $sheetCount = SYSTEM::$excelfile->get_sheets_count($filePath);
    echo($sheetCount . "\n");
    
    // End of script
    echo "\n";
    
    // Quit
    WINDOW::$app->quit();
    ?>

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