Skip to content

Commit 6a190d6

Browse files
author
Mark Baker
authored
Merge branch 'master' into Issue-2678_Update-CF-Ranges-and-Conditions-on-Insert/Delete
2 parents 6faf828 + 9428552 commit 6a190d6

26 files changed

+510
-386
lines changed

.php-cs-fixer.dist.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
'combine_consecutive_issets' => true,
2727
'combine_consecutive_unsets' => true,
2828
'combine_nested_dirname' => true,
29-
'comment_to_phpdoc' => true,
29+
'comment_to_phpdoc' => false, // interferes with annotations
3030
'compact_nullable_typehint' => true,
3131
'concat_space' => ['spacing' => 'one'],
3232
'constant_case' => true,
@@ -171,7 +171,7 @@
171171
'phpdoc_separation' => true,
172172
'phpdoc_single_line_var_spacing' => true,
173173
'phpdoc_summary' => true,
174-
'phpdoc_to_comment' => true,
174+
'phpdoc_to_comment' => false, // interferes with annotations
175175
'phpdoc_to_param_type' => false, // Because experimental, but interesting for one shot use
176176
'phpdoc_to_return_type' => false, // idem
177177
'phpdoc_trim' => true,

phpstan-baseline.neon

Lines changed: 0 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -4220,26 +4220,6 @@ parameters:
42204220
count: 1
42214221
path: src/PhpSpreadsheet/Style/NumberFormat/PercentageFormatter.php
42224222

4223-
-
4224-
message: "#^Cannot call method getCell\\(\\) on PhpOffice\\\\PhpSpreadsheet\\\\Worksheet\\\\Worksheet\\|null\\.$#"
4225-
count: 1
4226-
path: src/PhpSpreadsheet/Worksheet/BaseDrawing.php
4227-
4228-
-
4229-
message: "#^Cannot call method getDrawingCollection\\(\\) on PhpOffice\\\\PhpSpreadsheet\\\\Worksheet\\\\Worksheet\\|null\\.$#"
4230-
count: 1
4231-
path: src/PhpSpreadsheet/Worksheet/BaseDrawing.php
4232-
4233-
-
4234-
message: "#^Cannot call method getHashCode\\(\\) on PhpOffice\\\\PhpSpreadsheet\\\\Worksheet\\\\Worksheet\\|null\\.$#"
4235-
count: 1
4236-
path: src/PhpSpreadsheet/Worksheet/BaseDrawing.php
4237-
4238-
-
4239-
message: "#^Property PhpOffice\\\\PhpSpreadsheet\\\\Worksheet\\\\BaseDrawing\\:\\:\\$shadow \\(PhpOffice\\\\PhpSpreadsheet\\\\Worksheet\\\\Drawing\\\\Shadow\\) does not accept PhpOffice\\\\PhpSpreadsheet\\\\Worksheet\\\\Drawing\\\\Shadow\\|null\\.$#"
4240-
count: 1
4241-
path: src/PhpSpreadsheet/Worksheet/BaseDrawing.php
4242-
42434223
-
42444224
message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Worksheet\\\\CellIterator\\:\\:adjustForExistingOnlyRange\\(\\) has no return type specified\\.$#"
42454225
count: 1
@@ -5250,36 +5230,6 @@ parameters:
52505230
count: 2
52515231
path: src/PhpSpreadsheet/Writer/Xlsx/DocProps.php
52525232

