PHPExcel classes » \PHPExcel_Writer_CSV

PHPExcel_Writer_CSV

category | PHPExcel
package | PHPExcel_Writer_CSV
copyright | Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)

### Methods

## Create a new PHPExcel_Writer_CSV

    __construct(\PHPExcel $phpExcel)

### Parameters

#### $phpExcel

`\PHPExcel`

PHPExcel object

## Get delimiter

    getDelimiter() : string

### Returns

`string`

## Get disk caching directory

    getDiskCachingDirectory() : string

Inherited

inherited_from | \PHPExcel_Writer_Abstract::getDiskCachingDirectory()

### Returns

`string`

## Get enclosure

    getEnclosure() : string

### Returns

`string`

## Get whether the file should be saved with full Excel Compatibility

    getExcelCompatibility() : boolean

### Returns

`boolean`

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

    getIncludeCharts() : boolean

Inherited

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

inherited_from | \PHPExcel_Writer_Abstract::getIncludeCharts()

### Returns

`boolean`

## Get line ending

    getLineEnding() : string

### Returns

`string`

## 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.

    getPreCalculateFormulas() : boolean

Inherited

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

inherited_from | \PHPExcel_Writer_Abstract::getPreCalculateFormulas()

### Returns

`boolean`

## Get sheet index

    getSheetIndex() : int

### Returns

`int`

## Get whether BOM should be used

    getUseBOM() : boolean

### Returns

`boolean`

## Get use disk caching where possible?

    getUseDiskCaching() : boolean

Inherited

inherited_from | \PHPExcel_Writer_Abstract::getUseDiskCaching()

### Returns

`boolean`

## Save PHPExcel to file

    save(string $pFilename)

@param string $pFilename Name of the file to save

### Parameters

#### $pFilename

`string`

### Exceptions

`\PHPExcel_Writer_Exception` |

## Set delimiter

    setDelimiter(string $pValue) : \PHPExcel_Writer_CSV

### Parameters

#### $pValue

`string`

Delimiter, defaults to ,

### Returns

`\PHPExcel_Writer_CSV`

## Set enclosure

    setEnclosure(string $pValue) : \PHPExcel_Writer_CSV

### Parameters

#### $pValue

`string`

Enclosure, defaults to "

### Returns

`\PHPExcel_Writer_CSV`

## Set whether the file should be saved with full Excel Compatibility

    setExcelCompatibility(boolean $pValue) : \PHPExcel_Writer_CSV

### Parameters

#### $pValue

`boolean`

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

### Returns

`\PHPExcel_Writer_CSV`

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

    setIncludeCharts(boolean $pValue) : \PHPExcel_Writer_IWriter

Inherited

Set to false (the default) to ignore charts.

inherited_from | \PHPExcel_Writer_Abstract::setIncludeCharts()

### Parameters

#### $pValue

`boolean`

### Returns

`\PHPExcel_Writer_IWriter`

## Set line ending

    setLineEnding(string $pValue) : \PHPExcel_Writer_CSV

### Parameters

#### $pValue

`string`

Line ending, defaults to OS line ending (PHP_EOL)

### Returns

`\PHPExcel_Writer_CSV`

## 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.

    setPreCalculateFormulas(boolean $pValue) : \PHPExcel_Writer_IWriter

Inherited

inherited_from | \PHPExcel_Writer_Abstract::setPreCalculateFormulas()

### Parameters

#### $pValue

`boolean`

Pre-Calculate Formulas?

### Returns

`\PHPExcel_Writer_IWriter`

## Set sheet index

    setSheetIndex(int $pValue) : \PHPExcel_Writer_CSV

### Parameters

#### $pValue

`int`

Sheet index

### Returns

`\PHPExcel_Writer_CSV`

## Set whether BOM should be used

    setUseBOM(boolean $pValue) : \PHPExcel_Writer_CSV

### Parameters

#### $pValue

`boolean`

Use UTF-8 byte-order mark? Defaults to false

### Returns

`\PHPExcel_Writer_CSV`

## Set use disk caching where possible?

    setUseDiskCaching(boolean $pValue, string $pDirectory) : \PHPExcel_Writer_Excel2007

Inherited

inherited_from | \PHPExcel_Writer_Abstract::setUseDiskCaching()

### Parameters

#### $pValue

`boolean`

#### $pDirectory

`string`

Disk caching directory

### Exceptions

`\PHPExcel_Writer_Exception` | when directory does not exist

### Returns

`\PHPExcel_Writer_Excel2007`

## Write line to CSV file

    _writeLine(mixed $pFileHandle, array $pValues)

### Parameters

#### $pFileHandle

`mixed`

PHP filehandle

#### $pValues

`array`

Array containing values in a row

### Exceptions

`\PHPExcel_Writer_Exception` |

### Properties

##

    $_diskCachingDirectory : string

Inherited

inherited_from | \PHPExcel_Writer_Abstract::$$_diskCachingDirectory

##

    $_includeCharts : boolean

Inherited

inherited_from | \PHPExcel_Writer_Abstract::$$_includeCharts

##

    $_preCalculateFormulas : boolean

Inherited

inherited_from | \PHPExcel_Writer_Abstract::$$_preCalculateFormulas

##

    $_useDiskCaching : boolean

Inherited

inherited_from | \PHPExcel_Writer_Abstract::$$_useDiskCaching

##

    $_delimiter : string

##

    $_enclosure : string

##

    $_excelCompatibility : boolean

##

    $_lineEnding : string

##

    $_phpExcel : \PHPExcel

##

    $_sheetIndex : int

##

    $_useBOM : boolean