I have a one-to-many like array.
Structure example:
[
[
InvoiceID,
[
InvoiceEntry1_label,
InvoiceEntry2_label
],
[
InvoiceEntry1_value,
InvoiceEntry2_value
],
Total
],
[
InvoiceID,
[
InvoiceEntry1_label,
InvoiceEntry2_label
],
[
InvoiceEntry1_value,
InvoiceEntry2_value
],
Total
],
and so on
]
How can I group rows using PHPExcel, such that after sorting in Excel, rows which belong to an Invoice will stick together?
Do not confuse with Excel outlining and grouping functionality, for which rows won’t stick together after sort.
I already know how to use PHPExcel. A simple example or a documentation reference will do as an answer. I couldn’t find one myself.
In Excel this can only be done using Pivot Tables like this:
The above enabled sticking of rows after sorting and also filtering, with a really nice looking one-to-many representation (where the many part is splitting the current rows into child rows).
PHPExcel does not yet support Pivot Tables at all (“Codeplex: Implement pivot tables”), so the above Excel Pivot Table cannot be created, edited or read using PHPExcel.