5253-
-
5254-
message: "#^Parameter \\#1 \\$coordinates of static method PhpOffice\\\\PhpSpreadsheet\\\\Cell\\\\Coordinate\\:\\:indexesFromString\\(\\) expects string, string\\|null given\\.$#"
5255-
count: 1
5256-
path: src/PhpSpreadsheet/Writer/Xlsx/Drawing.php
5257-
5258-
-
5259-
message: "#^Parameter \\#1 \\$index of method PhpOffice\\\\PhpSpreadsheet\\\\Worksheet\\\\Worksheet\\:\\:getChartByIndex\\(\\) expects string, int\\<0, max\\> given\\.$#"
5260-
count: 1
5261-
path: src/PhpSpreadsheet/Writer/Xlsx/Drawing.php
5262-
5263-
-
5264-
message: "#^Parameter \\#2 \\$chart of method PhpOffice\\\\PhpSpreadsheet\\\\Writer\\\\Xlsx\\\\Drawing\\:\\:writeChart\\(\\) expects PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\Chart, PhpOffice\\\\PhpSpreadsheet\\\\Chart\\\\Chart\\|false given\\.$#"
5265-
count: 1
5266-
path: src/PhpSpreadsheet/Writer/Xlsx/Drawing.php
5267-
5268-
-
5269-
message: "#^Parameter \\#2 \\$content of method XMLWriter\\:\\:writeElement\\(\\) expects string\\|null, int given\\.$#"
5270-
count: 20
5271-
path: src/PhpSpreadsheet/Writer/Xlsx/Drawing.php
5272-
5273-
-
5274-
message: "#^Parameter \\#2 \\$value of method XMLWriter\\:\\:writeAttribute\\(\\) expects string, int given\\.$#"
5275-
count: 10
5276-
path: src/PhpSpreadsheet/Writer/Xlsx/Drawing.php
5277-
5278-
-
5279-
message: "#^Parameter \\#2 \\$value of method XMLWriter\\:\\:writeAttribute\\(\\) expects string, int\\<0, max\\> given\\.$#"
5280-
count: 1
5281-
path: src/PhpSpreadsheet/Writer/Xlsx/Drawing.php
5282-
52835233
-
52845234
message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Writer\\\\Xlsx\\\\Rels\\:\\:writeUnparsedRelationship\\(\\) has parameter \\$relationship with no type specified\\.$#"
52855235
count: 1
Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
<?php
2+
3+
// Create new Spreadsheet object
4+
use PhpOffice\PhpSpreadsheet\Helper\Dimension;
5+
use PhpOffice\PhpSpreadsheet\Spreadsheet;
6+
use PhpOffice\PhpSpreadsheet\Worksheet\Drawing;
7+
8+
require __DIR__ . '/../Header.php';
9+
10+
$helper->log('Create new Spreadsheet object');
11+
$spreadsheet = new Spreadsheet();
12+
$sheet = $spreadsheet->getActiveSheet();
13+
$sheet->getCell('A1')->setValue('twocell');
14+
$sheet->getCell('A2')->setValue('twocell');
15+
$sheet->getCell('A3')->setValue('onecell');
16+
$sheet->getCell('A6')->setValue('absolute');
17+
18+
// Add a drawing to the worksheet
19+
$helper->log('Add a drawing to the worksheet two-cell anchor not resized');
20+
$drawing = new Drawing();
21+
$drawing->setName('PhpSpreadsheet');
22+
$drawing->setDescription('PhpSpreadsheet');
23+
$drawing->setPath(__DIR__ . '/../images/PhpSpreadsheet_logo.png');
24+
// anchor type will be two-cell because Coordinates2 is set
25+
//$drawing->setAnchorType(Drawing::ANCHORTYPE_TWOCELL);
26+
$drawing->setCoordinates('B1');
27+
$drawing->setCoordinates2('B1');
28+
$drawing->setOffsetX2($drawing->getImageWidth());
29+
$drawing->setOffsetY2($drawing->getImageHeight());
30+
$drawing->setWorksheet($spreadsheet->getActiveSheet());
31+
32+
// Add a drawing to the worksheet
33+
$helper->log('Add a drawing to the worksheet two-cell anchor resized');
34+
$drawing2 = new Drawing();
35+
$drawing2->setName('PhpSpreadsheet');
36+
$drawing2->setDescription('PhpSpreadsheet');
37+
$drawing2->setPath(__DIR__ . '/../images/PhpSpreadsheet_logo.png');
38+
// anchor type will be two-cell because Coordinates2 is set
39+
//$drawing->setAnchorType(Drawing::ANCHORTYPE_TWOCELL);
40+
$drawing2->setCoordinates('C2');
41+
$drawing2->setCoordinates2('C2');
42+
$drawing2->setOffsetX2($drawing->getImageWidth());
43+
$drawing2->setOffsetY2($drawing->getImageHeight());
44+
$drawing2->setWorksheet($spreadsheet->getActiveSheet());
45+
46+
$spreadsheet->getActiveSheet()->getColumnDimension('C')->setWidth($drawing->getImageWidth(), Dimension::UOM_PIXELS);
47+
$spreadsheet->getActiveSheet()->getRowDimension(2)->setRowHeight($drawing->getImageHeight(), Dimension::UOM_PIXELS);
48+
49+
// Add a drawing to the worksheet one cell anchor
50+
$helper->log('Add a drawing to the worksheet one-cell anchor');
51+
$drawing3 = new Drawing();
52+
$drawing3->setName('PhpSpreadsheet');
53+
$drawing3->setDescription('PhpSpreadsheet');
54+
$drawing3->setPath(__DIR__ . '/../images/PhpSpreadsheet_logo.png');
55+
// anchor type will be one-cell because Coordinates2 is not set
56+
//$drawing->setAnchorType(Drawing::ANCHORTYPE_ONECELL);
57+
$drawing3->setCoordinates('D3');
58+
$drawing3->setWorksheet($spreadsheet->getActiveSheet());
59+
60+
// Add a drawing to the worksheet
61+
$helper->log('Add a drawing to the worksheet two-cell anchor resized absolute');
62+
$drawing4 = new Drawing();
63+
$drawing4->setName('PhpSpreadsheet');
64+
$drawing4->setDescription('PhpSpreadsheet');
65+
$drawing4->setPath(__DIR__ . '/../images/PhpSpreadsheet_logo.png');
66+
// anchor type will be two-cell because Coordinates2 is set
67+
//$drawing->setAnchorType(Drawing::ANCHORTYPE_TWOCELL);
68+
$drawing4->setCoordinates('C6');
69+
$drawing4->setCoordinates2('C6');
70+
$drawing4->setOffsetX2($drawing->getImageWidth());
71+
$drawing4->setOffsetY2($drawing->getImageHeight());
72+
$drawing4->setWorksheet($spreadsheet->getActiveSheet());
73+
$drawing4->setEditAs(Drawing::EDIT_AS_ABSOLUTE);
74+
75+
//$spreadsheet->getActiveSheet()->getColumnDimension('C')->setWidth($drawing->getImageWidth(), Dimension::UOM_PIXELS);
76+
$spreadsheet->getActiveSheet()->getRowDimension(6)->setRowHeight($drawing->getImageHeight(), Dimension::UOM_PIXELS);
77+
78+
$helper->write($spreadsheet, __FILE__, ['Xlsx']);

