本文整理汇总了PHP中PHPExcel_Writer_Excel5::setTempDir方法的典型用法代码示例。如果您正苦于以下问题:PHP PHPExcel_Writer_Excel5::setTempDir方法的具体用法?PHP PHPExcel_Writer_Excel5::setTempDir怎么用?PHP PHPExcel_Writer_Excel5::setTempDir使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PHPExcel_Writer_Excel5
的用法示例。
在下文中一共展示了PHPExcel_Writer_Excel5::setTempDir方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: header
/**
* _output
*
* @param mixed $fileName
*
* @access protected
* @return void
*/
function _output($fileName)
{
//$starting_pos = ord('C'); //unused
header("Content-type: application/vnd.ms-excel");
header('Content-Disposition: attachment;filename=' . $fileName . ".xls");
header('Cache-Control: max-age=0');
$objWriter = new PHPExcel_Writer_Excel5($this->xls);
$objWriter->setTempDir(TMP);
$objWriter->save('php://output');
}
示例2: tempnam
/**
* Outputs export footer
*
* @return bool Whether it suceeded
*
* @access public
*/
function PMA_exportFooter()
{
global $workbook;
global $tmp_filename;
$tmp_filename = tempnam(realpath($GLOBALS['cfg']['TempDir']), 'pma_xls_');
$workbookWriter = new PHPExcel_Writer_Excel5($workbook);
$workbookWriter->setTempDir(realpath($GLOBALS['cfg']['TempDir']));
$workbookWriter->save($tmp_filename);
if (!PMA_exportOutputHandler(file_get_contents($tmp_filename))) {
return FALSE;
}
unlink($tmp_filename);
unset($GLOBALS['workbook']);
unset($GLOBALS['sheet_index']);
return TRUE;
}
示例3: generateBook
function generateBook($book, $format) {
$this->book= $book;
if (!$book->bookId)
$bookName= "spreadsheet-1";
else
$bookName= "spreadsheet-$book->bookId";
$filename= "default-".rand(1,9999);
/*SET SPREADSHEET PROPERTIES*/
if ($format!= "ods"){
$this->objPHPExcel = new PHPExcel();
$this->objPHPExcel->getProperties()->setCreator("Maarten Balliauw");
$this->objPHPExcel->getProperties()->setLastModifiedBy("Maarten Balliauw");
$this->objPHPExcel->getProperties()->setTitle("Test Document");
$this->objPHPExcel->getProperties()->setSubject("Test Document");
$this->objPHPExcel->getProperties()->setDescription("Test document generated using PHP classes.");
$this->objPHPExcel->getProperties()->setKeywords("office php");
$this->objPHPExcel->getProperties()->setCategory("Test result file");
}
else{
$this->objPHPOds= new PHPOds(); //create a new ods file
}
/*GENERATE THE SHEETS*/
$this->_generateSheets($format);
global $cnf;
$currentDir= $cnf['path']['Temp']."/"; // Get the Storage Folder
switch($format){
case "ods":
saveOds($this->objPHPOds,"$filename.$format"); //save the object to a ods file
break;
case "pdf":
$objWriter1 = new PHPExcel_Writer_PDF($this->objPHPExcel);
$objWriter1->writeAllSheets();
$objWriter1->setTempDir($currentDir);
$objWriter1->save("$filename.$format"); //save the object to a pdf file
break;
case "xls":
$objWriter2 = new PHPExcel_Writer_Excel5($this->objPHPExcel);
$objWriter2->setTempDir($currentDir);
$objWriter2->save("$filename.$format"); //save the object to a xls file
break;
case "xlsx":
$objWriter3 = PHPExcel_IOFactory::createWriter($this->objPHPExcel, 'Excel2007');
$objWriter3->save($currentDir."$filename.$format"); //save the object to a xlsx file
break;
case "csv":
$objWriter4 = new PHPExcel_Writer_CSV($this->objPHPExcel);
//$objWriter4->setTempDir($currentDir);
$objWriter4->setDelimiter(';');
$objWriter4->setEnclosure('');
$objWriter4->setLineEnding("\r\n");
$objWriter4->save("$filename.$format"); //save the object to a CSV file
break;
case "html":
$objWriter5 = new PHPExcel_Writer_HTML($this->objPHPExcel);
$objWriter5->writeAllSheets();
//$objWriter5->setTempDir($currentDir);
$objWriter5->save("$filename.$format"); //save the object to a HTML file
break;
}
if ($format != "ods")
$this->_send("$filename.$format", $format, $bookName);
}
示例4: execute
public function execute(Request $request, Response $response)
{
$courseID = $request->getParameter("courseID");
$customerID = $request->getParameter("customerID");
$objPHPExcel = new PHPExcel();
$objPHPExcel->setActiveSheetIndex(0);
$objPHPExcel->getActiveSheet()->setTitle('Benutzer');
$filename = "";
$titel = "";
//get users
$currentRow = 4;
if ($courseID === "all") {
$filename = "Nutzerliste_" . $_SESSION["CURRENT_CUSTOMER_NAME"] . "_" . date("d-m-Y", time()) . ".xls";
$titel = "E-Learning Benutzliste des Unternehmen " . $_SESSION["CURRENT_CUSTOMER_NAME"];
foreach ($GLOBALS["USERMANAGEMENT_DATA_ACCESS"]->getAllEmployees($customerID) as $employeeID => $employeeName) {
$password = "****";
if ($GLOBALS["USERMANAGEMENT_DATA_ACCESS"]->isGeneratedPassword($employeeID)) {
$password = $GLOBALS["USERMANAGEMENT_DATA_ACCESS"]->getGeneratedPassword($employeeID);
}
$email = $GLOBALS["USERMANAGEMENT_DATA_ACCESS"]->getUserEmail($employeeID);
$date = date("d.m.Y", $GLOBALS["USERMANAGEMENT_DATA_ACCESS"]->getObjCreationDate($employeeID));
if ($email === false) {
$email = "";
}
$objPHPExcel->getActiveSheet()->SetCellValue("A" . $currentRow, $GLOBALS["USERMANAGEMENT_DATA_ACCESS"]->getUserFirstName($employeeID));
$objPHPExcel->getActiveSheet()->SetCellValue("B" . $currentRow, $GLOBALS["USERMANAGEMENT_DATA_ACCESS"]->getUserLastName($employeeID));
$objPHPExcel->getActiveSheet()->SetCellValue("C" . $currentRow, $email);
$objPHPExcel->getActiveSheet()->SetCellValue("D" . $currentRow, $employeeName);
$objPHPExcel->getActiveSheet()->SetCellValue("E" . $currentRow, $password);
$objPHPExcel->getActiveSheet()->SetCellValue("F" . $currentRow, $date);
$currentRow++;
}
} else {
$filename = "Nutzerliste_" . $_SESSION["CURRENT_CUSTOMER_NAME"] . "_" . $GLOBALS["USERMANAGEMENT_DATA_ACCESS"]->getObjectName($courseID) . "_" . date("d-m-Y", time()) . ".xls";
$titel = "E-Learning Benutzliste des Unternehmen " . $_SESSION["CURRENT_CUSTOMER_NAME"] . " - " . $GLOBALS["USERMANAGEMENT_DATA_ACCESS"]->getObjectDesc($courseID) . " (" . $GLOBALS["USERMANAGEMENT_DATA_ACCESS"]->getObjectName($courseID) . ")";
foreach ($GLOBALS["USERMANAGEMENT_DATA_ACCESS"]->getCourseParticipants($courseID) as $employeeID => $employeeName) {
$password = "****";
if ($GLOBALS["USERMANAGEMENT_DATA_ACCESS"]->isGeneratedPassword($employeeID)) {
$password = $GLOBALS["USERMANAGEMENT_DATA_ACCESS"]->getGeneratedPassword($employeeID);
}
$email = $GLOBALS["USERMANAGEMENT_DATA_ACCESS"]->getUserEmail($employeeID);
if ($email === false) {
$email = "";
}
$objPHPExcel->getActiveSheet()->SetCellValue("A" . $currentRow, $GLOBALS["USERMANAGEMENT_DATA_ACCESS"]->getUserFirstName($employeeID));
$objPHPExcel->getActiveSheet()->SetCellValue("B" . $currentRow, $GLOBALS["USERMANAGEMENT_DATA_ACCESS"]->getUserLastName($employeeID));
$objPHPExcel->getActiveSheet()->SetCellValue("C" . $currentRow, $email);
$objPHPExcel->getActiveSheet()->SetCellValue("D" . $currentRow, $employeeName);
$objPHPExcel->getActiveSheet()->SetCellValue("E" . $currentRow, $password);
$currentRow++;
}
}
// Excel header
$objPHPExcel->getActiveSheet()->SetCellValue("A1", $titel);
$objPHPExcel->getActiveSheet()->SetCellValue("A2", "Stand " . date("d.m.Y", time()));
$objPHPExcel->getActiveSheet()->SetCellValue("A3", "Vorname");
$objPHPExcel->getActiveSheet()->SetCellValue("B3", "Nachname");
$objPHPExcel->getActiveSheet()->SetCellValue("C3", "Email");
$objPHPExcel->getActiveSheet()->SetCellValue("D3", "Benutzerkennung");
$objPHPExcel->getActiveSheet()->SetCellValue("E3", "Passwort");
$objPHPExcel->getActiveSheet()->SetCellValue("F3", "Erstellungsdatum");
$objWriter = new PHPExcel_Writer_Excel5($objPHPExcel);
$objWriter->setTempDir(PATH_TEMP);
$objWriter->save(PATH_TEMP . $filename);
$myFile = PATH_TEMP . $filename;
$fh = fopen($myFile, 'r');
$theData = fread($fh, filesize($myFile));
fclose($fh);
header('Content-type: text/plain');
header('Content-Disposition: attachment; filename="' . $filename . '"');
echo $theData;
exit;
}
示例5: exportAction
public function exportAction()
{
SxCms_Acl::requireAcl('subscriptions', 'subscription.export');
$event_id = $this->_getParam('id');
$eventMapper = new SxCms_Event_DataMapper();
$event = $eventMapper->getEventById($event_id);
$subProxy = new SxCms_Event_Subscription_DataMapper();
$subscriptions = $subProxy->getValidSubscriptionsForEvent($event_id);
$fieldProxy = new SxCms_Event_Field_DataMapper();
$fields = $fieldProxy->getFieldsByEvent($event_id);
$objPHPExcel = new PHPExcel();
$objPHPExcel->createSheet("Event Subsciptions");
$objPHPExcel->setActiveSheetIndex(0);
$objPHPSheet = $objPHPExcel->getActiveSheet();
$objPHPSheet->setCellValueByColumnAndRow(0, 1, $this->admin_tmx->_('subscriptionsforevent') . $event->getTitle());
$i = 0;
foreach ($fields as $field) {
$objPHPSheet->setCellValueByColumnAndRow($i, 2, $field->getLabel());
$i++;
}
$j = 3;
foreach ($subscriptions as $subscription) {
$i = 0;
foreach ($fields as $field) {
$objPHPSheet->setCellValueByColumnAndRow($i, $j, $subscription[$field->getName()]);
$i++;
}
$j++;
}
$file = "sub_" . date("d_m_Y") . ".xls";
header("Pragma: public");
header("Expires: 0");
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
header("Content-Type: application/force-download");
header("Content-Type: application/octet-stream");
header("Content-Type: application/download");
header("Content-Disposition: attachment; filename={$file}");
header("Content-Transfer-Encoding: binary");
error_reporting(0);
$objWriter = new PHPExcel_Writer_Excel5($objPHPExcel);
$objWriter->setTempDir(APPLICATION_ROOT . '/tmp');
$objWriter->save("php://output");
die;
}
示例6: header
/**
* _output
*
* @param mixed $title
*
* @access protected
* @return void
*/
function _output($title)
{
header("Content-type: application/vnd.ms-excel");
header('Content-Disposition: attachment;filename="'.$title.'.xls"');
header('Cache-Control: max-age=0');
$objWriter = new PHPExcel_Writer_Excel5($this->xls);
$objWriter->setTempDir(TMP);
$objWriter->save('php://output');
}