当前位置: 首页>>代码示例>>PHP>>正文


PHP PHPExcel_Settings类代码示例

本文整理汇总了PHP中PHPExcel_Settings的典型用法代码示例。如果您正苦于以下问题:PHP PHPExcel_Settings类的具体用法?PHP PHPExcel_Settings怎么用?PHP PHPExcel_Settings使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了PHPExcel_Settings类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: exportXlsx

 public static function exportXlsx($data, $keys)
 {
     // Create new PHPExcel object
     $objPHPExcel = new \PHPExcel();
     // Set document properties
     $objPHPExcel->getProperties()->setCreator("Roadiz CMS")->setLastModifiedBy("Roadiz CMS")->setCategory("");
     $cacheMethod = \PHPExcel_CachedObjectStorageFactory::cache_to_phpTemp;
     $cacheSettings = ['memoryCacheSize' => '8MB'];
     \PHPExcel_Settings::setCacheStorageMethod($cacheMethod, $cacheSettings);
     $objPHPExcel->setActiveSheetIndex(0);
     foreach ($keys as $key => $value) {
         $objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow($key, 1, $value);
     }
     foreach ($data as $key => $answer) {
         foreach ($answer as $k => $value) {
             $columnAlpha = \PHPExcel_Cell::stringFromColumnIndex($k);
             if ($value instanceof \DateTime) {
                 $value = \PHPExcel_Shared_Date::PHPToExcel($value);
                 $objPHPExcel->getActiveSheet()->getStyle($columnAlpha . (2 + $key))->getNumberFormat()->setFormatCode('dd.mm.yyyy hh:MM:ss');
             }
             $objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow($k, 2 + $key, $value);
         }
     }
     // Set active sheet index to the first sheet, so Excel opens this as the first sheet
     $objWriter = \PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel2007');
     ob_start();
     $objWriter->save('php://output');
     $return = ob_get_clean();
     return $return;
 }
开发者ID:QuangDang212,项目名称:roadiz,代码行数:30,代码来源:XlsxExporter.php

示例2: __construct

 /**
  * @param string $dirName Target directory for xls files
  */
 public function __construct($dirName)
 {
     $cacheMethod = PHPExcel_CachedObjectStorageFactory::cache_to_phpTemp;
     $cacheSettings = array('memoryCacheSize' => '512MB');
     PHPExcel_Settings::setCacheStorageMethod($cacheMethod, $cacheSettings);
     $this->filename = realpath($dirName . '/') . date("dmY-His") . "_" . uniqid() . ".xlsx";
     $this->objPHPExcel = new PHPExcel();
 }
开发者ID:glendemon,项目名称:phpexcel-wrapper,代码行数:11,代码来源:PhpExcelWrapper.php

示例3: configExcel

 private function configExcel($pParamHash)
 {
     // config PHPExcel
     // cache method
     switch ($this->getConfig('cache_method')) {
         case 'cache_to_discISAM':
             $cacheMethod = PHPExcel_CachedObjectStorageFactory::cache_to_discISAM;
             break;
         case 'cache_in_memory_serialized':
             $cacheMethod = PHPExcel_CachedObjectStorageFactory::cache_in_memory_serialized;
             break;
         case 'cache_in_memory':
         default:
             $cacheMethod = PHPExcel_CachedObjectStorageFactory::cache_in_memory;
             break;
     }
     PHPExcel_Settings::setCacheStorageMethod($cacheMethod);
     // create excel object
     if (!isset($this->mPHPExcel)) {
         $this->mPHPExcel = new PHPExcel();
     }
     // set doc properties
     $this->mPHPExcel->getProperties()->setTitle($pParamHash['workbook']['title']);
     // $this->mPHPExcel->getProperties()->setCreator("Maarten Balliauw");
     // $this->mPHPExcel->getProperties()->setLastModifiedBy("Maarten Balliauw");
     // $this->mPHPExcel->getProperties()->setSubject("Office 2007 XLSX Test Document");
     // $this->mPHPExcel->getProperties()->setDescription("Test document for Office 2007 XLSX, generated using PHP classes.");
 }
开发者ID:shen0834,项目名称:util,代码行数:28,代码来源:BitExcel.php

示例4: __construct

 public function __construct()
 {
     $cacheMethod = PHPExcel_CachedObjectStorageFactory::cache_to_phpTemp;
     $cacheSettings = array(' memoryCacheSize ' => '8MB');
     PHPExcel_Settings::setCacheStorageMethod($cacheMethod, $cacheSettings);
     $this->phpExcel = new PHPExcel();
 }