samples/Chart/33_Chart_create_area.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
use PhpOffice\PhpSpreadsheet\Chart\Chart;
44
use PhpOffice\PhpSpreadsheet\Chart\DataSeries;
55
use PhpOffice\PhpSpreadsheet\Chart\DataSeriesValues;
6-
use PhpOffice\PhpSpreadsheet\Chart\Legend;
6+
use PhpOffice\PhpSpreadsheet\Chart\Legend as ChartLegend;
77
use PhpOffice\PhpSpreadsheet\Chart\PlotArea;
88
use PhpOffice\PhpSpreadsheet\Chart\Title;
99
use PhpOffice\PhpSpreadsheet\IOFactory;
@@ -71,7 +71,7 @@
7171
// Set the series in the plot area
7272
$plotArea = new PlotArea(null, [$series]);
7373
// Set the chart legend
74-
$legend = new Legend(Legend::POSITION_TOPRIGHT, null, false);
74+
$legend = new ChartLegend(ChartLegend::POSITION_TOPRIGHT, null, false);
7575

7676
$title = new Title('Test %age-Stacked Area Chart');
7777
$yAxisLabel = new Title('Value ($k)');

samples/Chart/33_Chart_create_bar_stacked.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
use PhpOffice\PhpSpreadsheet\Chart\Chart;
44
use PhpOffice\PhpSpreadsheet\Chart\DataSeries;
55
use PhpOffice\PhpSpreadsheet\Chart\DataSeriesValues;
6-
use PhpOffice\PhpSpreadsheet\Chart\Legend;
6+
use PhpOffice\PhpSpreadsheet\Chart\Legend as ChartLegend;
77
use PhpOffice\PhpSpreadsheet\Chart\PlotArea;
88
use PhpOffice\PhpSpreadsheet\Chart\Title;
99
use PhpOffice\PhpSpreadsheet\IOFactory;
@@ -74,7 +74,7 @@
7474
// Set the series in the plot area
7575
$plotArea = new PlotArea(null, [$series]);
7676
// Set the chart legend
77-
$legend = new Legend(Legend::POSITION_RIGHT, null, false);
77+
$legend = new ChartLegend(ChartLegend::POSITION_RIGHT, null, false);
7878

