Class humhub\components\export\ExportResult

Inheritancehumhub\components\export\ExportResult » yii\base\BaseObject

ExportResult represents SpreadsheetExport result.

This class was originally developed by Paul Klimov klimov.paul@gmail.com and his project csv-grid (https://github.com/yii2tech/csv-grid).

See also humhub\components\export\SpreadsheetExport.

Public Properties

Hide inherited properties

PropertyTypeDescriptionDefined By
$basePath string Base path for the temporary directory and files. humhub\components\export\ExportResult
$fileBaseName string Base name, which should be used for the created files. humhub\components\export\ExportResult
$writerType string humhub\components\export\ExportResult

Property Details

$basePath public property

Base path for the temporary directory and files.

public string $basePath '@runtime/data_export'
$fileBaseName public property

Base name, which should be used for the created files.

public string $fileBaseName 'export'
$writerType public property
public string $writerType 'csv'

Method Details

__destruct() public method

Destructor.

Makes sure the temporary directory removed.

public void __destruct ( )
delete() public method

Deletes associated directory with all internal files.

public boolean delete ( )
return boolean

Whether file has been deleted.

getResultFileName() public method

public string getResultFileName ( )
return string

Result file name

getTempFileName() public method

public string getTempFileName ( )
return string

Files directory name

throws \yii\base\Exception
newSpreadsheet() public method

Creates new CSV file in result set.

public \PhpOffice\PhpSpreadsheet\Spreadsheet newSpreadsheet ( )
return \PhpOffice\PhpSpreadsheet\Spreadsheet

Instance.

saveAs() public method

Saves this file.

public void saveAs ( $file )
$file string

Destination file name (may content path alias).

throws \PhpOffice\PhpSpreadsheet\Writer\Exception
send() public method

Prepares response for sending a result file to the browser.

Note: this method works only while running web application.

public \yii\web\Response send ( $options = [] )
$options array

Additional options for sending the file. See \yii\web\Response::sendFile() for details.

return \yii\web\Response

Application response instance.

throws \PhpOffice\PhpSpreadsheet\Exception
throws \PhpOffice\PhpSpreadsheet\Writer\Exception
throws \yii\base\Exception