开发者ID:jesse108,项目名称:admin_base,代码行数:7,代码来源:Excel.class.php

示例5: setZipClass

	/**
	 * Set the Zip Class to use (PCLZip or ZipArchive)
	 *
	 * @param string $zipClass
	 *        	PHPExcel_Settings::ZipArchive
	 * @return boolean or failure
	 */
	public static function setZipClass($zipClass) {
		if (($zipClass == self::PCLZIP) || ($zipClass == self::ZIPARCHIVE)) {
			self::$_zipClass = $zipClass;
			return True;
		}
		return False;
	} // function setZipClass()
开发者ID:nanpeixoto,项目名称:cide,代码行数:14,代码来源:Settings.php

示例6: read_xlsfile

function read_xlsfile($filename)
{
    /** PHPExcel_IOFactory */
    include_once 'Classes/PHPExcel/IOFactory.php';
    $inputFileName = $filename;
    try {
        PHPExcel_Settings::setZipClass(PHPExcel_Settings::PCLZIP);
        $objPHPExcel = PHPExcel_IOFactory::load($inputFileName);
    } catch (Exception $e) {
        die('Error loading file "' . pathinfo($inputFileName, PATHINFO_BASENAME) . '": ' . $e->getMessage());
    }
    $sheetData = $objPHPExcel->getActiveSheet()->toArray(null, true, true, true);
    $row = 0;
    foreach ($sheetData as $v => $i) {
        if ($row == 0) {
            $row = 1;
            continue;
        }
        if (count($i) == 3 && filter_var($i['C'], FILTER_VALIDATE_EMAIL)) {
            $query[] = "('" . implode("','", $i) . "')";
        }
    }
    if (count($query) == 1000) {
        bulk_insert($query);
        $query = '';
    }
    return $query;
}
开发者ID:sekar1992,项目名称:clgproject,代码行数:28,代码来源:Bulk_Upload_Save.php

示例7: __construct

 /**
  *
  * @do 构造函数
  *
  * @access public 
  * @author Nick
  * @copyright rockhippo
  * @param -
  * @return -
  *
  */
 public function __construct()
 {
     $cacheMethod = PHPExcel_CachedObjectStorageFactory::cache_in_memory_serialized;
     PHPExcel_Settings::setCacheStorageMethod($cacheMethod);
     //创建一个处理对象实例
     $this->objPHPExcel = new PHPExcel();
 }
开发者ID:haitao1880,项目名称:study,代码行数:18,代码来源:XPhpExcel.php

示例8: stream_open

 /**
  * @inheritdoc
  */
 public function stream_open($path, $mode, $options, &$opened_path)
 {
     \PHPExcel_Settings::setCacheStorageMethod(\PHPExcel_CachedObjectStorageFactory::cache_to_sqlite3);
     $this->objPHPExcel = new \PHPExcel();
     $this->sheet = $this->objPHPExcel->getActiveSheet();
     $this->offset = 1;
     return parent::stream_open($path, $mode, $options, $opened_path);
 }
开发者ID:netis-pl,项目名称:yii2-crud,代码行数:11,代码来源:XlsRendererStream.php

