您好,欢迎光临本网站![请登录][注册会员]  
文件名称: 好用的phpExcel
  所属分类: PHP
  开发工具:
  文件大小: 5mb
  下载次数: 0
  上传时间: 2009-03-28
  提 供 者: buqi*****
 详细说明: 好用的phpExcel_workSheetCollection = array(); $this->_workSheetCollection[] = new PHPExcel_Worksheet($this); $this->_activeSheetIndex = 0; // Create document properties $this->_properties = new PHPExcel_DocumentProperties(); // Create document security $this->_security = new PHPExcel_DocumentSecurity(); // Set named ranges $this->_namedRanges = array(); } /** * Get properties * * @return PHPExcel_DocumentProperties */ public function getProperties() { return $this->_properties; } /** * Set properties * * @param PHPExcel_DocumentProperties $pValue */ public function setProperties(PHPExcel_DocumentProperties $pValue) { $this->_properties = $pValue; } /** * Get security * * @return PHPExcel_DocumentSecurity */ public function getSecurity() { return $this->_security; } /** * Set security * * @param PHPExcel_DocumentSecurity $pValue */ public function setSecurity(PHPExcel_DocumentSecurity $pValue) { $this->_security = $pValue; } /** * Get active sheet * * @return PHPExcel_Worksheet */ public function getActiveSheet() { return $this->_workSheetCollection[$this->_activeSheetIndex]; } /** * Create sheet and add it to this workbook * * @return PHPExcel_Worksheet */ public function createSheet() { $newSheet = new PHPExcel_Worksheet($this); $this->addSheet($newSheet); return $newSheet; } /** * Add sheet * * @param PHPExcel_Worksheet $pSheet * @throws Exception */ public function addSheet(PHPExcel_Worksheet $pSheet = null) { $this->_workSheetCollection[] = $pSheet; } /** * Remove sheet by index * * @param int $pIndex Active sheet index * @throws Exception */ public function removeSheetByIndex($pIndex = 0) { if ($pIndex > count($this->_workSheetCollection) - 1) { throw new Exception("Sheet index is out of bounds."); } else { array_splice($this->_workSheetCollection, $pIndex, 1); } } /** * Get sheet by index * * @param int $pIndex Sheet index * @return PHPExcel_Worksheet * @throws Exception */ public function getSheet($pIndex = 0) { if ($pIndex > count($this->_workSheetCollection) - 1) { throw new Exception("Sheet index is out of bounds."); } else { return $this->_workSheetCollection[$pIndex]; } } /** * Get all sheets * * @return PHPExcel_Worksheet[] */ public function getAllSheets() { return $this->_workSheetCollection; } /** * Get sheet by name * * @param string $pName Sheet name * @return PHPExcel_Worksheet * @throws Exception */ public function getSheetByName($pName = '') { $worksheetCount = count($this->_workSheetCollection); for ($i = 0; $i < $worksheetCount; ++$i) { if ($this->_workSheetCollection[$i]->getTitle() == $pName) { return $this->_workSheetCollection[$i]; } } return null; } /** * Get index for sheet * * @param PHPExcel_Worksheet $pSheet * @return Sheet index * @throws Exception */ public function getIndex(PHPExcel_Worksheet $pSheet) { foreach ($this->_workSheetCollection as $key => $value) { if ($value->getHashCode() == $pSheet->getHashCode()) { return $key; } } } /** * Get sheet count * * @return int */ public function getSheetCount() { return count($this->_workSheetCollection); } /** * Get active sheet index * * @return int Active sheet index */ public function getActiveSheetIndex() { return $this->_activeSheetIndex; } /** * Set active sheet index * * @param int $pIndex Active sheet index * @throws Exception */ public function setActiveSheetIndex($pIndex = 0) { if ($pIndex > count($this->_workSheetCollection) - 1) { throw new Exception("Active sheet index is out of bounds."); } else { $this->_activeSheetIndex = $pIndex; } } /** * Get sheet names * * @return string[] */ public function getSheetNames() { $returnValue = array(); $worksheetCount = $this->getSheetCount(); for ($i = 0; $i < $worksheetCount; ++$i) { array_push($returnValue, $this->getSheet($i)->getTitle()); } return $returnValue; } /** * Add external sheet * * @param PHPExcel_Worksheet $pSheet External sheet to add * @throws Exception */ public function addExternalSheet(PHPExcel_Worksheet $pSheet) { if (!is_null($this->getSheetByName($pSheet->getTitle()))) { throw new Exception("Workbook already contains a worksheet named '{$pSheet->getTitle()}'. Rename the external sheet first."); } $pSheet->rebindParent($this); $this->addSheet($pSheet); } /** * Get named ranges * * @return PHPExcel_NamedRange[] */ public function getNamedRanges() { return $this->_namedRanges; } /** * Add named range * * @param PHPExcel_NamedRange $namedRange */ public function addNamedRange(PHPExcel_NamedRange $namedRange) { $this->_namedRanges[$namedRange->getName()] = $namedRange; } /** * Get named range * * @param string $namedRange */ public function getNamedRange($namedRange) { if ($namedRange != '' && !is_null($namedRange) && @isset($this->_namedRanges[$namedRange])) { return $this->_namedRanges[$namedRange]; } return null; } /** * Remove named range * * @param string $namedRange */ public function removeNamedRange($namedRange) { if ($namedRange != '' && !is_null($namedRange) && @isset($this->_namedRanges[$namedRange])) { unset($this->_namedRanges[$namedRange]); } } /** * Get worksheet iterator * * @return PHPExcel_WorksheetIterator */ public function getWorksheetIterator() { return new PHPExcel_WorksheetIterator($this); } /** * Copy workbook (!= clone!) * * @return PHPExcel */ public function copy() { $copied = clone $this; $worksheetCount = count($this->_workSheetCollection); for ($i = 0; $i < $worksheetCount; ++$i) { $this->_workSheetCollection[$i] = $this->_workSheetCollection[$i]->copy(); $this->_workSheetCollection[$i]->rebindParent($this); } return $copied; } /** * Implement PHP __clone to create a deep clone, not just a shallow copy. */ public function __clone() { $vars = get_object_vars($this); foreach ($vars as $key => $value) { if (is_object($value)) { $this->$key = clone $value; } else { $this->$key = $value; } } } } ...展开收缩
(系统自动生成,下载前可以参看下载内容)

下载文件列表

相关说明

  • 本站资源为会员上传分享交流与学习,如有侵犯您的权益,请联系我们删除.
  • 本站是交换下载平台,提供交流渠道,下载内容来自于网络,除下载问题外,其它问题请自行百度
  • 本站已设置防盗链,请勿用迅雷、QQ旋风等多线程下载软件下载资源,下载后用WinRAR最新版进行解压.
  • 如果您发现内容无法下载,请稍后再次尝试;或者到消费记录里找到下载记录反馈给我们.
  • 下载后发现下载的内容跟说明不相乎,请到消费记录里找到下载记录反馈给我们,经确认后退回积分.
  • 如下载前有疑问,可以通过点击"提供者"的名字,查看对方的联系方式,联系对方咨询.
 相关搜索: phpExcel
 输入关键字,在本站1000多万海量源码库中尽情搜索: