本文整理汇总了PHP中PHPExcel_Reader_Excel5_Escher::load方法的典型用法代码示例。如果您正苦于以下问题:PHP PHPExcel_Reader_Excel5_Escher::load方法的具体用法?PHP PHPExcel_Reader_Excel5_Escher::load怎么用?PHP PHPExcel_Reader_Excel5_Escher::load使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PHPExcel_Reader_Excel5_Escher
的用法示例。
在下文中一共展示了PHPExcel_Reader_Excel5_Escher::load方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getReadDataOnly
//.........这里部分代码省略.........
* Read data only?
* If this is true, then the Reader will only read data values for cells, it will not read any formatting information.
* If false (the default) it will read data and formatting.
*
* @return boolean
*/
public function getReadDataOnly()
{
return $this->_readDataOnly;
}
/**
* Set read data only
* Set to true, to advise the Reader only to read data values for cells, and to ignore any formatting information.
* Set to false (the default) to advise the Reader to read both data and formatting for cells.
*
* @param boolean $pValue
*
* @return PHPExcel_Reader_Excel5
*/
public function setReadDataOnly($pValue = false)
{
$this->_readDataOnly = $pValue;
return $this;
}
/**
* Get which sheets to load
* Returns either an array of worksheet names (the list of worksheets that should be loaded), or a null
* indicating that all worksheets in the workbook should be loaded.
*
* @return mixed
*/
public function getLoadSheetsOnly()
{
return $this->_loadSheetsOnly;
}
/**
* Set which sheets to load
*
* @param mixed $value
* This should be either an array of worksheet names to be loaded, or a string containing a single worksheet name.
* If NULL, then it tells the Reader to read all worksheets in the workbook
*
* @return PHPExcel_Reader_Excel5
*/
public function setLoadSheetsOnly($value = null)
{
$this->_loadSheetsOnly = is_array($value) ? $value : array($value);
return $this;
}
/**
* Set all sheets to load
* Tells the Reader to load all worksheets from the workbook.
*
* @return PHPExcel_Reader_Excel5
*/
public function setLoadAllSheets()
{
$this->_loadSheetsOnly = null;
return $this;
}
/**
* Read filter
*
* @return PHPExcel_Reader_IReadFilter
*/
public function getReadFilter()
示例2: load
/**
* Loads PHPExcel from file
*
* @param string $pFilename
* @throws Exception
*/
public function load($pFilename)
{
// Initialisations
$this->_phpExcel = new PHPExcel();
$this->_phpExcel->removeSheetByIndex(0);
// remove 1st sheet
if (!$this->_readDataOnly) {
$this->_phpExcel->removeCellStyleXfByIndex(0);
// remove the default style
$this->_phpExcel->removeCellXfByIndex(0);
// remove the default style
}
// Use ParseXL for the hard work.
$this->_ole = new PHPExcel_Shared_OLERead();
// get excel data
$res = $this->_ole->read($pFilename);
$this->_data = $this->_ole->getWorkBook();
// total byte size of Excel data (workbook global substream + sheet substreams)
$this->_dataSize = strlen($this->_data);
// initialize
$this->_pos = 0;
$this->_codepage = 'CP1252';
$this->_formats = array();
$this->_objFonts = array();
$this->_palette = array();
$this->_sheets = array();
$this->_externalBooks = array();
$this->_ref = array();
$this->_definedname = array();
$this->_sst = array();
$this->_drawingGroupData = '';
$this->_xfIndex = '';
$this->_mapCellXfIndex = array();
$this->_mapCellStyleXfIndex = array();
// Parse Workbook Global Substream
while ($this->_pos < $this->_dataSize) {
$code = $this->_GetInt2d($this->_data, $this->_pos);
switch ($code) {
case self::XLS_Type_BOF:
$pos = $this->_pos;
$length = $this->_GetInt2d($this->_data, $pos + 2);
$recordData = substr($this->_data, $pos + 4, $length);
// offset: 0; size: 2; BIFF version
$this->_version = $this->_GetInt2d($this->_data, $pos + 4);
if ($this->_version != self::XLS_BIFF8 && $this->_version != self::XLS_BIFF7) {
return false;
}
// offset: 2; size: 2; type of stream
$substreamType = $this->_GetInt2d($this->_data, $pos + 6);
if ($substreamType != self::XLS_WorkbookGlobals) {
return false;
}
$this->_pos += 4 + $length;
break;
case self::XLS_Type_FILEPASS:
$this->_readFilepass();
break;
case self::XLS_Type_CODEPAGE:
$this->_readCodepage();
break;
case self::XLS_Type_DATEMODE:
$this->_readDateMode();
break;
case self::XLS_Type_FONT:
$this->_readFont();
break;
case self::XLS_Type_FORMAT:
$this->_readFormat();
break;
case self::XLS_Type_XF:
$this->_readXf();
break;
case self::XLS_Type_STYLE:
$this->_readStyle();
break;
case self::XLS_Type_PALETTE:
$this->_readPalette();
break;
case self::XLS_Type_SHEET:
$this->_readSheet();
break;
case self::XLS_Type_EXTERNALBOOK:
$this->_readExternalBook();
break;
case self::XLS_Type_EXTERNSHEET:
$this->_readExternSheet();
break;
case self::XLS_Type_DEFINEDNAME:
$this->_readDefinedName();
break;
case self::XLS_Type_MSODRAWINGGROUP:
$this->_readMsoDrawingGroup();
break;
case self::XLS_Type_SST:
//.........这里部分代码省略.........
示例3: _readSpContainer
/**
* Read SpContainer record (Shape Container)
*/
private function _readSpContainer()
{
$length = PHPExcel_Reader_Excel5::_GetInt4d($this->_data, $this->_pos + 4);
$recordData = substr($this->_data, $this->_pos + 8, $length);
// add spContainer to spgrContainer
$spContainer = new PHPExcel_Shared_Escher_DgContainer_SpgrContainer_SpContainer();
$this->_object->addChild($spContainer);
// move stream pointer to next record
$this->_pos += 8 + $length;
// record is a container, read contents
$reader = new PHPExcel_Reader_Excel5_Escher($spContainer);
$escher = $reader->load($recordData);
}
示例4: load
/**
* Loads PHPExcel from file
*
* @param string $pFilename
* @throws Exception
*/
public function load($pFilename)
{
// Check if file exists
if (!file_exists($pFilename)) {
throw new Exception("Could not open " . $pFilename . " for reading! File does not exist.");
}
// Initialisations
$this->_phpExcel = new PHPExcel();
$this->_phpExcel->removeSheetByIndex(0);
// Use ParseXL for the hard work.
$this->_ole = new PHPExcel_Shared_OLERead();
$this->_encoderFunction = function_exists('mb_convert_encoding') ? 'mb_convert_encoding' : 'iconv';
// get excel data
$res = $this->_ole->read($pFilename);
// oops, something goes wrong (Darko Miljanovic)
if ($res === false) {
// check error code
if ($this->_ole->error == 1) {
// bad file
throw new Exception('The filename ' . $pFilename . ' is not readable');
} elseif ($this->_ole->error == 2) {
throw new Exception('The filename ' . $pFilename . ' is not recognised as an Excel file');
}
// check other error codes here (eg bad fileformat, etc...)
}
$this->_data = $this->_ole->getWorkBook();
// total byte size of Excel data (workbook global substream + sheet substreams)
$this->_dataSize = strlen($this->_data);
$this->_pos = 0;
// Parse Workbook Global Substream
while ($this->_pos < $this->_dataSize) {
$code = $this->_GetInt2d($this->_data, $this->_pos);
switch ($code) {
case self::XLS_Type_BOF:
$pos = $this->_pos;
$length = $this->_GetInt2d($this->_data, $pos + 2);
$recordData = substr($this->_data, $pos + 4, $length);
// offset: 0; size: 2; BIFF version
$this->_version = $this->_GetInt2d($this->_data, $pos + 4);
if ($this->_version != self::XLS_BIFF8 && $this->_version != self::XLS_BIFF7) {
return false;
}
// offset: 2; size: 2; type of stream
$substreamType = $this->_GetInt2d($this->_data, $pos + 6);
if ($substreamType != self::XLS_WorkbookGlobals) {
return false;
}
$this->_pos += 4 + $length;
break;
case self::XLS_Type_FILEPASS:
$this->_readFilepass();
break;
case self::XLS_Type_CODEPAGE:
$this->_readCodepage();
break;
case self::XLS_Type_DATEMODE:
$this->_readDateMode();
break;
case self::XLS_Type_FONT:
$this->_readFont();
break;
case self::XLS_Type_FORMAT:
$this->_readFormat();
break;
case self::XLS_Type_XF:
$this->_readXf();
break;
case self::XLS_Type_STYLE:
$this->_readStyle();
break;
case self::XLS_Type_PALETTE:
$this->_readPalette();
break;
case self::XLS_Type_SHEET:
$this->_readSheet();
break;
case self::XLS_Type_EXTERNALBOOK:
$this->_readExternalBook();
break;
case self::XLS_Type_EXTERNSHEET:
$this->_readExternSheet();
break;
case self::XLS_Type_DEFINEDNAME:
$this->_readDefinedName();
break;
case self::XLS_Type_MSODRAWINGGROUP:
$this->_readMsoDrawingGroup();
break;
case self::XLS_Type_SST:
$this->_readSst();
break;
case self::XLS_Type_EOF:
$this->_readDefault();
break 2;
//.........这里部分代码省略.........