class PHPExcel_Writer_CSV extends PHPExcel_Writer_Abstract implements PHPExcel_Writer_IWriter

PHPExcelWriterCSV

Copyright (c) 2006 - 2015 PHPExcel

This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version.

This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA

Methods

boolean
getIncludeCharts()

Write charts in workbook? If this is true, then the Writer will write definitions for any charts that exist in the PHPExcel object.

setIncludeCharts(boolean $pValue = false)

Set write charts in workbook Set to true, to advise the Writer to include any charts that exist in the PHPExcel object.

boolean
getPreCalculateFormulas()

Get Pre-Calculate Formulas flag If this is true (the default), then the writer will recalculate all formulae in a workbook when saving, so that the pre-calculated values are immediately available to MS Excel or other office spreadsheet viewer when opening the file If false, then formulae are not calculated on save. This is faster for saving in PHPExcel, but slower when opening the resulting file in MS Excel, because Excel has to recalculate the formulae itself

setPreCalculateFormulas(boolean $pValue = true)

Set Pre-Calculate Formulas Set to true (the default) to advise the Writer to calculate all formulae on save Set to false to prevent precalculation of formulae on save.

boolean
getUseDiskCaching()

Get use disk caching where possible?

setUseDiskCaching(boolean $pValue = false, string $pDirectory = null)

Set use disk caching where possible?

string
getDiskCachingDirectory()

Get disk caching directory

__construct(PHPExcel $phpExcel)

Create a new PHPExcelWriterCSV

save($pFilename = null)

Save PHPExcel to file

string
getDelimiter()

Get delimiter

setDelimiter(string $pValue = ',')

Set delimiter

string
getEnclosure()

Get enclosure

setEnclosure(string $pValue = '"')

Set enclosure

string
getLineEnding()

Get line ending

setLineEnding(string $pValue = PHP_EOL)

Set line ending

boolean
getUseBOM()

Get whether BOM should be used

setUseBOM(boolean $pValue = false)

Set whether BOM should be used

boolean
getIncludeSeparatorLine()

Get whether a separator line should be included

setIncludeSeparatorLine(boolean $pValue = false)

Set whether a separator line should be included as the first line of the file

boolean
getExcelCompatibility()

Get whether the file should be saved with full Excel Compatibility

setExcelCompatibility(boolean $pValue = false)

Set whether the file should be saved with full Excel Compatibility

int
getSheetIndex()

Get sheet index

setSheetIndex(int $pValue)

Set sheet index

Details

boolean getIncludeCharts()

Write charts in workbook? If this is true, then the Writer will write definitions for any charts that exist in the PHPExcel object.

If false (the default) it will ignore any charts defined in the PHPExcel object.

Return Value

boolean

PHPExcel_Writer_IWriter setIncludeCharts(boolean $pValue = false)

Set write charts in workbook Set to true, to advise the Writer to include any charts that exist in the PHPExcel object.

Set to false (the default) to ignore charts.

Parameters

boolean $pValue

Return Value

PHPExcel_Writer_IWriter

boolean getPreCalculateFormulas()

Get Pre-Calculate Formulas flag If this is true (the default), then the writer will recalculate all formulae in a workbook when saving, so that the pre-calculated values are immediately available to MS Excel or other office spreadsheet viewer when opening the file If false, then formulae are not calculated on save. This is faster for saving in PHPExcel, but slower when opening the resulting file in MS Excel, because Excel has to recalculate the formulae itself

Return Value

boolean

PHPExcel_Writer_IWriter setPreCalculateFormulas(boolean $pValue = true)

Set Pre-Calculate Formulas Set to true (the default) to advise the Writer to calculate all formulae on save Set to false to prevent precalculation of formulae on save.

Parameters

boolean $pValue Pre-Calculate Formulas?

Return Value

PHPExcel_Writer_IWriter

boolean getUseDiskCaching()

Get use disk caching where possible?

Return Value

boolean

PHPExcel_Writer_Excel2007 setUseDiskCaching(boolean $pValue = false, string $pDirectory = null)

Set use disk caching where possible?

Parameters

boolean $pValue
string $pDirectory Disk caching directory

Return Value

PHPExcel_Writer_Excel2007

Exceptions

PHPExcel_Writer_Exception when directory does not exist

string getDiskCachingDirectory()

Get disk caching directory

Return Value

string

at line 101
__construct(PHPExcel $phpExcel)

Create a new PHPExcelWriterCSV

Parameters

PHPExcel $phpExcel PHPExcel object

at line 112
save($pFilename = null)

Save PHPExcel to file

Parameters

$pFilename

Exceptions

PHPExcel_Writer_Exception

at line 168
string getDelimiter()

Get delimiter

Return Value

string

at line 179
PHPExcel_Writer_CSV setDelimiter(string $pValue = ',')

Set delimiter

Parameters

string $pValue Delimiter, defaults to ,

Return Value

PHPExcel_Writer_CSV

at line 190
string getEnclosure()

Get enclosure

Return Value

string

at line 201
PHPExcel_Writer_CSV setEnclosure(string $pValue = '"')

Set enclosure

Parameters

string $pValue Enclosure, defaults to "

Return Value

PHPExcel_Writer_CSV

at line 215
string getLineEnding()

Get line ending

Return Value

string

at line 226
PHPExcel_Writer_CSV setLineEnding(string $pValue = PHP_EOL)

Set line ending

Parameters

string $pValue Line ending, defaults to OS line ending (PHP_EOL)

Return Value

PHPExcel_Writer_CSV

at line 237
boolean getUseBOM()

Get whether BOM should be used

Return Value

boolean

at line 248
PHPExcel_Writer_CSV setUseBOM(boolean $pValue = false)

Set whether BOM should be used

Parameters

boolean $pValue Use UTF-8 byte-order mark? Defaults to false

Return Value

PHPExcel_Writer_CSV

at line 259
boolean getIncludeSeparatorLine()

Get whether a separator line should be included

Return Value

boolean

at line 270
PHPExcel_Writer_CSV setIncludeSeparatorLine(boolean $pValue = false)

Set whether a separator line should be included as the first line of the file

Parameters

boolean $pValue Use separator line? Defaults to false

Return Value

PHPExcel_Writer_CSV

at line 281
boolean getExcelCompatibility()

Get whether the file should be saved with full Excel Compatibility

Return Value

boolean

at line 293
PHPExcel_Writer_CSV setExcelCompatibility(boolean $pValue = false)

Set whether the file should be saved with full Excel Compatibility

Parameters

boolean $pValue Set the file to be written as a fully Excel compatible csv file Note that this overrides other settings such as useBOM, enclosure and delimiter

Return Value

PHPExcel_Writer_CSV

at line 304
int getSheetIndex()

Get sheet index

Return Value

int

at line 315
PHPExcel_Writer_CSV setSheetIndex(int $pValue)

Set sheet index

Parameters

int $pValue Sheet index

Return Value

PHPExcel_Writer_CSV