Pdf
extends Html
in package
Table of Contents
Constants
- BODY_LINE = ' <body>' . PHP_EOL
- BORDER_ARR = [\PhpOffice\PhpSpreadsheet\Style\Border::BORDER_NONE => self::BORDER_NONE, \PhpOffice\PhpSpreadsheet\Style\Border::BORDER_DASHDOT => '1px dashed', \PhpOffice\PhpSpreadsheet\Style\Border::BORDER_DASHDOTDOT => '1px dotted', \PhpOffice\PhpSpreadsheet\Style\Border::BORDER_DASHED => '1px dashed', \PhpOffice\PhpSpreadsheet\Style\Border::BORDER_DOTTED => '1px dotted', \PhpOffice\PhpSpreadsheet\Style\Border::BORDER_DOUBLE => '3px double', \PhpOffice\PhpSpreadsheet\Style\Border::BORDER_HAIR => '1px solid', \PhpOffice\PhpSpreadsheet\Style\Border::BORDER_MEDIUM => '2px solid', \PhpOffice\PhpSpreadsheet\Style\Border::BORDER_MEDIUMDASHDOT => '2px dashed', \PhpOffice\PhpSpreadsheet\Style\Border::BORDER_MEDIUMDASHDOTDOT => '2px dotted', \PhpOffice\PhpSpreadsheet\Style\Border::BORDER_SLANTDASHDOT => '2px dashed', \PhpOffice\PhpSpreadsheet\Style\Border::BORDER_THICK => '3px solid']
- BORDER_NONE = 'none'
- COMMENT_HTML_TAGS_PLAINTEXT = true
- Migration aid to tell if html tags will be treated as plaintext in comments.
Properties
- $conditionalFormatting : bool
- Conditional Formatting Enables conditional formatting in writer, disabled here, must be enabled in writer via a setter.
- $embedImages : bool
- embed images, or link to images.
- $fileHandle : resource
- $font : string
- Font.
- $includeCharts : bool
- Write charts that are defined in the workbook? Identifies whether the Writer should write definitions for any charts that exist in the PhpSpreadsheet object.
- $isPdf : bool
- Is the current writer creating PDF?
- $ltrSheets : bool
- $orientation : string|null
- Orientation (Over-ride).
- $paperSize : int|null
- Paper size (Over-ride).
- $paperSizes : array<int, array<string|int, float>|string>
- Paper Sizes xRef List.
- $preCalculateFormulas : bool
- Pre-calculate formulas Forces PhpSpreadsheet to 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.
- $rtlSheets : bool
- $spreadsheet : Spreadsheet
- Spreadsheet object.
- $tableFormats : bool
- Table formats Enables table formats in writer, disabled here, must be enabled in writer via a setter.
- $tempDir : string
- Temporary storage directory.
Methods
- __construct() : mixed
- Create a new PDF Writer instance.
- buildCSS() : array<string|int, array<string|int, string>>
- Build CSS styles.
- formatColor() : string
- Add color to formatted string as inline style.
- formatColorStatic() : string
- Add color to formatted string as inline style.
- generateHtmlAll() : string
- Save Spreadsheet as html to variable.
- generateHTMLFooter() : string
- Generate HTML footer.
- generateHTMLHeader() : string
- Generate HTML header.
- generateNavigation() : string
- Generate sheet tabs.
- generateSheetData() : string
- Generate sheet data.
- generateStyles() : string
- Generate CSS styles.
- getBetterBoolean() : bool
- getConditionalFormatting() : bool
- getDiskCachingDirectory() : string
- Get disk caching directory.
- getEmbedImages() : bool
- Get embed images.
- getFont() : string
- Get Font.
- getGenerateSheetNavigationBlock() : bool
- Get sheet index.
- getImagesRoot() : string
- Get images root.
- getIncludeCharts() : bool
- Write charts in workbook? If this is true, then the Writer will write definitions for any charts that exist in the PhpSpreadsheet object.
- getOrientation() : string|null
- Get Orientation.
- getPaperSize() : int|null
- Get Paper Size.
- getPreCalculateFormulas() : bool
- 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 PhpSpreadsheet, but slower when opening the resulting file in MS Excel, because Excel has to recalculate the formulae itself.
- getSheetIndex() : int|null
- Get sheet index.
- getTableFormats() : bool
- getTempDir() : string
- Get temporary storage directory.
- getUseDiskCaching() : bool
- Get use disk caching where possible?
- getUseInlineCss() : bool
- Get use inline CSS?
- openFileHandle() : void
- Open file handle.
- save() : void
- Save Spreadsheet to file.
- setBetterBoolean() : self
- setConditionalFormatting() : self
- setEditHtmlCallback() : void
- Set a callback to edit the entire HTML.
- setEmbedImages() : $this
- Set embed images.
- setFont() : $this
- Set font. Examples: 'arialunicid0-chinese-simplified' 'arialunicid0-chinese-traditional' 'arialunicid0-korean' 'arialunicid0-japanese'.
- setGenerateSheetNavigationBlock() : $this
- Set sheet index.
- setImagesRoot() : $this
- Set images root.
- setIncludeCharts() : $this
- Set write charts in workbook Set to true, to advise the Writer to include any charts that exist in the PhpSpreadsheet object.
- setOrientation() : self
- Set Orientation.
- setPaperSize() : self
- Set Paper Size.
- setPreCalculateFormulas() : $this
- 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.
- setSheetIndex() : $this
- Set sheet index.
- setTableFormats() : self
- setTempDir() : self
- Set temporary storage directory.
- setUseDiskCaching() : $this
- Set use disk caching where possible?
- setUseInlineCss() : $this
- Set use inline CSS?
- winFileToUrl() : string
- Convert Windows file name to file protocol URL.
- writeAllSheets() : $this
- Write all sheets (resets sheetIndex to NULL).
- checkRtlAndLtr() : void
- maybeCloseFileHandle() : void
- Close file handle only if we opened it ourselves.
- prepareForSave() : resource
- Save Spreadsheet to PDF file, pre-save.
- processFlags() : void
- restoreStateAfterSave() : void
- Save PhpSpreadsheet to PDF file, post-save.
Constants
BODY_LINE
public
mixed
BODY_LINE
= ' <body>' . PHP_EOL
BORDER_ARR
public
mixed
BORDER_ARR
= [\PhpOffice\PhpSpreadsheet\Style\Border::BORDER_NONE => self::BORDER_NONE, \PhpOffice\PhpSpreadsheet\Style\Border::BORDER_DASHDOT => '1px dashed', \PhpOffice\PhpSpreadsheet\Style\Border::BORDER_DASHDOTDOT => '1px dotted', \PhpOffice\PhpSpreadsheet\Style\Border::BORDER_DASHED => '1px dashed', \PhpOffice\PhpSpreadsheet\Style\Border::BORDER_DOTTED => '1px dotted', \PhpOffice\PhpSpreadsheet\Style\Border::BORDER_DOUBLE => '3px double', \PhpOffice\PhpSpreadsheet\Style\Border::BORDER_HAIR => '1px solid', \PhpOffice\PhpSpreadsheet\Style\Border::BORDER_MEDIUM => '2px solid', \PhpOffice\PhpSpreadsheet\Style\Border::BORDER_MEDIUMDASHDOT => '2px dashed', \PhpOffice\PhpSpreadsheet\Style\Border::BORDER_MEDIUMDASHDOTDOT => '2px dotted', \PhpOffice\PhpSpreadsheet\Style\Border::BORDER_SLANTDASHDOT => '2px dashed', \PhpOffice\PhpSpreadsheet\Style\Border::BORDER_THICK => '3px solid']
BORDER_NONE
public
mixed
BORDER_NONE
= 'none'
COMMENT_HTML_TAGS_PLAINTEXT
Migration aid to tell if html tags will be treated as plaintext in comments.
public
mixed
COMMENT_HTML_TAGS_PLAINTEXT
= true
if ( defined( \PhpOffice\PhpSpreadsheet\Writer\Html::class . '::COMMENT_HTML_TAGS_PLAINTEXT' ) ) { new logic with styling in TextRun elements } else { old logic with styling via Html tags }.
Properties
$conditionalFormatting
Conditional Formatting Enables conditional formatting in writer, disabled here, must be enabled in writer via a setter.
protected
bool
$conditionalFormatting
= false
$embedImages
embed images, or link to images.
protected
bool
$embedImages
= false
$fileHandle
protected
resource
$fileHandle
$font
Font.
protected
string
$font
= 'freesans'
$includeCharts
Write charts that are defined in the workbook? Identifies whether the Writer should write definitions for any charts that exist in the PhpSpreadsheet object.
protected
bool
$includeCharts
= false
$isPdf
Is the current writer creating PDF?
protected
bool
$isPdf
= false
$ltrSheets
protected
bool
$ltrSheets
= false
$orientation
Orientation (Over-ride).
protected
string|null
$orientation
= null
$paperSize
Paper size (Over-ride).
protected
int|null
$paperSize
= null
$paperSizes
Paper Sizes xRef List.
protected
static array<int, array<string|int, float>|string>
$paperSizes
= [
\PhpOffice\PhpSpreadsheet\Worksheet\PageSetup::PAPERSIZE_LETTER => 'LETTER',
// (8.5 in. by 11 in.)
\PhpOffice\PhpSpreadsheet\Worksheet\PageSetup::PAPERSIZE_LETTER_SMALL => 'LETTER',
// (8.5 in. by 11 in.)
\PhpOffice\PhpSpreadsheet\Worksheet\PageSetup::PAPERSIZE_TABLOID => [792.0, 1224.0],
// (11 in. by 17 in.)
\PhpOffice\PhpSpreadsheet\Worksheet\PageSetup::PAPERSIZE_LEDGER => [1224.0, 792.0],
// (17 in. by 11 in.)
\PhpOffice\PhpSpreadsheet\Worksheet\PageSetup::PAPERSIZE_LEGAL => 'LEGAL',
// (8.5 in. by 14 in.)
\PhpOffice\PhpSpreadsheet\Worksheet\PageSetup::PAPERSIZE_STATEMENT => [396.0, 612.0],
// (5.5 in. by 8.5 in.)
\PhpOffice\PhpSpreadsheet\Worksheet\PageSetup::PAPERSIZE_EXECUTIVE => 'EXECUTIVE',
// (7.25 in. by 10.5 in.)
\PhpOffice\PhpSpreadsheet\Worksheet\PageSetup::PAPERSIZE_A3 => 'A3',
// (297 mm by 420 mm)
\PhpOffice\PhpSpreadsheet\Worksheet\PageSetup::PAPERSIZE_A4 => 'A4',
// (210 mm by 297 mm)
\PhpOffice\PhpSpreadsheet\Worksheet\PageSetup::PAPERSIZE_A4_SMALL => 'A4',
// (210 mm by 297 mm)
\PhpOffice\PhpSpreadsheet\Worksheet\PageSetup::PAPERSIZE_A5 => 'A5',
// (148 mm by 210 mm)
\PhpOffice\PhpSpreadsheet\Worksheet\PageSetup::PAPERSIZE_B4 => 'B4',
// (250 mm by 353 mm)
\PhpOffice\PhpSpreadsheet\Worksheet\PageSetup::PAPERSIZE_B5 => 'B5',
// (176 mm by 250 mm)
\PhpOffice\PhpSpreadsheet\Worksheet\PageSetup::PAPERSIZE_FOLIO => 'FOLIO',
// (8.5 in. by 13 in.)
\PhpOffice\PhpSpreadsheet\Worksheet\PageSetup::PAPERSIZE_QUARTO => [609.45, 779.53],
// (215 mm by 275 mm)
\PhpOffice\PhpSpreadsheet\Worksheet\PageSetup::PAPERSIZE_STANDARD_1 => [720.0, 1008.0],
// (10 in. by 14 in.)
\PhpOffice\PhpSpreadsheet\Worksheet\PageSetup::PAPERSIZE_STANDARD_2 => [792.0, 1224.0],
// (11 in. by 17 in.)
\PhpOffice\PhpSpreadsheet\Worksheet\PageSetup::PAPERSIZE_NOTE => 'LETTER',
// (8.5 in. by 11 in.)
\PhpOffice\PhpSpreadsheet\Worksheet\PageSetup::PAPERSIZE_NO9_ENVELOPE => [279.0, 639.0],
// (3.875 in. by 8.875 in.)
\PhpOffice\PhpSpreadsheet\Worksheet\PageSetup::PAPERSIZE_NO10_ENVELOPE => [297.0, 684.0],
// (4.125 in. by 9.5 in.)
\PhpOffice\PhpSpreadsheet\Worksheet\PageSetup::PAPERSIZE_NO11_ENVELOPE => [324.0, 747.0],
// (4.5 in. by 10.375 in.)
\PhpOffice\PhpSpreadsheet\Worksheet\PageSetup::PAPERSIZE_NO12_ENVELOPE => [342.0, 792.0],
// (4.75 in. by 11 in.)
\PhpOffice\PhpSpreadsheet\Worksheet\PageSetup::PAPERSIZE_NO14_ENVELOPE => [360.0, 828.0],
// (5 in. by 11.5 in.)
\PhpOffice\PhpSpreadsheet\Worksheet\PageSetup::PAPERSIZE_C => [1224.0, 1584.0],
// (17 in. by 22 in.)
\PhpOffice\PhpSpreadsheet\Worksheet\PageSetup::PAPERSIZE_D => [1584.0, 2448.0],
// (22 in. by 34 in.)
\PhpOffice\PhpSpreadsheet\Worksheet\PageSetup::PAPERSIZE_E => [2448.0, 3168.0],
// (34 in. by 44 in.)
\PhpOffice\PhpSpreadsheet\Worksheet\PageSetup::PAPERSIZE_DL_ENVELOPE => [311.81, 623.62],
// (110 mm by 220 mm)
\PhpOffice\PhpSpreadsheet\Worksheet\PageSetup::PAPERSIZE_C5_ENVELOPE => 'C5',
// (162 mm by 229 mm)
\PhpOffice\PhpSpreadsheet\Worksheet\PageSetup::PAPERSIZE_C3_ENVELOPE => 'C3',
// (324 mm by 458 mm)
\PhpOffice\PhpSpreadsheet\Worksheet\PageSetup::PAPERSIZE_C4_ENVELOPE => 'C4',
// (229 mm by 324 mm)
\PhpOffice\PhpSpreadsheet\Worksheet\PageSetup::PAPERSIZE_C6_ENVELOPE => 'C6',
// (114 mm by 162 mm)
\PhpOffice\PhpSpreadsheet\Worksheet\PageSetup::PAPERSIZE_C65_ENVELOPE => [323.15, 649.13],
// (114 mm by 229 mm)
\PhpOffice\PhpSpreadsheet\Worksheet\PageSetup::PAPERSIZE_B4_ENVELOPE => 'B4',
// (250 mm by 353 mm)
\PhpOffice\PhpSpreadsheet\Worksheet\PageSetup::PAPERSIZE_B5_ENVELOPE => 'B5',
// (176 mm by 250 mm)
\PhpOffice\PhpSpreadsheet\Worksheet\PageSetup::PAPERSIZE_B6_ENVELOPE => [498.9, 354.33],
// (176 mm by 125 mm)
\PhpOffice\PhpSpreadsheet\Worksheet\PageSetup::PAPERSIZE_ITALY_ENVELOPE => [311.81, 651.97],
// (110 mm by 230 mm)
\PhpOffice\PhpSpreadsheet\Worksheet\PageSetup::PAPERSIZE_MONARCH_ENVELOPE => [279.0, 540.0],
// (3.875 in. by 7.5 in.)
\PhpOffice\PhpSpreadsheet\Worksheet\PageSetup::PAPERSIZE_6_3_4_ENVELOPE => [261.0, 468.0],
// (3.625 in. by 6.5 in.)
\PhpOffice\PhpSpreadsheet\Worksheet\PageSetup::PAPERSIZE_US_STANDARD_FANFOLD => [1071.0, 792.0],
// (14.875 in. by 11 in.)
\PhpOffice\PhpSpreadsheet\Worksheet\PageSetup::PAPERSIZE_GERMAN_STANDARD_FANFOLD => [612.0, 864.0],
// (8.5 in. by 12 in.)
\PhpOffice\PhpSpreadsheet\Worksheet\PageSetup::PAPERSIZE_GERMAN_LEGAL_FANFOLD => 'FOLIO',
// (8.5 in. by 13 in.)
\PhpOffice\PhpSpreadsheet\Worksheet\PageSetup::PAPERSIZE_ISO_B4 => 'B4',
// (250 mm by 353 mm)
\PhpOffice\PhpSpreadsheet\Worksheet\PageSetup::PAPERSIZE_JAPANESE_DOUBLE_POSTCARD => [566.9299999999999, 419.53],
// (200 mm by 148 mm)
\PhpOffice\PhpSpreadsheet\Worksheet\PageSetup::PAPERSIZE_STANDARD_PAPER_1 => [648.0, 792.0],
// (9 in. by 11 in.)
\PhpOffice\PhpSpreadsheet\Worksheet\PageSetup::PAPERSIZE_STANDARD_PAPER_2 => [720.0, 792.0],
// (10 in. by 11 in.)
\PhpOffice\PhpSpreadsheet\Worksheet\PageSetup::PAPERSIZE_STANDARD_PAPER_3 => [1080.0, 792.0],
// (15 in. by 11 in.)
\PhpOffice\PhpSpreadsheet\Worksheet\PageSetup::PAPERSIZE_INVITE_ENVELOPE => [623.62, 623.62],
// (220 mm by 220 mm)
\PhpOffice\PhpSpreadsheet\Worksheet\PageSetup::PAPERSIZE_LETTER_EXTRA_PAPER => [667.8, 864.0],
// (9.275 in. by 12 in.)
\PhpOffice\PhpSpreadsheet\Worksheet\PageSetup::PAPERSIZE_LEGAL_EXTRA_PAPER => [667.8, 1080.0],
// (9.275 in. by 15 in.)
\PhpOffice\PhpSpreadsheet\Worksheet\PageSetup::PAPERSIZE_TABLOID_EXTRA_PAPER => [841.6799999999999, 1296.0],
// (11.69 in. by 18 in.)
\PhpOffice\PhpSpreadsheet\Worksheet\PageSetup::PAPERSIZE_A4_EXTRA_PAPER => [668.98, 912.76],
// (236 mm by 322 mm)
\PhpOffice\PhpSpreadsheet\Worksheet\PageSetup::PAPERSIZE_LETTER_TRANSVERSE_PAPER => [595.8, 792.0],
// (8.275 in. by 11 in.)
\PhpOffice\PhpSpreadsheet\Worksheet\PageSetup::PAPERSIZE_A4_TRANSVERSE_PAPER => 'A4',
// (210 mm by 297 mm)
\PhpOffice\PhpSpreadsheet\Worksheet\PageSetup::PAPERSIZE_LETTER_EXTRA_TRANSVERSE_PAPER => [667.8, 864.0],
// (9.275 in. by 12 in.)
\PhpOffice\PhpSpreadsheet\Worksheet\PageSetup::PAPERSIZE_SUPERA_SUPERA_A4_PAPER => [643.46, 1009.13],
// (227 mm by 356 mm)
\PhpOffice\PhpSpreadsheet\Worksheet\PageSetup::PAPERSIZE_SUPERB_SUPERB_A3_PAPER => [864.5700000000001, 1380.47],
// (305 mm by 487 mm)
\PhpOffice\PhpSpreadsheet\Worksheet\PageSetup::PAPERSIZE_LETTER_PLUS_PAPER => [612.0, 913.6799999999999],
// (8.5 in. by 12.69 in.)
\PhpOffice\PhpSpreadsheet\Worksheet\PageSetup::PAPERSIZE_A4_PLUS_PAPER => [595.28, 935.4299999999999],
// (210 mm by 330 mm)
\PhpOffice\PhpSpreadsheet\Worksheet\PageSetup::PAPERSIZE_A5_TRANSVERSE_PAPER => 'A5',
// (148 mm by 210 mm)
\PhpOffice\PhpSpreadsheet\Worksheet\PageSetup::PAPERSIZE_JIS_B5_TRANSVERSE_PAPER => [515.91, 728.5],
// (182 mm by 257 mm)
\PhpOffice\PhpSpreadsheet\Worksheet\PageSetup::PAPERSIZE_A3_EXTRA_PAPER => [912.76, 1261.42],
// (322 mm by 445 mm)
\PhpOffice\PhpSpreadsheet\Worksheet\PageSetup::PAPERSIZE_A5_EXTRA_PAPER => [493.23, 666.14],
// (174 mm by 235 mm)
\PhpOffice\PhpSpreadsheet\Worksheet\PageSetup::PAPERSIZE_ISO_B5_EXTRA_PAPER => [569.76, 782.36],
// (201 mm by 276 mm)
\PhpOffice\PhpSpreadsheet\Worksheet\PageSetup::PAPERSIZE_A2_PAPER => 'A2',
// (420 mm by 594 mm)
\PhpOffice\PhpSpreadsheet\Worksheet\PageSetup::PAPERSIZE_A3_TRANSVERSE_PAPER => 'A3',
// (297 mm by 420 mm)
\PhpOffice\PhpSpreadsheet\Worksheet\PageSetup::PAPERSIZE_A3_EXTRA_TRANSVERSE_PAPER => [912.76, 1261.42],
]
$preCalculateFormulas
Pre-calculate formulas Forces PhpSpreadsheet to 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.
protected
bool
$preCalculateFormulas
= true
$rtlSheets
protected
bool
$rtlSheets
= false
$spreadsheet
Spreadsheet object.
protected
Spreadsheet
$spreadsheet
$tableFormats
Table formats Enables table formats in writer, disabled here, must be enabled in writer via a setter.
protected
bool
$tableFormats
= false
$tempDir
Temporary storage directory.
protected
string
$tempDir
Methods
__construct()
Create a new PDF Writer instance.
public
__construct(Spreadsheet $spreadsheet) : mixed
Parameters
- $spreadsheet : Spreadsheet
-
Spreadsheet object
buildCSS()
Build CSS styles.
public
buildCSS([bool $generateSurroundingHTML = true ]) : array<string|int, array<string|int, string>>
Parameters
- $generateSurroundingHTML : bool = true
-
Generate surrounding HTML style? (html { })
Return values
array<string|int, array<string|int, string>>formatColor()
Add color to formatted string as inline style.
public
formatColor(string $value, string $format) : string
Parameters
- $value : string
-
Plain formatted value without color
- $format : string
-
Format code
Return values
stringformatColorStatic()
Add color to formatted string as inline style.
public
static formatColorStatic(string $value, string $format) : string
Parameters
- $value : string
-
Plain formatted value without color
- $format : string
-
Format code
Return values
stringgenerateHtmlAll()
Save Spreadsheet as html to variable.
public
generateHtmlAll() : string
Return values
stringgenerateHTMLFooter()
Generate HTML footer.
public
generateHTMLFooter() : string
Return values
stringgenerateHTMLHeader()
Generate HTML header.
public
generateHTMLHeader([bool $includeStyles = false ]) : string
Parameters
- $includeStyles : bool = false
-
Include styles?
Return values
stringgenerateNavigation()
Generate sheet tabs.
public
generateNavigation() : string
Return values
stringgenerateSheetData()
Generate sheet data.
public
generateSheetData() : string
Return values
stringgenerateStyles()
Generate CSS styles.
public
generateStyles([bool $generateSurroundingHTML = true ]) : string
Parameters
- $generateSurroundingHTML : bool = true
-
Generate surrounding HTML tags? (<style> and </style>)
Return values
stringgetBetterBoolean()
public
getBetterBoolean() : bool
Return values
boolgetConditionalFormatting()
public
getConditionalFormatting() : bool
Return values
boolgetDiskCachingDirectory()
Get disk caching directory.
public
getDiskCachingDirectory() : string
Return values
stringgetEmbedImages()
Get embed images.
public
getEmbedImages() : bool
Return values
boolgetFont()
Get Font.
public
getFont() : string
Return values
stringgetGenerateSheetNavigationBlock()
Get sheet index.
public
getGenerateSheetNavigationBlock() : bool
Return values
boolgetImagesRoot()
Get images root.
public
getImagesRoot() : string
Return values
stringgetIncludeCharts()
Write charts in workbook? If this is true, then the Writer will write definitions for any charts that exist in the PhpSpreadsheet object.
public
getIncludeCharts() : bool
If false (the default) it will ignore any charts defined in the PhpSpreadsheet object.
Return values
boolgetOrientation()
Get Orientation.
public
getOrientation() : string|null
Return values
string|nullgetPaperSize()
Get Paper Size.
public
getPaperSize() : int|null
Return values
int|nullgetPreCalculateFormulas()
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 PhpSpreadsheet, but slower when opening the resulting file in MS Excel, because Excel has to recalculate the formulae itself.
public
getPreCalculateFormulas() : bool
Return values
boolgetSheetIndex()
Get sheet index.
public
getSheetIndex() : int|null
Return values
int|nullgetTableFormats()
public
getTableFormats() : bool
Return values
boolgetTempDir()
Get temporary storage directory.
public
getTempDir() : string
Return values
stringgetUseDiskCaching()
Get use disk caching where possible?
public
getUseDiskCaching() : bool
Return values
boolgetUseInlineCss()
Get use inline CSS?
public
getUseInlineCss() : bool
Return values
boolopenFileHandle()
Open file handle.
public
openFileHandle(resource|string $filename) : void
Parameters
- $filename : resource|string
save()
Save Spreadsheet to file.
public
save(resource|string $filename[, int $flags = 0 ]) : void
Parameters
- $filename : resource|string
- $flags : int = 0
-
Flags that can change the behaviour of the Writer: self::SAVE_WITH_CHARTS Save any charts that are defined (if the Writer supports Charts) self::DISABLE_PRECALCULATE_FORMULAE Don't Precalculate formulae before saving the file
setBetterBoolean()
public
setBetterBoolean(bool $betterBoolean) : self
Parameters
- $betterBoolean : bool
Return values
selfsetConditionalFormatting()
public
setConditionalFormatting(bool $conditionalFormatting) : self
Parameters
- $conditionalFormatting : bool
Return values
selfsetEditHtmlCallback()
Set a callback to edit the entire HTML.
public
setEditHtmlCallback(callable|null $callback) : void
The callback must accept the HTML as string as first parameter, and it must return the edited HTML as string.
Parameters
- $callback : callable|null
setEmbedImages()
Set embed images.
public
setEmbedImages(bool $embedImages) : $this
Parameters
- $embedImages : bool
Return values
$thissetFont()
Set font. Examples: 'arialunicid0-chinese-simplified' 'arialunicid0-chinese-traditional' 'arialunicid0-korean' 'arialunicid0-japanese'.
public
setFont(string $fontName) : $this
Parameters
- $fontName : string
Return values
$thissetGenerateSheetNavigationBlock()
Set sheet index.
public
setGenerateSheetNavigationBlock(bool $generateSheetNavigationBlock) : $this
Parameters
- $generateSheetNavigationBlock : bool
-
Flag indicating whether the sheet navigation block should be generated or not
Return values
$thissetImagesRoot()
Set images root.
public
setImagesRoot(string $imagesRoot) : $this
Parameters
- $imagesRoot : string
Return values
$thissetIncludeCharts()
Set write charts in workbook Set to true, to advise the Writer to include any charts that exist in the PhpSpreadsheet object.
public
setIncludeCharts(bool $includeCharts) : $this
Set to false (the default) to ignore charts.
Parameters
- $includeCharts : bool
Return values
$thissetOrientation()
Set Orientation.
public
setOrientation(string $orientation) : self
Parameters
- $orientation : string
-
Page orientation see PageSetup::ORIENTATION_*
Return values
selfsetPaperSize()
Set Paper Size.
public
setPaperSize(int $paperSize) : self
Parameters
- $paperSize : int
-
Paper size see PageSetup::PAPERSIZE_*
Return values
selfsetPreCalculateFormulas()
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.
public
setPreCalculateFormulas(bool $precalculateFormulas) : $this
Parameters
- $precalculateFormulas : bool
-
Pre-Calculate Formulas?
Return values
$thissetSheetIndex()
Set sheet index.
public
setSheetIndex(int $sheetIndex) : $this
Parameters
- $sheetIndex : int
-
Sheet index
Return values
$thissetTableFormats()
public
setTableFormats(bool $tableFormats) : self
Parameters
- $tableFormats : bool
Return values
selfsetTempDir()
Set temporary storage directory.
public
setTempDir(string $temporaryDirectory) : self
Parameters
- $temporaryDirectory : string
-
Temporary storage directory
Return values
selfsetUseDiskCaching()
Set use disk caching where possible?
public
setUseDiskCaching(bool $useDiskCache[, string|null $cacheDirectory = null ]) : $this
Parameters
- $useDiskCache : bool
- $cacheDirectory : string|null = null
-
Disk caching directory
Return values
$thissetUseInlineCss()
Set use inline CSS?
public
setUseInlineCss(bool $useInlineCss) : $this
Parameters
- $useInlineCss : bool
Return values
$thiswinFileToUrl()
Convert Windows file name to file protocol URL.
public
static winFileToUrl(string $filename[, bool $mpdf = false ]) : string
Parameters
- $filename : string
-
file name on local system
- $mpdf : bool = false
Return values
stringwriteAllSheets()
Write all sheets (resets sheetIndex to NULL).
public
writeAllSheets() : $this
Return values
$thischeckRtlAndLtr()
protected
checkRtlAndLtr() : void
maybeCloseFileHandle()
Close file handle only if we opened it ourselves.
protected
maybeCloseFileHandle() : void
prepareForSave()
Save Spreadsheet to PDF file, pre-save.
protected
prepareForSave(resource|string $filename) : resource
Parameters
- $filename : resource|string
-
Name of the file to save as
Return values
resourceprocessFlags()
protected
processFlags(int $flags) : void
Parameters
- $flags : int
restoreStateAfterSave()
Save PhpSpreadsheet to PDF file, post-save.
protected
restoreStateAfterSave() : void