\ExcelDataFormatter
ExcelDataFormatter provides a DataFormatter allowing an {@link SS_link} of {@link DataObjectInterface} to be exported to be to Excel 2007 Spreadsheet (XLSX).
This class can be extended to export to other format supported by
{@link https://github.com/PHPOffice/PHPExcel PHPExcel}.
- Author: Firebrand <hello@firebrand.nz>
- License: MIT
Synopsis
class ExcelDataFormatter
extends DataFormatter
{
- // members
- private static string $api_base = "api/v1/";
- protected bool $useLabelsAsHeaders = NULL;
- // methods
- public void supportedExtensions()
- public void supportedMimeTypes()
- public void convertDataObject()
- public void convertDataObjectSet()
- protected void setHeader()
- protected void getFieldsForObj()
- public PHPExcel getPhpExcelObject()
- protected PHPExcel setupExcel()
- protected PHPExcel_Worksheet headerRow()
- protected PHPExcel_Worksheet addRow()
- protected string getFileData()
- public bool getUseLabelsAsHeaders()
- public ExcelDataFormatter setUseLabelsAsHeaders()
Hierarchy
Extends
- DataFormatter
Members
private
- $api_base
protected
- $useLabelsAsHeaders
—
bool
Determined what we will use as headers for the spread sheet.
Methods
protected
- addRow() — Add a new row to a {@link PHPExcel_Worksheet} based of a {@link DataObjectInterface}
- getFieldsForObj()
- getFileData() — Generate a string representation of an {@link PHPExcel} spread sheet suitable for output to the browser.
- headerRow() — Add an header row to a {@link PHPExcel_Worksheet}.
- setHeader() — Set the HTTP Content Type header to the appropriate Mime Type.
- setupExcel() — Initialize a new {@link PHPExcel} object based on the provided {@link DataObjectInterface} interface.
public
- convertDataObject()
- convertDataObjectSet()
- getPhpExcelObject() — Generate a {@link PHPExcel} for the provided DataObject List
- getUseLabelsAsHeaders() — Accessor for UseLabelsAsHeaders. If this is `true`, the data formatter will call {@link DataObject::fieldLabel()} to pick the header strings. If it's set to false, it will use the raw field name.
- setUseLabelsAsHeaders() — Setter for UseLabelsAsHeaders. If this is `true`, the data formatter will call {@link DataObject::fieldLabel()} to pick the header strings. If it's set to false, it will use the raw field name.
- supportedExtensions()
- supportedMimeTypes()