29 if (!
defined(
'PHPEXCEL_ROOT')) {
33 define(
'PHPEXCEL_ROOT', dirname(__FILE__) .
'/../../');
34 require(PHPEXCEL_ROOT .
'PHPExcel/Autoloader.php');
91 'a' =>
array(
'font' =>
array(
'underline' =>
true,
122 $data = fread($this->_fileHandle, 2048);
123 if ((strpos(
$data,
'<') !== FALSE) &&
124 (strlen(
$data) !== strlen(strip_tags(
$data)))) {
138 public function load($pFilename)
154 $this->_inputEncoding = $pValue;
176 if ($this->_tableLevel == 0)
193 return array_pop($this->_nestedColumn);
198 if (is_string($cellContent)) {
200 if (trim($cellContent) >
'') {
205 $sheet->setCellValue(
$column .
$row, $cellContent,
true);
211 $this->_dataArray[
$row][
$column] =
'RICH TEXT: ' . $cellContent;
213 $cellContent = (
string)
'';
218 foreach ($element->childNodes as $child) {
219 if ($child instanceof DOMText) {
220 $domText = preg_replace(
'/\s+/u',
' ', trim($child->nodeValue));
221 if (is_string($cellContent)) {
223 $cellContent .= $domText;
228 } elseif ($child instanceof DOMElement) {
231 $attributeArray =
array();
232 foreach ($child->attributes as $attribute) {
234 $attributeArray[$attribute->name] = $attribute->value;
237 switch ($child->nodeName) {
239 foreach ($attributeArray as $attributeName => $attributeValue) {
240 switch ($attributeName) {
251 $sheet->setTitle($cellContent);
262 if ($cellContent >
'')
265 if ($cellContent >
'')
272 if (isset($this->_formats[$child->nodeName])) {
273 $sheet->getStyle(
$column .
$row)->applyFromArray($this->_formats[$child->nodeName]);
275 $cellContent =
'----------';
280 if ($this->_tableLevel > 0) {
282 $cellContent .=
"\n";
292 foreach ($attributeArray as $attributeName => $attributeValue) {
293 switch ($attributeName) {
296 $sheet->getCell(
$column .
$row)->getHyperlink()->setUrl($attributeValue);
297 if (isset($this->_formats[$child->nodeName])) {
298 $sheet->getStyle(
$column . $row)->applyFromArray($this->_formats[$child->nodeName]);
316 if ($this->_tableLevel > 0) {
318 $cellContent .=
"\n";
323 if ($cellContent >
'') {
332 if (isset($this->_formats[$child->nodeName])) {
333 $sheet->getStyle(
$column .
$row)->applyFromArray($this->_formats[$child->nodeName]);
341 if ($this->_tableLevel > 0) {
343 $cellContent .=
"\n";
348 if ($cellContent >
'') {
363 if ($this->_tableLevel > 1)
368 if ($this->_tableLevel > 1) {
406 if (isset($attributeArray[
'rowspan']) && isset($attributeArray[
'colspan'])) {
409 for ($i = 0; $i < $attributeArray[
'colspan'] - 1; $i++) {
412 $range =
$column . $row .
':' . $columnTo . ($row + $attributeArray[
'rowspan'] - 1);
414 $this->rowspan[$value] =
true;
416 $sheet->mergeCells($range);
418 } elseif (isset($attributeArray[
'rowspan'])) {
420 $range =
$column . $row .
':' .
$column . ($row + $attributeArray[
'rowspan'] - 1);
422 $this->rowspan[$value] =
true;
424 $sheet->mergeCells($range);
425 } elseif (isset($attributeArray[
'colspan'])) {
428 for ($i = 0; $i < $attributeArray[
'colspan'] - 1; $i++) {
431 $sheet->mergeCells(
$column . $row .
':' . $columnTo . $row);
440 $this->_tableLevel = 0;
463 fclose($this->_fileHandle);
467 fclose($this->_fileHandle);
476 $dom =
new domDocument;
479 if ($loaded === FALSE) {
484 $dom->preserveWhiteSpace =
false;
513 $this->_sheetIndex = $pValue;
526 $pattern =
'/\\0?' . implode(
'\\0?', str_split(
'<!ENTITY')) .
'\\0?/';
527 if (preg_match($pattern, $xml)) {
528 throw new PHPExcel_Reader_Exception(
'Detected use of ENTITY in XML, spreadsheet file load() aborted to prevent XXE/XEE attacks');
_releaseTableStartColumn()
_flushCell($sheet, $column, $row, &$cellContent)
setSheetIndex($pValue=0)
Set sheet index.
getSheetCount()
Get sheet count.
_isValidFormat()
Validate that the current file is an HTML file.
Add rich text string
The name of the decorator.
createSheet($iSheetIndex=NULL)
Create sheet and add it to this workbook.
securityScanFile($filestream)
Scan theXML for use of <!ENTITY to prevent XXE/XEE attacks.
load($pFilename)
Loads PHPExcel from file.
__construct()
Create a new PHPExcel_Reader_HTML.
getInputEncoding()
Get input encoding.
Create styles array
The data for the language used.
securityScan($xml)
Scan theXML for use of <!ENTITY to prevent XXE/XEE attacks.
getActiveSheet()
Get active sheet.
static extractAllCellReferencesInRange($pRange='A1')
Extract all cell references in range.
setActiveSheetIndex($pIndex=0)
Set active sheet index.
setInputEncoding($pValue='ANSI')
Set input encoding.
getSheetIndex()
Get sheet index.
_processDomElement(DOMNode $element, $sheet, &$row, &$column, &$cellContent, $format=null)
_openFile($pFilename)
Open file for reading.
defined( 'APPLICATION_ENV')||define( 'APPLICATION_ENV'
_setTableStartColumn($column)
loadIntoExisting($pFilename, PHPExcel $objPHPExcel)
Loads PHPExcel from file into PHPExcel instance.