PluginProbe
Visualizer – Tables & Charts Manager with Built-in AI Generator / 3.7.1
Visualizer – Tables & Charts Manager with Built-in AI Generator v3.7.1
4.0.8 4.0.7 4.0.6 4.0.5 4.0.4 4.0.3 3.0.5 3.0.6 3.0.7 3.0.8 3.0.9 3.1.0 3.1.1 3.1.2 3.1.3 3.10.0 3.10.1 3.10.10 3.10.11 3.10.12 3.10.13 3.10.14 3.10.15 3.10.2 3.10.3 All 149 releases
visualizer / vendor / phpoffice / phpspreadsheet / src / PhpSpreadsheet / Reader / Xlsx / DataValidations.php

DataValidations.php in Visualizer – Tables & Charts Manager with Built-in AI Generator 3.7.1, at vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Reader/Xlsx/DataValidations.php

51 lines 2.2 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace PhpOffice\PhpSpreadsheet\Reader\Xlsx;
4
5 use PhpOffice\PhpSpreadsheet\Cell\Coordinate;
6 use PhpOffice\PhpSpreadsheet\Worksheet\Worksheet;
7
8 class DataValidations
9 {
10 private $worksheet;
11
12 private $worksheetXml;
13
14 public function __construct(Worksheet $workSheet, \SimpleXMLElement $worksheetXml)
15 {
16 $this->worksheet = $workSheet;
17 $this->worksheetXml = $worksheetXml;
18 }
19
20 public function load()
21 {
22 foreach ($this->worksheetXml->dataValidations->dataValidation as $dataValidation) {
23 // Uppercase coordinate
24 $range = strtoupper($dataValidation['sqref']);
25 $rangeSet = explode(' ', $range);
26 foreach ($rangeSet as $range) {
27 $stRange = $this->worksheet->shrinkRangeToFit($range);
28
29 // Extract all cell references in $range
30 foreach (Coordinate::extractAllCellReferencesInRange($stRange) as $reference) {
31 // Create validation
32 $docValidation = $this->worksheet->getCell($reference)->getDataValidation();
33 $docValidation->setType((string) $dataValidation['type']);
34 $docValidation->setErrorStyle((string) $dataValidation['errorStyle']);
35 $docValidation->setOperator((string) $dataValidation['operator']);
36 $docValidation->setAllowBlank($dataValidation['allowBlank'] != 0);
37 $docValidation->setShowDropDown($dataValidation['showDropDown'] == 0);
38 $docValidation->setShowInputMessage($dataValidation['showInputMessage'] != 0);
39 $docValidation->setShowErrorMessage($dataValidation['showErrorMessage'] != 0);
40 $docValidation->setErrorTitle((string) $dataValidation['errorTitle']);
41 $docValidation->setError((string) $dataValidation['error']);
42 $docValidation->setPromptTitle((string) $dataValidation['promptTitle']);
43 $docValidation->setPrompt((string) $dataValidation['prompt']);
44 $docValidation->setFormula1((string) $dataValidation->formula1);
45 $docValidation->setFormula2((string) $dataValidation->formula2);
46 }
47 }
48 }
49 }
50 }
51