7979
$title = new Title('Test Chart');
8080
$yAxisLabel = new Title('Value ($k)');

samples/Chart/33_Chart_create_column.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
use PhpOffice\PhpSpreadsheet\Chart\Chart;
44
use PhpOffice\PhpSpreadsheet\Chart\DataSeries;
55
use PhpOffice\PhpSpreadsheet\Chart\DataSeriesValues;
6-
use PhpOffice\PhpSpreadsheet\Chart\Legend;
6+
use PhpOffice\PhpSpreadsheet\Chart\Legend as ChartLegend;
77
use PhpOffice\PhpSpreadsheet\Chart\PlotArea;
88
use PhpOffice\PhpSpreadsheet\Chart\Title;
99
use PhpOffice\PhpSpreadsheet\IOFactory;
@@ -74,7 +74,7 @@
7474
// Set the series in the plot area
7575
$plotArea = new PlotArea(null, [$series]);
7676
// Set the chart legend
77-
$legend = new Legend(Legend::POSITION_RIGHT, null, false);
77+
$legend = new ChartLegend(ChartLegend::POSITION_RIGHT, null, false);
7878

7979
$title = new Title('Test Column Chart');
8080
$yAxisLabel = new Title('Value ($k)');

samples/Chart/33_Chart_create_column_2.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
use PhpOffice\PhpSpreadsheet\Chart\Chart;
44
use PhpOffice\PhpSpreadsheet\Chart\DataSeries;
55
use PhpOffice\PhpSpreadsheet\Chart\DataSeriesValues;
6-
use PhpOffice\PhpSpreadsheet\Chart\Legend;
6+
use PhpOffice\PhpSpreadsheet\Chart\Legend as ChartLegend;
77
use PhpOffice\PhpSpreadsheet\Chart\PlotArea;
88
use PhpOffice\PhpSpreadsheet\Chart\Title;
99
use PhpOffice\PhpSpreadsheet\IOFactory;
@@ -82,7 +82,7 @@
8282
// Set the series in the plot area
8383
$plotArea = new PlotArea(null, [$series]);
8484
// Set the chart legend
85-
$legend = new Legend(Legend::POSITION_BOTTOM, null, false);
85+
$legend = new ChartLegend(ChartLegend::POSITION_BOTTOM, null, false);
8686

8787
$title = new Title('Test Grouped Column Chart');
8888
$xAxisLabel = new Title('Financial Period');

