Skip to content

Commit 954fb87

Browse files
authored
Merge pull request #4735 from oleibman/gridright
Minor Improvements to TextGrid
2 parents 56537cb + e3140e5 commit 954fb87

27 files changed

+222
-51
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ and this project adheres to [Semantic Versioning](https://semver.org). Thia is a
3131

3232
- Slightly better support for escaped characters in Xlsx Reader/Writer. [Discussion #4724](https://github.com/PHPOffice/PhpSpreadsheet/discussions/4724) [PR #4726](https://github.com/PHPOffice/PhpSpreadsheet/pull/4726)
3333
- CODE/UNICODE and CHAR/UNICHAR. [PR #4727](https://github.com/PHPOffice/PhpSpreadsheet/pull/4727)
34+
- Minor changes to TextGrid. [PR #4735](https://github.com/PHPOffice/PhpSpreadsheet/pull/4735)
3435

3536
## 2025-11-24 - 5.3.0
3637

samples/Autofilter/10_Autofilter.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@
8686
['2011', 'Q4', 'Italy', 335],
8787
];
8888
$spreadsheet->getActiveSheet()->fromArray($dataArray, null, 'A2');
89-
$helper->displayGrid($spreadsheet->getActiveSheet()->toArray(null, false, false, true));
89+
$helper->displayGrid($spreadsheet->getActiveSheet()->toArray(null, false, false, true), true);
9090

9191
// Set title row bold
9292
$helper->log('Set title row bold');

samples/Autofilter/10_Autofilter_selection_1.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,11 @@
2626
// Create the worksheet
2727
$helper->log('Add data');
2828
$spreadsheet->setActiveSheetIndex(0);
29-
$spreadsheet->getActiveSheet()->setCellValue('A1', 'Financial Year')
30-
->setCellValue('B1', 'Financial Period')
29+
$spreadsheet->getActiveSheet()->setCellValue('A1', 'Year')
30+
->setCellValue('B1', 'Period')
3131
->setCellValue('C1', 'Country')
3232
->setCellValue('D1', 'Date')
33-
->setCellValue('E1', 'Sales Value')
33+
->setCellValue('E1', 'Sales')
3434
->setCellValue('F1', 'Expenditure');
3535
$dateTime = new DateTime();
3636
$startYear = $endYear = $currentYear = (int) $dateTime->format('Y');

samples/Autofilter/10_Autofilter_selection_2.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,11 @@
2626
// Create the worksheet
2727
$helper->log('Add data');
2828
$spreadsheet->setActiveSheetIndex(0);
29-
$spreadsheet->getActiveSheet()->setCellValue('A1', 'Financial Year')
30-
->setCellValue('B1', 'Financial Period')
29+
$spreadsheet->getActiveSheet()->setCellValue('A1', 'Year')
30+
->setCellValue('B1', 'Period')
3131
->setCellValue('C1', 'Country')
3232
->setCellValue('D1', 'Date')
33-
->setCellValue('E1', 'Sales Value')
33+
->setCellValue('E1', 'Sales')
3434
->setCellValue('F1', 'Expenditure');
3535
$dateTime = new DateTime();
3636
$startYear = $endYear = $currentYear = (int) $dateTime->format('Y');

samples/Autofilter/10_Autofilter_selection_display.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,11 @@
2626
// Create the worksheet
2727
$helper->log('Add data');
2828
$spreadsheet->setActiveSheetIndex(0);
29-
$spreadsheet->getActiveSheet()->setCellValue('A1', 'Financial Year')
30-
->setCellValue('B1', 'Financial Period')
29+
$spreadsheet->getActiveSheet()->setCellValue('A1', 'Year')
30+
->setCellValue('B1', 'Period')
3131
->setCellValue('C1', 'Country')
3232
->setCellValue('D1', 'Date')
33-
->setCellValue('E1', 'Sales Value')
33+
->setCellValue('E1', 'Sales')
3434
->setCellValue('F1', 'Expenditure');
3535
$dateTime = new DateTime();
3636
$startYear = $endYear = $currentYear = (int) $dateTime->format('Y');

samples/Database/DAVERAGE.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,13 @@
3636

3737
$worksheet->setCellValue('A13', 'The Average age of all Apple and Pear trees in the orchard');
3838
$worksheet->setCellValue('B13', '=DAVERAGE(A4:E10,3,A1:A3)');
39+
$worksheet->getStyle('E5:E10')->getNumberFormat()
40+
->setFormatCode('0.00');
3941

4042
$helper->log('Database');
4143

4244
$databaseData = $worksheet->rangeToArray('A4:E10', null, true, true, true);
43-
$helper->displayGrid($databaseData);
45+
$helper->displayGrid($databaseData, true);
4446

4547
// Test the formulae
4648
$helper->log('Criteria');

samples/Database/DCOUNT.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
$helper->log('Database');
4141

4242
$databaseData = $worksheet->rangeToArray('A4:E10', null, true, true, true);
43-
$helper->displayGrid($databaseData);
43+
$helper->displayGrid($databaseData, true);
4444

4545
// Test the formulae
4646
$helper->log('Criteria');

samples/Database/DCOUNTA.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
$helper->log('Database');
4141

4242
$databaseData = $worksheet->rangeToArray('A4:E10', null, true, true, true);
43-
$helper->displayGrid($databaseData);
43+
$helper->displayGrid($databaseData, true);
4444

4545
// Test the formulae
4646
$helper->log('Criteria');

samples/Database/DGET.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,13 @@
3636

3737
$worksheet->setCellValue('A13', 'The height of the Apple tree (will return an Excel error, because there is more than one apple tree)');
3838
$worksheet->setCellValue('B13', '=DGET(A4:E10,"Height",A1:A2)');
39+
$worksheet->getStyle('E5:E10')->getNumberFormat()
40+
->setFormatCode('0.00');
3941

4042
$helper->log('Database');
4143

4244
$databaseData = $worksheet->rangeToArray('A4:E10', null, true, true, true);
43-
$helper->displayGrid($databaseData);
45+
$helper->displayGrid($databaseData, true);
4446

4547
// Test the formulae
4648
$helper->log('Criteria');

samples/Database/DMAX.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,13 @@
3636

3737
$worksheet->setCellValue('A13', 'The Oldest apple tree in the orchard');
3838
$worksheet->setCellValue('B13', '=DMAX(A4:E10,3,A1:A2)');
39+
$worksheet->getStyle('E5:E10')->getNumberFormat()
40+
->setFormatCode('0.00');
3941

4042
$helper->log('Database');
4143

4244
$databaseData = $worksheet->rangeToArray('A4:E10', null, true, true, true);
43-
$helper->displayGrid($databaseData);
45+
$helper->displayGrid($databaseData, true);
4446

4547
// Test the formulae
4648
$helper->log('Criteria');

0 commit comments

Comments
 (0)