示例9: exportXLSX

 public function exportXLSX(Repository $repository, $contentTypeName, $workspace = 'default', $language = 'default', $viewName = 'exchange')
 {
     $repository->selectContentType($contentTypeName);
     // Select view and fallback if necessary
     $contentTypeDefinition = $repository->getContentTypeDefinition();
     $viewDefinition = $contentTypeDefinition->getExchangeViewDefinition($viewName);
     $viewName = $viewDefinition->getName();
     $this->writeln('Connecting repository');
     $this->writeln('');
     $repository->selectWorkspace($workspace);
     $repository->selectLanguage($language);
     $repository->selectView($viewName);
     /** @var Record[] $records */
     $records = $repository->getRecords('', '.id', 1);
     if ($records !== false) {
         // Create new PHPExcel object
         $objPHPExcel = new \PHPExcel();
         // use temp folder for processing of large files
         $cacheMethod = \PHPExcel_CachedObjectStorageFactory::cache_to_phpTemp;
         $cacheSettings = array('memoryCacheSize' => '12MB');
         \PHPExcel_Settings::setCacheStorageMethod($cacheMethod, $cacheSettings);
         // Set document properties
         $objPHPExcel->getProperties()->setCreator("AnyContent CMCK")->setLastModifiedBy("AnyContent CMCK")->setTitle("Full Export from content type " . $contentTypeDefinition->getTitle())->setSubject("AnyContent Export")->setDescription("");
         $worksheet = $objPHPExcel->setActiveSheetIndex(0);
         $worksheet->setTitle('Export');
         $worksheet->setCellValueByColumnAndRow(0, 1, '.id');
         $worksheet->getStyleByColumnAndRow(0, 1)->getFont()->setBold(false)->setItalic(true);
         $worksheet->setCellValueByColumnAndRow(1, 1, '.revision');
         $worksheet->getStyleByColumnAndRow(1, 1)->getFont()->setBold(false)->setItalic(true);
         $row = 1;
         $column = 2;
         foreach ($contentTypeDefinition->getProperties($viewName) as $property) {
             $worksheet->setCellValueByColumnAndRow($column, $row, $property);
             $worksheet->getStyleByColumnAndRow($column, $row)->getFont()->setBold(true);
             $worksheet->getColumnDimensionByColumn($column)->setWidth(20);
             $column++;
         }
         $row++;
         foreach ($records as $record) {
             $this->writeln('Processing record ' . $record->getID() . ' - ' . $record->getName());
             $worksheet->setCellValueByColumnAndRow(0, $row, $record->getID());
             $worksheet->setCellValueByColumnAndRow(1, $row, $record->getRevision());
             $column = 2;
             foreach ($contentTypeDefinition->getProperties($viewName) as $property) {
                 $worksheet->setCellValueByColumnAndRow($column, $row, $record->getProperty($property));
                 $column++;
             }
             $row++;
         }
         $objWriter = \PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel2007');
         ob_start();
         $objWriter->save('php://output');
         $excelOutput = ob_get_clean();
         return $excelOutput;
     }
     return false;
 }
开发者ID:nhagemann,项目名称:anycontent-cms-construction-kit-php,代码行数:57,代码来源:Exporter.php

示例10: __construct

 public function __construct($file_path)
 {
     require_once "../app/classes/PHPExcel.php";
     #将单元格序列化后再进行Gzip压缩,然后保存在内存中
     PHPExcel_Settings::setCacheStorageMethod(PHPExcel_CachedObjectStorageFactory::cache_in_memory_gzip);
     $file_type = PHPExcel_IOFactory::identify($file_path);
     $objReader = PHPExcel_IOFactory::createReader($file_type);
     self::$objPHPExcel = $objReader->load($file_path);
 }
开发者ID:sunxfancy,项目名称:Questionnaire,代码行数:9,代码来源:ExcelUpload.php

示例11: setData

 public function setData()
 {
     $excel_cacheMethod = \PHPExcel_CachedObjectStorageFactory::cache_to_phpTemp;
     $excel_cacheSettings = ['memoryCacheSize ' => '128MB'];
     \PHPExcel_Settings::setCacheStorageMethod($excel_cacheMethod, $excel_cacheSettings);
     $excel = \PHPExcel_IOFactory::load(\Yii::$app->getModule('data')->importDir . '/' . $this->filename);
     $data = $excel->getActiveSheet()->toArray();
     unset($excel);
     return $data;
 }
开发者ID:tqsq2005,项目名称:dotplant2,代码行数:10,代码来源:ImportXlsx.php

示例12: pdfExport

 public static function pdfExport($data, $headerTitle = [], $headerRGBColor = 'FCFCFC')
 {
     $rendererName = \PHPExcel_Settings::PDF_RENDERER_DOMPDF;
     $rendererLibraryPath = dirname(dirname(__DIR__)) . DIRECTORY_SEPARATOR . 'vendor' . DIRECTORY_SEPARATOR . 'dompdf' . DIRECTORY_SEPARATOR . 'dompdf';
     if (!\PHPExcel_Settings::setPdfRenderer($rendererName, $rendererLibraryPath)) {
         return false;
     }
     $phpExcel = self::init($data, $headerTitle, $headerRGBColor);
     $objWriter = \PHPExcel_IOFactory::createWriter($phpExcel, 'PDF');
     $objWriter->save('php://output');
     return true;
 }
开发者ID:ashmna,项目名称:MedDocs,代码行数:12,代码来源:ExportData.php