samples/Chart/33_Chart_create_composite.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
use PhpOffice\PhpSpreadsheet\Chart\Chart;
44
use PhpOffice\PhpSpreadsheet\Chart\DataSeries;
55
use PhpOffice\PhpSpreadsheet\Chart\DataSeriesValues;
6-
use PhpOffice\PhpSpreadsheet\Chart\Legend;
6+
use PhpOffice\PhpSpreadsheet\Chart\Legend as ChartLegend;
77
use PhpOffice\PhpSpreadsheet\Chart\PlotArea;
88
use PhpOffice\PhpSpreadsheet\Chart\Title;
99
use PhpOffice\PhpSpreadsheet\IOFactory;
@@ -128,7 +128,7 @@
128128
// Set the series in the plot area
129129
$plotArea = new PlotArea(null, [$series1, $series2, $series3]);
130130
// Set the chart legend
131-
$legend = new Legend(Legend::POSITION_RIGHT, null, false);
131+
$legend = new ChartLegend(ChartLegend::POSITION_RIGHT, null, false);
132132

133133
$title = new Title('Average Weather Chart for Crete');
134134

samples/Chart/33_Chart_create_line.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
use PhpOffice\PhpSpreadsheet\Chart\Chart;
44
use PhpOffice\PhpSpreadsheet\Chart\DataSeries;
55
use PhpOffice\PhpSpreadsheet\Chart\DataSeriesValues;
6-
use PhpOffice\PhpSpreadsheet\Chart\Legend;
6+
use PhpOffice\PhpSpreadsheet\Chart\Legend as ChartLegend;
77
use PhpOffice\PhpSpreadsheet\Chart\PlotArea;
88
use PhpOffice\PhpSpreadsheet\Chart\Title;
99
use PhpOffice\PhpSpreadsheet\IOFactory;
@@ -72,7 +72,7 @@
7272
// Set the series in the plot area
7373
$plotArea = new PlotArea(null, [$series]);
7474
// Set the chart legend
75-
$legend = new Legend(Legend::POSITION_TOPRIGHT, null, false);
75+
$legend = new ChartLegend(ChartLegend::POSITION_TOPRIGHT, null, false);
7676

7777
$title = new Title('Test Stacked Line Chart');
7878
$yAxisLabel = new Title('Value ($k)');

samples/Chart/33_Chart_create_multiple_charts.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
use PhpOffice\PhpSpreadsheet\Chart\Chart;
44
use PhpOffice\PhpSpreadsheet\Chart\DataSeries;
55
use PhpOffice\PhpSpreadsheet\Chart\DataSeriesValues;
6-
use PhpOffice\PhpSpreadsheet\Chart\Legend;
6+
use PhpOffice\PhpSpreadsheet\Chart\Legend as ChartLegend;
77
use PhpOffice\PhpSpreadsheet\Chart\PlotArea;
88
use PhpOffice\PhpSpreadsheet\Chart\Title;
99
use PhpOffice\PhpSpreadsheet\IOFactory;
@@ -71,7 +71,7 @@
7171
// Set the series in the plot area
7272
$plotArea1 = new PlotArea(null, [$series1]);
7373
// Set the chart legend
74-
$legend1 = new Legend(Legend::POSITION_TOPRIGHT, null, false);
74+
$legend1 = new ChartLegend(ChartLegend::POSITION_TOPRIGHT, null, false);
7575

7676
$title1 = new Title('Test %age-Stacked Area Chart');
7777
$yAxisLabel1 = new Title('Value ($k)');
@@ -146,7 +146,7 @@
146146
// Set the series in the plot area
147147
$plotArea2 = new PlotArea(null, [$series2]);
148148
// Set the chart legend
149-
$legend2 = new Legend(Legend::POSITION_RIGHT, null, false);
149+
$legend2 = new ChartLegend(ChartLegend::POSITION_RIGHT, null, false);
150150

151151
$title2 = new Title('Test Column Chart');
152152
$yAxisLabel2 = new Title('Value ($k)');

0 commit comments

Comments
 (0)