Skip to content

Commit

Permalink
Fied issue #6685: Export of results to excel format does not work- cr…
Browse files Browse the repository at this point in the history
…eates empty files
  • Loading branch information
c-schmitz committed Oct 26, 2012
1 parent 35f9a70 commit ae819d3
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions application/helpers/admin/exportresults_helper.php
Expand Up @@ -1531,7 +1531,6 @@ public function __construct($filename = null)
public function init(SurveyObj $survey, $sLanguageCode, FormattingOptions $oOptions)
{
parent::init($survey, $sLanguageCode, $oOptions);
$sRandomFileName=Yii::app()->getConfig("tempdir"). DIRECTORY_SEPARATOR . randomChars(40);

if ($oOptions->output=='file')
{
Expand All @@ -1542,15 +1541,13 @@ public function init(SurveyObj $survey, $sLanguageCode, FormattingOptions $oOpti
{
$this->workbook = new xlswriter;
}
$this->workbook->setTempDir(Yii::app()->getConfig("tempdir"));

$this->workbook->send('results-survey'.$survey->id.'.xls');
$worksheetName = $survey->languageSettings[0]['surveyls_title'];
$worksheetName=substr(str_replace(array('*', ':', '/', '\\', '?', '[', ']'),array(' '),$worksheetName),0,31); // Remove invalid characters

$this->workbook->setVersion(8);
if (!empty($tempdir)) {
$this->$workbook->setTempDir($tempdir);
}
$sheet =$this->workbook->addWorksheet($worksheetName); // do not translate/change this - the library does not support any special chars in sheet name
$sheet->setInputEncoding('utf-8');
$this->currentSheet = $sheet;
Expand Down

0 comments on commit ae819d3

Please sign in to comment.