\PhpOffice\PhpSpreadsheet\HelperSample

Helper class to be used in sample code.

Summary

Methods
Properties
Constants
isCli()
getScriptFilename()
isIndex()
getPageTitle()
getPageHeading()
getSamples()
write()
getFilename()
getTemporaryFilename()
log()
logEndingNotes()
logWrite()
logRead()
No public properties found
No constants found
No protected methods found
No protected properties found
N/A
getTemporaryFolder()
No private properties found
N/A

Methods

isCli()

isCli() : boolean

Returns whether we run on CLI or browser.

Returns

boolean

getScriptFilename()

getScriptFilename() : string

Return the filename currently being executed.

Returns

string

isIndex()

isIndex() : boolean

Whether we are executing the index page.

Returns

boolean

getPageTitle()

getPageTitle() : string

Return the page title.

Returns

string

getPageHeading()

getPageHeading() : string

Return the page heading.

Returns

string

getSamples()

getSamples() : array<mixed,string>

Returns an array of all known samples.

Returns

array<mixed,string> —

[$name => $path]

write()

write(\PhpOffice\PhpSpreadsheet\Spreadsheet  $spreadsheet, string  $filename, array<mixed,string>  $writers = array('Xlsx', 'Xls')) 

Write documents.

Parameters

\PhpOffice\PhpSpreadsheet\Spreadsheet $spreadsheet
string $filename
array<mixed,string> $writers

getFilename()

getFilename(string  $filename, string  $extension = 'xlsx') : string

Returns the filename that should be used for sample output.

Parameters

string $filename
string $extension

Returns

string

getTemporaryFilename()

getTemporaryFilename(string  $extension = 'xlsx') : string

Return a random temporary file name.

Parameters

string $extension

Returns

string

log()

log(  $message) 

Parameters

$message

logEndingNotes()

logEndingNotes() 

Log ending notes.

logWrite()

logWrite(\PhpOffice\PhpSpreadsheet\Writer\IWriter  $writer, string  $path, float  $callStartTime) 

Log a line about the write operation.

Parameters

\PhpOffice\PhpSpreadsheet\Writer\IWriter $writer
string $path
float $callStartTime

logRead()

logRead(string  $format, string  $path, float  $callStartTime) 

Log a line about the read operation.

Parameters

string $format
string $path
float $callStartTime

getTemporaryFolder()

getTemporaryFolder() : string

Returns the temporary directory and make sure it exists.

Returns

string