Skip to content

Commit 1f54a31

Browse files
author
MarkBaker
committed
Initial work on supporting Freeze Pane for Ods Writer
1 parent 02394a3 commit 1f54a31

File tree

3 files changed

+14
-18
lines changed

3 files changed

+14
-18
lines changed

CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ and this project adheres to [Semantic Versioning](https://semver.org).
99

1010
### Added
1111

12+
- Ods Writer support for Freeze Pane [Issue #2013](https://github.com/PHPOffice/PhpSpreadsheet/issues/2013) [PR #2755](https://github.com/PHPOffice/PhpSpreadsheet/pull/2755)
1213
- Ods Writer support for setting column width/row height (including the use of AutoSize) [Issue #2346](https://github.com/PHPOffice/PhpSpreadsheet/issues/2346) [PR #2753](https://github.com/PHPOffice/PhpSpreadsheet/pull/2753)
1314
- Introduced CellAddress, CellRange, RowRange and ColumnRange value objects that can be used as an alternative to a string value (e.g. `'C5'`, `'B2:D4'`, `'2:2'` or `'B:C'`) in appropriate contexts.
1415
- Implementation of the FILTER(), SORT(), SORTBY() and UNIQUE() Lookup/Reference (array) functions.

phpstan-baseline.neon

-5
Original file line numberDiff line numberDiff line change
@@ -4690,11 +4690,6 @@ parameters:
46904690
count: 1
46914691
path: src/PhpSpreadsheet/Writer/Ods/Formula.php
46924692

4693-
-
4694-
message: "#^Parameter \\#1 \\$content of method XMLWriter\\:\\:text\\(\\) expects string, int given\\.$#"
4695-
count: 2
4696-
path: src/PhpSpreadsheet/Writer/Ods/Settings.php
4697-
46984693
-
46994694
message: "#^Cannot call method getHashCode\\(\\) on PhpOffice\\\\PhpSpreadsheet\\\\Style\\\\Font\\|null\\.$#"
47004695
count: 1

src/PhpSpreadsheet/Writer/Ods/Settings.php

+13-13
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@
33
namespace PhpOffice\PhpSpreadsheet\Writer\Ods;
44

55
use PhpOffice\PhpSpreadsheet\Cell\CellAddress;
6-
use PhpOffice\PhpSpreadsheet\Spreadsheet;
76
use PhpOffice\PhpSpreadsheet\Cell\Coordinate;
87
use PhpOffice\PhpSpreadsheet\Shared\XMLWriter;
8+
use PhpOffice\PhpSpreadsheet\Spreadsheet;
99
use PhpOffice\PhpSpreadsheet\Worksheet\Worksheet;
1010

1111
class Settings extends WriterPart
@@ -99,16 +99,16 @@ private function writeSelectedCells(XMLWriter $objWriter, Worksheet $worksheet):
9999
$selected = $worksheet->getSelectedCells();
100100
if (preg_match('/^([a-z]+)([0-9]+)/i', $selected, $matches) === 1) {
101101
$colSel = Coordinate::columnIndexFromString($matches[1]) - 1;
102-
$rowSel = (int)$matches[2] - 1;
102+
$rowSel = (int) $matches[2] - 1;
103103
$objWriter->startElement('config:config-item');
104104
$objWriter->writeAttribute('config:name', 'CursorPositionX');
105105
$objWriter->writeAttribute('config:type', 'int');
106-
$objWriter->text($colSel);
106+
$objWriter->text((string) $colSel);
107107
$objWriter->endElement();
108108
$objWriter->startElement('config:config-item');
109109
$objWriter->writeAttribute('config:name', 'CursorPositionY');
110110
$objWriter->writeAttribute('config:type', 'int');
111-
$objWriter->text($rowSel);
111+
$objWriter->text((string) $rowSel);
112112
$objWriter->endElement();
113113
}
114114
}
@@ -126,22 +126,22 @@ private function writeFreezePane(XMLWriter $objWriter, Worksheet $worksheet): vo
126126
$objWriter->startElement('config:config-item');
127127
$objWriter->writeAttribute('config:name', 'HorizontalSplitMode');
128128
$objWriter->writeAttribute('config:type', 'short');
129-
$objWriter->text(2);
129+
$objWriter->text('2');
130130
$objWriter->endElement();
131131
$objWriter->startElement('config:config-item');
132132
$objWriter->writeAttribute('config:name', 'HorizontalSplitPosition');
133133
$objWriter->writeAttribute('config:type', 'int');
134-
$objWriter->text($columnId - 1);
134+
$objWriter->text((string) ($columnId - 1));
135135
$objWriter->endElement();
136136
$objWriter->startElement('config:config-item');
137137
$objWriter->writeAttribute('config:name', 'PositionLeft');
138138
$objWriter->writeAttribute('config:type', 'short');
139-
$objWriter->text(0);
139+
$objWriter->text('0');
140140
$objWriter->endElement();
141141
$objWriter->startElement('config:config-item');
142142
$objWriter->writeAttribute('config:name', 'PositionRight');
143143
$objWriter->writeAttribute('config:type', 'int');
144-
$objWriter->text($columnId - 1);
144+
$objWriter->text((string) ($columnId - 1));
145145
$objWriter->endElement();
146146

147147
for ($column = 'A'; $column !== $columnName; ++$column) {
@@ -152,29 +152,29 @@ private function writeFreezePane(XMLWriter $objWriter, Worksheet $worksheet): vo
152152
$objWriter->startElement('config:config-item');
153153
$objWriter->writeAttribute('config:name', 'VerticalSplitMode');
154154
$objWriter->writeAttribute('config:type', 'short');
155-
$objWriter->text(2);
155+
$objWriter->text('2');
156156
$objWriter->endElement();
157157
$objWriter->startElement('config:config-item');
158158
$objWriter->writeAttribute('config:name', 'VerticalSplitPosition');
159159
$objWriter->writeAttribute('config:type', 'int');
160-
$objWriter->text($row - 1);
160+
$objWriter->text((string) ($row - 1));
161161
$objWriter->endElement();
162162
$objWriter->startElement('config:config-item');
163163
$objWriter->writeAttribute('config:name', 'PositionTop');
164164
$objWriter->writeAttribute('config:type', 'short');
165-
$objWriter->text(0);
165+
$objWriter->text('0');
166166
$objWriter->endElement();
167167
$objWriter->startElement('config:config-item');
168168
$objWriter->writeAttribute('config:name', 'PositionBottom');
169169
$objWriter->writeAttribute('config:type', 'int');
170-
$objWriter->text($row - 1);
170+
$objWriter->text((string) ($row - 1));
171171
$objWriter->endElement();
172172
}
173173

174174
$objWriter->startElement('config:config-item');
175175
$objWriter->writeAttribute('config:name', 'ActiveSplitRange');
176176
$objWriter->writeAttribute('config:type', 'short');
177-
$objWriter->text(3);
177+
$objWriter->text('3');
178178
$objWriter->endElement();
179179
}
180180
}

0 commit comments

Comments
 (0)