28 $this->objWriter->startElement(
'table:named-expressions');
30 $this->objWriter->endElement();
37 $definedNames = $this->spreadsheet->getDefinedNames();
39 foreach ($definedNames as $definedName) {
40 if ($definedName->isFormula()) {
41 $this->objWriter->startElement(
'table:named-expression');
44 $this->objWriter->startElement(
'table:named-range');
48 $this->objWriter->endElement();
54 $this->objWriter->writeAttribute(
'table:name', $definedName->
getName());
55 $this->objWriter->writeAttribute(
57 $this->formulaConvertor->convertFormula($definedName->
getValue(), $definedName->
getWorksheet()->getTitle())
59 $this->objWriter->writeAttribute(
'table:base-cell-address', $this->
convertAddress(
67 $this->objWriter->writeAttribute(
'table:name', $definedName->
getName());
68 $this->objWriter->writeAttribute(
'table:base-cell-address', $this->
convertAddress(
70 "'" . $definedName->
getWorksheet()->getTitle() .
"'!\$A\$1" 72 $this->objWriter->writeAttribute(
'table:cell-range-address', $this->
convertAddress($definedName, $definedName->
getValue()));
77 $splitCount = preg_match_all(
84 $lengths = array_map(
'strlen', array_column($splitRanges[0], 0));
85 $offsets = array_column($splitRanges[0], 1);
87 $worksheets = $splitRanges[2];
89 $rows = $splitRanges[7];
91 while ($splitCount > 0) {
93 $length = $lengths[$splitCount];
94 $offset = $offsets[$splitCount];
95 $worksheet = $worksheets[$splitCount][0];
100 if (empty($worksheet)) {
101 if (($offset === 0) || ($address[$offset - 1] !==
':')) {
106 $worksheet = str_replace(
"''",
"'", trim($worksheet,
"'"));
108 if (!empty($worksheet)) {
109 $newRange =
"'" . str_replace(
"'",
"''", $worksheet) .
"'.";
112 if (!empty($column)) {
113 $newRange .= $column;
119 $address = substr($address, 0, $offset) . $newRange . substr($address, $offset + $length);
122 if (substr($address, 0, 1) ===
'=') {
123 $address = substr($address, 1);
writeNamedFormula(DefinedName $definedName, Worksheet $defaultWorksheet)
convertAddress(DefinedName $definedName, string $address)
getWorksheet()
Get worksheet.
writeNamedRange(DefinedName $definedName)
getValue()
Get range or formula value.
__construct(XMLWriter $objWriter, Spreadsheet $spreadsheet, $formulaConvertor)
const CALCULATION_REGEXP_CELLREF_RELATIVE