class PHPExcel_Writer_HTML extends PHPExcel_Writer_Abstract implements PHPExcel_Writer_IWriter

PHPExcelWriterHTML

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 PHPExcelWriterHTML

save($pFilename = null)

Save PHPExcel to file

int
getSheetIndex()

Get sheet index

setSheetIndex(int $pValue)

Set sheet index

boolean
setGenerateSheetNavigationBlock(boolean $pValue = true)

Set sheet index

writeAllSheets()

Write all sheets (resets sheetIndex to NULL)

string
generateHTMLHeader(boolean $pIncludeStyles = false)

Generate HTML header

string
generateSheetData()

Generate sheet data

string
generateNavigation()

Generate sheet tabs

string
generateStyles(boolean $generateSurroundingHTML = true)

Generate CSS styles

array
buildCSS(boolean $generateSurroundingHTML = true)

Build CSS styles

generateHTMLFooter()

Generate HTML footer

string
getImagesRoot()

Get images root

setImagesRoot(string $pValue = '.')

Set images root

boolean
getEmbedImages()

Get embed images

setEmbedImages(boolean $pValue = '.')

Set embed images

boolean
getUseInlineCss()

Get use inline CSS?

setUseInlineCss(boolean $pValue = false)

Set use inline CSS?

string
formatColor(string $pValue, string $pFormat)

Add color to formatted string as inline style

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 142
__construct(PHPExcel $phpExcel)

Create a new PHPExcelWriterHTML

Parameters

PHPExcel $phpExcel PHPExcel object

at line 154
save($pFilename = null)

Save PHPExcel to file

Parameters

$pFilename

Exceptions

PHPExcel_Writer_Exception

at line 288
int getSheetIndex()

Get sheet index

Return Value

int

at line 299
PHPExcel_Writer_HTML setSheetIndex(int $pValue)

Set sheet index

Parameters

int $pValue Sheet index

Return Value

PHPExcel_Writer_HTML

at line 310
boolean getGenerateSheetNavigationBlock()

Get sheet index

Return Value

boolean

at line 321
PHPExcel_Writer_HTML setGenerateSheetNavigationBlock(boolean $pValue = true)

Set sheet index

Parameters

boolean $pValue Flag indicating whether the sheet navigation block should be generated or not

Return Value

PHPExcel_Writer_HTML

at line 330
writeAllSheets()

Write all sheets (resets sheetIndex to NULL)

at line 343
string generateHTMLHeader(boolean $pIncludeStyles = false)

Generate HTML header

Parameters

boolean $pIncludeStyles Include styles?

Return Value

string

Exceptions

PHPExcel_Writer_Exception

at line 402
string generateSheetData()

Generate sheet data

Return Value

string

Exceptions

PHPExcel_Writer_Exception

at line 521
string generateNavigation()

Generate sheet tabs

Return Value

string

Exceptions

PHPExcel_Writer_Exception

at line 744
string generateStyles(boolean $generateSurroundingHTML = true)

Generate CSS styles

Parameters

boolean $generateSurroundingHTML Generate surrounding HTML tags? (<style> and </style>)

Return Value

string

Exceptions

PHPExcel_Writer_Exception

at line 786
array buildCSS(boolean $generateSurroundingHTML = true)

Build CSS styles

Parameters

boolean $generateSurroundingHTML Generate surrounding HTML style? (html { })

Return Value

array

Exceptions

PHPExcel_Writer_Exception

at line 1073
generateHTMLFooter()

Generate HTML footer

at line 1416
string getImagesRoot()

Get images root

Return Value

string

at line 1427
PHPExcel_Writer_HTML setImagesRoot(string $pValue = '.')

Set images root

Parameters

string $pValue

Return Value

PHPExcel_Writer_HTML

at line 1438
boolean getEmbedImages()

Get embed images

Return Value

boolean

at line 1449
PHPExcel_Writer_HTML setEmbedImages(boolean $pValue = '.')

Set embed images

Parameters

boolean $pValue

Return Value

PHPExcel_Writer_HTML

at line 1460
boolean getUseInlineCss()

Get use inline CSS?

Return Value

boolean

at line 1471
PHPExcel_Writer_HTML setUseInlineCss(boolean $pValue = false)

Set use inline CSS?

Parameters

boolean $pValue

Return Value

PHPExcel_Writer_HTML

at line 1484
string formatColor(string $pValue, string $pFormat)

Add color to formatted string as inline style

Parameters

string $pValue Plain formatted value without color
string $pFormat Format code

Return Value

string