Commit Graph

7 Commits

Author SHA1 Message Date
oleibman 6fbeeb705b Use Default Style for Unstyled Tables
Using a default style looks better than leaving them unstyled. User has ability to ignore unstyled tables as before, but I don't know why one would want to.
2025-12-29 17:34:55 -08:00
oleibman ecbd702628 Phpstan and Samples
Phpstan hasn't identified any errors in Samples in a long time. But, as it turns out, one particular error is suppressed:
```
Variable $helper might not be defined.
```
This error would be generated by almost all samples, and the errors that it suppresses will become problematic if we move to Level 10. We are not yet committed to doing that, but it is pretty easy to write a script to change the samples so that error no longer happens, and there isn't really any reason to delay doing so. The results of that script constitute this PR.
2025-04-05 13:54:20 -07:00
MarkBaker 44f3dbe82b Improved Table examples 2023-04-02 20:05:59 +02:00
aswinkumar863 83feae3f35 AutoFilter inside Tables
Worksheet autofilter and autofilter inside tables share the
same XML structure. By taking advantage of that, I just added
a simple reference to the worksheet autofilter inside the table.

In this commit:
- Added autofilter inside tables.
- Implemented XLSX writer and reader.
- Refactored autofilter writer and reader.
- Added additional unit test.
- Fixed the broken test (testLoadOffice365AutoFilter).
2022-05-29 19:38:43 +05:30
aswinkumar863 530e6642bf Table name as an constructor argument
Replaced worksheet argument with table name
2022-04-17 17:48:38 +05:30
aswinkumar863 3c3d949a5d Added table name validation
Validation added for
- invalid characters
- invalid names ("C", "c", "R", or "r")
- cell references
- space separate words
- maxlength of 255 characters
- unique table names across worksheet
2022-04-03 18:23:13 +05:30
aswinkumar863 92a50d134f Format as Table for Xlsx
Initial implementation of Excel's tables feature (i.e. Select Home >
Format as Table in Excel App).

Tables are similar to AutoFilter but tables have other advantages like
named ranges, easy formatting, totals row and header row with filter.
Tables can also be converted to charts and pivot tables easily.

Usage:
$table = new Table();
$table->setName('Sales_Data');
$table->setRange('A1:D17');
$spreadsheet->getActiveSheet()->addTable($table);

In this Commit:
- Added Table API with initial support for header and totals row.
- Added complete styling options for Table.
- Added Xlsx Writer for Table.
- Added samples.
- Covered with unit tests.

To be done:
- Filter expressions similar to AutoFilter.
- Precalucate formulas for totals row (Check sample 2).
- Table named ranges in formulas and calculation.
2022-03-10 19:54:45 +05:30