CsvExporterType
The CsvExporterType represents an exporter that uses a PhpSpreadsheet CSV writer.
Note
Please note that CSV file format has some limits regarding styling cells, number formatting, etc.
For more details, see PhpSpreadsheet CSV Writer documentation.
Options
delimiter
type: string default: ','
Represents a string that separates the CSV files values.
enclosure
type: string default: '"'
Represents a string that wraps all CSV fields.
enclosure_required
type: bool default: true
By default, all CSV fields are wrapped in the enclosure character. Value of this option determines whether to use the enclosure character only when required.
line_ending
type: string default: platform PHP_EOL constant value
Represents a string that separates the CSV files lines.
sheet_index
type: int default: 0
CSV files can only contain one worksheet. Therefore, you can specify which sheet to write to CSV.
use_bom
type: string default: false
CSV files are written in UTF-8. If they do not contain characters outside the ASCII range, nothing else need be done.
However, if such characters are in the file, or if the file starts with the 2 characters 'ID', it should explicitly include a BOM file header;
if it doesn't, Excel will not interpret those characters correctly. This can be enabled by setting this option to true.
include_separator_line
type: bool default: false
Determines whether a separator line should be included as the first line of the file.
excel_compatibility
type: bool default: false
Determines whether the file should be saved with full Excel compatibility.
Note that this overrides other settings such as useBOM, enclosure and delimiter!
output_encoding
type: string default: ''
It can be set to output with the encoding that can be specified by PHP's mb_convert_encoding (e.g. 'SJIS-WIN').
decimal_separator
type: string default: depends on the server's locale setting
If the worksheet you are exporting contains numbers with decimal separators, then you should think about what characters you want to use for those before doing the export.
By default, PhpSpreadsheet looks up in the server's locale settings to decide what character to use. But to avoid problems it is recommended to set the character explicitly.
thousands_separator
type: string default: depends on the server's locale setting
If the worksheet you are exporting contains numbers with thousands separators, then you should think about what characters you want to use for those before doing the export.
By default, PhpSpreadsheet looks up in the server's locale settings to decide what character to use. But to avoid problems it is recommended to set the character explicitly.
Inherited options
pre_calculate_formulas
type: bool default: true
By default, the PhpSpreadsheet writers pre-calculates all formulas in the spreadsheet. This can be slow on large spreadsheets, and maybe even unwanted. Value of this option determines whether the formula pre-calculation is enabled.
use_headers
type: bool default: true
If this value is true, the output will contain data table headers.
label
type: string default: []
Sets the label that will be used when rendering the exporter to the user. This is used in the export form, where user can select desired exporter (e.g. "CSV" or "XLSX").
label_translation_domain
type: false or string default: the default KreyuDataTable is used
Sets the translation domain used when translating the exporter label.
Setting the option to false disables translation.
tempnam_dir
type: string default: /tmp
Sets the directory, that the temporarily created export files will be saved to.
Internally, this value is passed as the first argument to the tempnam() function.
tempnam_prefix
type: string default: exporter_
Sets the prefix of the temporarily created export files.
Internally, this value is passed as the second argument to the tempnam() function.