示例13: create_worksheet

 public function create_worksheet($excel_data = NUll)
 {
     //check if the excel data has been set if not exit the excel generation
     if (count($excel_data) > 0) {
         //echo "<pre/>";
         //print_r($excel_data);
         $cacheMethod = PHPExcel_CachedObjectStorageFactory::cache_to_phpTemp;
         $cacheSettings = array('memoryCacheSize' => '2MB');
         PHPExcel_Settings::setCacheStorageMethod($cacheMethod, $cacheSettings);
         ini_set('max_execution_time', 123456);
         $objPHPExcel = new PHPExcel();
         $objPHPExcel->getProperties()->setCreator("CD4");
         $objPHPExcel->getProperties()->setLastModifiedBy($excel_data['doc_creator']);
         $objPHPExcel->getProperties()->setTitle($excel_data['doc_title']);
         $objPHPExcel->getProperties()->setSubject($excel_data['doc_title']);
         $objPHPExcel->getProperties()->setDescription("");
         // Add some data
         //	echo date('H:i:s') . " Add some data\n";
         $objPHPExcel->setActiveSheetIndex(0);
         $rowExec = 1;
         //Looping through the cells
         $column = 0;
         // foreach ($excel_data['column_data'] as $cell) {
         // 	$objPHPExcel -> getActiveSheet() -> setCellValueByColumnAndRow($column, $rowExec, $cell);
         // 	$objPHPExcel -> getActiveSheet() -> getColumnDimension(PHPExcel_Cell::stringFromColumnIndex($column)) -> setAutoSize(true);
         // 	$column++;
         // }
         // $rowExec = 2;
         // $column = 0;
         // foreach ($excel_data['row_data'] as $cell) {
         // //Looping through the cells per facility
         // 	$objPHPExcel -> getActiveSheet() -> setCellValueByColumnAndRow($column, $rowExec, $cell);
         // 	$rowExec++;
         // 	$column++;
         // }
         $objPHPExcel->getActiveSheet()->fromArray($excel_data['row_data'], NULL, 'A1');
         // Rename sheet
         //	echo date('H:i:s') . " Rename sheet\n";
         $objPHPExcel->getActiveSheet()->setTitle('Simple');
         // Save Excel 2007 file
         //echo date('H:i:s') . " Write to Excel2007 format\n";
         $objWriter = new PHPExcel_Writer_Excel2007($objPHPExcel);
         // We'll be outputting an excel file
         header('Content-type: application/vnd.ms-excel');
         // It will be called file.xls
         header("Content-Disposition: attachment; filename=" . $excel_data['file_name']);
         // Write file to the browser
         $objWriter->save('php://output');
         // Echo done
     }
 }
开发者ID:OmondiKevin,项目名称:CD4,代码行数:51,代码来源:worksheets.php

示例14: load_resource_sheets

 private function load_resource_sheets()
 {
     $this->write_log(' Starting reading excel file, this may take minutes, please wait....');
     $file_resource_path = $this->file_directory . $this->file_resource_name;
     if (file_exists($file_resource_path)) {
         $cacheMethod = PHPExcel_CachedObjectStorageFactory::cache_to_phpTemp;
         $cacheSettings = array('memoryCacheSize' => '2GB');
         PHPExcel_Settings::setCacheStorageMethod($cacheMethod, $cacheSettings);
         $reader = PHPExcel_IOFactory::createReader('Excel2007');
         $reader->setReadDataOnly(true);
         $this->objPHPExcel_resource = $reader->load($file_resource_path);
     }
     $this->write_log(' File read. starting convert:');
 }
开发者ID:smallyin,项目名称:ci-phpexcel,代码行数:14,代码来源:reader.php

示例15: __construct

 /**
  * MySqlExcelBuilder::__construct()
  * 
  * @param mixed $db  - Database
  * @param mixed $un  - User name
  * @param mixed $pw  - Password
  * 
  */
 public function __construct($db, $un, $pw)
 {
     $host = 'localhost';
     $cacheMethod = PHPExcel_CachedObjectStorageFactory::cache_in_memory;
     PHPExcel_Settings::setCacheStorageMethod($cacheMethod);
     $this->phpExcel = new PHPExcel();
     $dsn = "mysql:host={$host};port=3306;dbname={$db}";
     try {
         $this->pdo = new PDO($dsn, $un, $pw);
         $this->pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_WARNING);
     } catch (PDOException $e) {
         $this->{$pdo} = null;
         error_log("{$dsn}\n" . 'Connection failed: ' . $e->getMessage());
     }
 }
开发者ID:n1exceptme,项目名称:energia,代码行数:23,代码来源:MySqlExcelBuilder.php


注:本文中的PHPExcel_Settings类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。