Skip to content

Commit 62a0d40

Browse files
authored
Merge branch 'master' into issue2157
2 parents 32cb9f4 + f4919af commit 62a0d40

File tree

76 files changed

+6825
-6332
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

76 files changed

+6825
-6332
lines changed

CHANGELOG.md

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,36 @@ All notable changes to this project will be documented in this file.
55
The format is based on [Keep a Changelog](https://keepachangelog.com)
66
and this project adheres to [Semantic Versioning](https://semver.org).
77

8-
## 2024-09-29 - 3.0.0
8+
## TBD - 3.4.0
9+
10+
### Added
11+
12+
- Nothing yet.
13+
14+
### Changed
15+
16+
- Nothing yet.
17+
18+
### Deprecated
19+
20+
- IREADER::SKIP_EMPTY_CELLS - use its alias IGNORE_EMPTY_CELLS instead.
21+
22+
### Moved
23+
24+
- Nothing yet.
25+
26+
### Fixed
27+
28+
- Xls Writer Condtional Rules Applied to Whole Rows or Columns. [Issue #3185](https://github.com/PHPOffice/PhpSpreadsheet/issues/3185) [PR #4152](https://github.com/PHPOffice/PhpSpreadsheet/pull/4152)
29+
- Xlsx Writer Duplicate ContentTypes Entry for Background Image. [Issue #4179](https://github.com/PHPOffice/PhpSpreadsheet/issues/4179) [PR #4180](https://github.com/PHPOffice/PhpSpreadsheet/pull/4180)
30+
- Check strictNullComparison outside of loops. [PR #3347](https://github.com/PHPOffice/PhpSpreadsheet/pull/3347)
31+
- SUMIFS Does Not Require xlfn. [Issue #4182](https://github.com/PHPOffice/PhpSpreadsheet/issues/4182) [PR #4186](https://github.com/PHPOffice/PhpSpreadsheet/pull/4186)
32+
- Image Transparency/Opacity with Html Reader Changes. [Discussion #4117](https://github.com/PHPOffice/PhpSpreadsheet/discussions/4117) [PR #4142](https://github.com/PHPOffice/PhpSpreadsheet/pull/4142)
33+
- Option to Write Hyperlink Rather Than Label to Csv. [Issue #1412](https://github.com/PHPOffice/PhpSpreadsheet/issues/1412) [PR #4151](https://github.com/PHPOffice/PhpSpreadsheet/pull/4151)
34+
- Invalid Html Due to Cached Filesize. [Issue #1107](https://github.com/PHPOffice/PhpSpreadsheet/issues/1107) [PR #4184](https://github.com/PHPOffice/PhpSpreadsheet/pull/4184)
35+
- Add Dynamic valueBinder Property to Spreadsheet and Readers. [Issue #1395](https://github.com/PHPOffice/PhpSpreadsheet/issues/1395) [PR #4185](https://github.com/PHPOffice/PhpSpreadsheet/pull/4185)
36+
37+
## 2024-09-29 - 3.3.0 (no 3.0.\*, 3.1.\*, 3.2.\*)
938

1039
### Dynamic Arrays
1140

composer.lock

Lines changed: 10 additions & 10 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/topics/Behind the Mask.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,10 @@ If you wish to emulate the MS Excel behaviour, and automatically convert string
117117

118118
You can do this by changing the Value Binder, which will then apply every time you set a Cell value.
119119
```php
120+
// Old method using static property
120121
Cell::setValueBinder(new AdvancedValueBinder());
122+
// Preferred method using dynamic property since 3.4.0
123+
$spreadsheet->setValueBinder(new AdvancedValueBinder());
121124

122125
// Set Cell C21 using a formatted string value
123126
$worksheet->getCell('C20')->setValue('€ -12345.6789');

docs/topics/The Dating Game.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -257,7 +257,10 @@ $spreadsheet = new Spreadsheet();
257257
$worksheet = $spreadsheet->getActiveSheet();
258258
// Use the Advanced Value Binder so that our string date/time values will be automatically converted
259259
// to Excel serialized date/timestamps
260+
// Old method using static property
260261
Cell::setValueBinder(new AdvancedValueBinder());
262+
// Preferred method using dynamic property since 3.4.0
263+
$spreadsheet->setValueBinder(new AdvancedValueBinder());
261264

262265
// Write our data to the worksheet
263266
$worksheet->fromArray($projectHeading);

docs/topics/accessing-cells.md

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -518,15 +518,15 @@ style information. The following example demonstrates how to set the
518518
value binder in PhpSpreadsheet:
519519

520520
```php
521-
/** PhpSpreadsheet */
522-
require_once 'src/Boostrap.php';
523-
524-
// Set value binder
521+
// Older method using static property
525522
\PhpOffice\PhpSpreadsheet\Cell\Cell::setValueBinder( new \PhpOffice\PhpSpreadsheet\Cell\AdvancedValueBinder() );
526-
527523
// Create new Spreadsheet object
528524
$spreadsheet = new \PhpOffice\PhpSpreadsheet\Spreadsheet();
529525

526+
// Preferred method using dynamic property since 3.4.0
527+
$spreadsheet = new \PhpOffice\PhpSpreadsheet\Spreadsheet();
528+
$spreadsheet->setValueBinder( new \PhpOffice\PhpSpreadsheet\Cell\AdvancedValueBinder() );
529+
530530
// ...
531531
// Add some data, resembling some different data types
532532
$spreadsheet->getActiveSheet()->setCellValue('A4', 'Percentage value:');
@@ -555,13 +555,20 @@ $stringValueBinder->setNumericConversion(false)
555555
->setBooleanConversion(false)
556556
->setNullConversion(false)
557557
->setFormulaConversion(false);
558+
// Older method using static property
558559
\PhpOffice\PhpSpreadsheet\Cell\Cell::setValueBinder( $stringValueBinder );
560+
// Preferred method using dynamic property since 3.4.0
561+
$spreadsheet = new \PhpOffice\PhpSpreadsheet\Spreadsheet();
562+
$spreadsheet->setValueBinder( $stringValueBinder );
559563
```
560564

561565
You can override the current binder when setting individual cell values by specifying a different Binder to use in the Cell's `setValue()` or the Worksheet's `setCellValue()` methods.
562566
```php
563567
$spreadsheet = new Spreadsheet();
568+
// Old method using static property
564569
Cell::setValueBinder(new AdvancedValueBinder());
570+
// Preferred method using dynamic property since 3.4.0
571+
$spreadsheet->setValueBinder(new AdvancedValueBinder());
565572

566573
$value = '12.5%';
567574

docs/topics/reading-and-writing-to-file.md

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1113,19 +1113,19 @@ Flags that are available that can be passed to the Reader in this way include:
11131113

11141114
- $reader::LOAD_WITH_CHARTS
11151115
- $reader::READ_DATA_ONLY
1116-
- $reader::IGNORE_EMPTY_CELLS
1117-
- $reader::SKIP_EMPTY_CELLS (synonym for IGNORE_EMPTY_CELLS)
1118-
1119-
| Readers | LOAD_WITH_CHARTS | READ_DATA_ONLY | IGNORE_EMPTY_CELLS |
1120-
|----------|------------------|----------------|--------------------|
1121-
| Xlsx | YES | YES | YES |
1122-
| Xls | NO | YES | YES |
1123-
| Xml | NO | NO | NO |
1124-
| Ods | NO | YES | NO |
1125-
| Gnumeric | NO | YES | NO |
1126-
| Html | N/A | N/A | N/A |
1127-
| Slk | N/A | NO | NO |
1128-
| Csv | N/A | NO | NO |
1116+
- $reader::IGNORE_EMPTY_CELLS
1117+
- $reader::IGNORE_ROWS_WITH_NO_CELLS
1118+
1119+
| Readers | LOAD_WITH_CHARTS | READ_DATA_ONLY | IGNORE_EMPTY_CELLS | IGNORE_ROWS_WITH_NO_CELLS |
1120+
|----------|------------------|----------------|--------------------|---------------------------|
1121+
| Xlsx | YES | YES | YES | YES |
1122+
| Xls | NO | YES | YES | NO |
1123+
| Xml | NO | NO | NO | NO |
1124+
| Ods | NO | YES | NO | NO |
1125+
| Gnumeric | NO | YES | NO | NO |
1126+
| Html | N/A | N/A | N/A | N/A |
1127+
| Slk | N/A | NO | NO | NO |
1128+
| Csv | N/A | NO | NO | NO |
11291129

11301130
Likewise, when saving a file using a Writer, loaded charts will not be saved unless you explicitly tell the Writer to include them:
11311131

@@ -1162,5 +1162,5 @@ Two or more flags can be passed together using PHP's `|` operator.
11621162

11631163
```php
11641164
$reader = \PhpOffice\PhpSpreadsheet\IOFactory::createReaderForFile("myExampleFile.xlsx");
1165-
$reader->load("spreadsheetWithCharts.xlsx", $reader::READ_DATA_ONLY | $reader::SKIP_EMPTY_CELLS);
1165+
$reader->load("spreadsheetWithCharts.xlsx", $reader::READ_DATA_ONLY | $reader::IGNORE_EMPTY_CELLS);
11661166
```

docs/topics/reading-files.md

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -755,14 +755,18 @@ So using a Value Binder allows a great deal more flexibility in the
755755
loader logic when reading unformatted text files.
756756

757757
```php
758-
/** Tell PhpSpreadsheet that we want to use the Advanced Value Binder **/
759-
\PhpOffice\PhpSpreadsheet\Cell\Cell::setValueBinder( new \PhpOffice\PhpSpreadsheet\Cell\AdvancedValueBinder() );
760-
761758
$inputFileType = 'Csv';
762759
$inputFileName = './sampleData/example1.tsv';
763760

764761
$reader = \PhpOffice\PhpSpreadsheet\IOFactory::createReader($inputFileType);
765762
$reader->setDelimiter("\t");
763+
764+
/** Tell PhpSpreadsheet that we want to use the Advanced Value Binder **/
765+
// Old method using static property
766+
\PhpOffice\PhpSpreadsheet\Cell\Cell::setValueBinder( new \PhpOffice\PhpSpreadsheet\Cell\AdvancedValueBinder() );
767+
// Preferred method using dynamic property since 3.4.0
768+
$reader::setValueBinder( new \PhpOffice\PhpSpreadsheet\Cell\AdvancedValueBinder() );
769+
766770
$spreadsheet = $reader->load($inputFileName);
767771
```
768772

@@ -774,7 +778,7 @@ Loading using a Value Binder applies to:
774778
Reader | Y/N |Reader | Y/N |Reader | Y/N
775779
----------|:---:|--------|:---:|--------------|:---:
776780
Xlsx | NO | Xls | NO | Xml | NO
777-
Ods | NO | SYLK | NO | Gnumeric | NO
781+
Ods | NO | SYLK | YES | Gnumeric | NO
778782
CSV | YES | HTML | YES
779783

780784
Note that you can also use the Binder to determine how PhpSpreadsheet identified datatypes for values when you set a cell value without explicitly setting a datatype.

docs/topics/recipes.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,10 @@ method that suits you the best. Here are some examples:
233233

234234
```php
235235
// MySQL-like timestamp '2008-12-31' or date string
236+
// Old method using static property
236237
\PhpOffice\PhpSpreadsheet\Cell\Cell::setValueBinder( new \PhpOffice\PhpSpreadsheet\Cell\AdvancedValueBinder() );
238+
// Preferred method using dynamic property since 3.4.0
239+
$spreadsheet->setValueBinder( new \PhpOffice\PhpSpreadsheet\Cell\AdvancedValueBinder() );
237240

238241
$spreadsheet->getActiveSheet()
239242
->setCellValue('D1', '2008-12-31');
@@ -599,7 +602,10 @@ when it sees a newline character in a string that you are inserting in a
599602
cell. Just like Microsoft Office Excel. Try this:
600603

601604
```php
605+
// Old method using static property
602606
\PhpOffice\PhpSpreadsheet\Cell\Cell::setValueBinder( new \PhpOffice\PhpSpreadsheet\Cell\AdvancedValueBinder() );
607+
// Preferred method using dynamic property since 3.4.0
608+
$spreadsheet->setValueBinder( new \PhpOffice\PhpSpreadsheet\Cell\AdvancedValueBinder() );
603609

604610
$spreadsheet->getActiveSheet()->getCell('A1')->setValue("hello\nworld");
605611
```

samples/Basic4/53_ImageOpacity.php

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
<?php
2+
3+
require __DIR__ . '/../Header.php';
4+
5+
use PhpOffice\PhpSpreadsheet\Spreadsheet;
6+
use PhpOffice\PhpSpreadsheet\Worksheet\Drawing;
7+
8+
//var_dump(realpath(__DIR__ . '/../images/blue_square.png'));
9+
//exit();
10+
11+
$path = __DIR__ . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . 'images/blue_square.png';
12+
$spreadsheet = new Spreadsheet();
13+
$spreadsheet->getProperties()->setTitle('53_ImageOpacity');
14+
15+
$helper->log('Add image to spreadsheet 6 times with different opacities');
16+
$sheet = $spreadsheet->getActiveSheet();
17+
$sheet->setTitle('Squares different opacities');
18+
$sheet->setShowGridLines(false);
19+
20+
$drawing = new Drawing();
21+
$drawing->setName('Blue Square opacity not specified');
22+
$drawing->setPath($path);
23+
$drawing->setCoordinates('A1');
24+
$drawing->setCoordinates2('B5');
25+
$drawing->setWorksheet($sheet);
26+
27+
$drawing = new Drawing();
28+
$drawing->setName('Blue Square opacity 80%');
29+
$drawing->setPath($path);
30+
$drawing->setCoordinates('C1');
31+
$drawing->setCoordinates2('D5');
32+
$drawing->setOpacity(80000);
33+
$drawing->setWorksheet($sheet);
34+
35+
$drawing = new Drawing();
36+
$drawing->setName('Blue Square opacity 60%');
37+
$drawing->setPath($path);
38+
$drawing->setCoordinates('E1');
39+
$drawing->setCoordinates2('F5');
40+
$drawing->setOpacity(60000);
41+
$drawing->setWorksheet($sheet);
42+
43+
$drawing = new Drawing();
44+
$drawing->setName('Blue Square opacity 40%');
45+
$drawing->setPath($path);
46+
$drawing->setCoordinates('A8');
47+
$drawing->setCoordinates2('B12');
48+
$drawing->setOpacity(40000);
49+
$drawing->setWorksheet($sheet);
50+
51+
$drawing = new Drawing();
52+
$drawing->setName('Blue Square opacity 20%');
53+
$drawing->setPath($path);
54+
$drawing->setCoordinates('C8');
55+
$drawing->setCoordinates2('D12');
56+
$drawing->setOpacity(20000);
57+
$drawing->setWorksheet($sheet);
58+
59+
$drawing = new Drawing();
60+
$drawing->setName('Blue Square opacity 0%');
61+
$drawing->setPath($path);
62+
$drawing->setCoordinates('E8');
63+
$drawing->setCoordinates2('F12');
64+
$drawing->setOpacity(0);
65+
$drawing->setWorksheet($sheet);
66+
67+
// Save
68+
$helper->write($spreadsheet, __FILE__, ['Xlsx', 'Html', 'Dompdf', 'Mpdf']);
69+
$spreadsheet->disconnectWorksheets();

samples/images/blue_square.png

2.3 KB
Loading

0 commit comments

Comments
 (0)