Finish namespacing the Readers
This commit is contained in:
parent
0d956534eb
commit
f1e8ec1f4d
|
@ -78,7 +78,7 @@ class CSV extends BaseReader implements IReader
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new CSV
|
* Create a new CSV Reader instance
|
||||||
*/
|
*/
|
||||||
public function __construct()
|
public function __construct()
|
||||||
{
|
{
|
||||||
|
|
|
@ -44,7 +44,7 @@ class Excel2003XML extends BaseReader implements IReader
|
||||||
protected $charSet = 'UTF-8';
|
protected $charSet = 'UTF-8';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new Excel2003XML
|
* Create a new Excel2003XML Reader instance
|
||||||
*/
|
*/
|
||||||
public function __construct()
|
public function __construct()
|
||||||
{
|
{
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -405,7 +405,7 @@ class Excel5 extends BaseReader implements IReader
|
||||||
private $md5Ctxt = null;
|
private $md5Ctxt = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new Excel5 instance
|
* Create a new Excel5 Reader instance
|
||||||
*/
|
*/
|
||||||
public function __construct()
|
public function __construct()
|
||||||
{
|
{
|
||||||
|
|
|
@ -91,16 +91,16 @@ class HTML extends BaseReader implements IReader
|
||||||
'font' => array(
|
'font' => array(
|
||||||
'underline' => true,
|
'underline' => true,
|
||||||
'color' => array(
|
'color' => array(
|
||||||
'argb' => PHPExcel_Style_Color::COLOR_BLUE,
|
'argb' => \PHPExcel\Style\Color::COLOR_BLUE,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
), // Blue underlined
|
), // Blue underlined
|
||||||
'hr' => array(
|
'hr' => array(
|
||||||
'borders' => array(
|
'borders' => array(
|
||||||
'bottom' => array(
|
'bottom' => array(
|
||||||
'style' => PHPExcel_Style_Border::BORDER_THIN,
|
'style' => \PHPExcel\Style\Border::BORDER_THIN,
|
||||||
'color' => array(
|
'color' => array(
|
||||||
PHPExcel_Style_Color::COLOR_BLACK,
|
\PHPExcel\Style\Color::COLOR_BLACK,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
@ -110,11 +110,11 @@ class HTML extends BaseReader implements IReader
|
||||||
protected $rowspan = array();
|
protected $rowspan = array();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new PHPExcel_Reader_HTML
|
* Create a new HTML Reader instance
|
||||||
*/
|
*/
|
||||||
public function __construct()
|
public function __construct()
|
||||||
{
|
{
|
||||||
$this->readFilter = new PHPExcel_Reader_DefaultReadFilter();
|
$this->readFilter = new DefaultReadFilter();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -139,7 +139,7 @@ class HTML extends BaseReader implements IReader
|
||||||
*
|
*
|
||||||
* @param string $pFilename
|
* @param string $pFilename
|
||||||
* @return PHPExcel
|
* @return PHPExcel
|
||||||
* @throws PHPExcel_Reader_Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
public function load($pFilename)
|
public function load($pFilename)
|
||||||
{
|
{
|
||||||
|
@ -421,7 +421,7 @@ class HTML extends BaseReader implements IReader
|
||||||
++$columnTo;
|
++$columnTo;
|
||||||
}
|
}
|
||||||
$range = $column . $row . ':' . $columnTo . ($row + $attributeArray['rowspan'] - 1);
|
$range = $column . $row . ':' . $columnTo . ($row + $attributeArray['rowspan'] - 1);
|
||||||
foreach (\PHPExcel_Cell::extractAllCellReferencesInRange($range) as $value) {
|
foreach (\PHPExcel\Cell::extractAllCellReferencesInRange($range) as $value) {
|
||||||
$this->rowspan[$value] = true;
|
$this->rowspan[$value] = true;
|
||||||
}
|
}
|
||||||
$sheet->mergeCells($range);
|
$sheet->mergeCells($range);
|
||||||
|
@ -429,7 +429,7 @@ class HTML extends BaseReader implements IReader
|
||||||
} elseif (isset($attributeArray['rowspan'])) {
|
} elseif (isset($attributeArray['rowspan'])) {
|
||||||
//create merging rowspan
|
//create merging rowspan
|
||||||
$range = $column . $row . ':' . $column . ($row + $attributeArray['rowspan'] - 1);
|
$range = $column . $row . ':' . $column . ($row + $attributeArray['rowspan'] - 1);
|
||||||
foreach (\PHPExcel_Cell::extractAllCellReferencesInRange($range) as $value) {
|
foreach (\PHPExcel\Cell::extractAllCellReferencesInRange($range) as $value) {
|
||||||
$this->rowspan[$value] = true;
|
$this->rowspan[$value] = true;
|
||||||
}
|
}
|
||||||
$sheet->mergeCells($range);
|
$sheet->mergeCells($range);
|
||||||
|
@ -464,7 +464,7 @@ class HTML extends BaseReader implements IReader
|
||||||
* @param string $pFilename
|
* @param string $pFilename
|
||||||
* @param PHPExcel $objPHPExcel
|
* @param PHPExcel $objPHPExcel
|
||||||
* @return PHPExcel
|
* @return PHPExcel
|
||||||
* @throws PHPExcel_Reader_Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
public function loadIntoExisting($pFilename, PHPExcel $objPHPExcel)
|
public function loadIntoExisting($pFilename, PHPExcel $objPHPExcel)
|
||||||
{
|
{
|
||||||
|
@ -472,7 +472,7 @@ class HTML extends BaseReader implements IReader
|
||||||
$this->openFile($pFilename);
|
$this->openFile($pFilename);
|
||||||
if (!$this->isValidFormat()) {
|
if (!$this->isValidFormat()) {
|
||||||
fclose($this->fileHandle);
|
fclose($this->fileHandle);
|
||||||
throw new PHPExcel_Reader_Exception($pFilename . " is an Invalid HTML file.");
|
throw new Exception($pFilename . " is an Invalid HTML file.");
|
||||||
}
|
}
|
||||||
// Close after validating
|
// Close after validating
|
||||||
fclose($this->fileHandle);
|
fclose($this->fileHandle);
|
||||||
|
@ -488,7 +488,7 @@ class HTML extends BaseReader implements IReader
|
||||||
// Reload the HTML file into the DOM object
|
// Reload the HTML file into the DOM object
|
||||||
$loaded = $dom->loadHTML($this->securityScanFile($pFilename));
|
$loaded = $dom->loadHTML($this->securityScanFile($pFilename));
|
||||||
if ($loaded === false) {
|
if ($loaded === false) {
|
||||||
throw new PHPExcel_Reader_Exception('Failed to load ', $pFilename, ' as a DOM Document');
|
throw new Exception('Failed to load ', $pFilename, ' as a DOM Document');
|
||||||
}
|
}
|
||||||
|
|
||||||
// Discard white space
|
// Discard white space
|
||||||
|
@ -517,7 +517,7 @@ class HTML extends BaseReader implements IReader
|
||||||
* Set sheet index
|
* Set sheet index
|
||||||
*
|
*
|
||||||
* @param int $pValue Sheet index
|
* @param int $pValue Sheet index
|
||||||
* @return PHPExcel_Reader_HTML
|
* @return HTML
|
||||||
*/
|
*/
|
||||||
public function setSheetIndex($pValue = 0)
|
public function setSheetIndex($pValue = 0)
|
||||||
{
|
{
|
||||||
|
@ -530,13 +530,13 @@ class HTML extends BaseReader implements IReader
|
||||||
* Scan theXML for use of <!ENTITY to prevent XXE/XEE attacks
|
* Scan theXML for use of <!ENTITY to prevent XXE/XEE attacks
|
||||||
*
|
*
|
||||||
* @param string $xml
|
* @param string $xml
|
||||||
* @throws PHPExcel_Reader_Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
public function securityScan($xml)
|
public function securityScan($xml)
|
||||||
{
|
{
|
||||||
$pattern = '/\\0?' . implode('\\0?', str_split('<!ENTITY')) . '\\0?/';
|
$pattern = '/\\0?' . implode('\\0?', str_split('<!ENTITY')) . '\\0?/';
|
||||||
if (preg_match($pattern, $xml)) {
|
if (preg_match($pattern, $xml)) {
|
||||||
throw new PHPExcel_Reader_Exception('Detected use of ENTITY in XML, spreadsheet file load() aborted to prevent XXE/XEE attacks');
|
throw new Exception('Detected use of ENTITY in XML, spreadsheet file load() aborted to prevent XXE/XEE attacks');
|
||||||
}
|
}
|
||||||
return $xml;
|
return $xml;
|
||||||
}
|
}
|
||||||
|
|
|
@ -37,32 +37,32 @@ class OOCalc extends BaseReader implements IReader
|
||||||
private $styles = array();
|
private $styles = array();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new PHPExcel_Reader_OOCalc
|
* Create a new OOCalc Reader instance
|
||||||
*/
|
*/
|
||||||
public function __construct()
|
public function __construct()
|
||||||
{
|
{
|
||||||
$this->readFilter = new PHPExcel_Reader_DefaultReadFilter();
|
$this->readFilter = new DefaultReadFilter();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Can the current PHPExcel_Reader_IReader read the file?
|
* Can the current IReader read the file?
|
||||||
*
|
*
|
||||||
* @param string $pFilename
|
* @param string $pFilename
|
||||||
* @return boolean
|
* @return boolean
|
||||||
* @throws PHPExcel_Reader_Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
public function canRead($pFilename)
|
public function canRead($pFilename)
|
||||||
{
|
{
|
||||||
// Check if file exists
|
// Check if file exists
|
||||||
if (!file_exists($pFilename)) {
|
if (!file_exists($pFilename)) {
|
||||||
throw new PHPExcel_Reader_Exception("Could not open " . $pFilename . " for reading! File does not exist.");
|
throw new Exception("Could not open " . $pFilename . " for reading! File does not exist.");
|
||||||
}
|
}
|
||||||
|
|
||||||
$zipClass = PHPExcel_Settings::getZipClass();
|
$zipClass = \PHPExcel\Settings::getZipClass();
|
||||||
|
|
||||||
// Check if zip class exists
|
// Check if zip class exists
|
||||||
// if (!class_exists($zipClass, false)) {
|
// if (!class_exists($zipClass, false)) {
|
||||||
// throw new PHPExcel_Reader_Exception($zipClass . " library is not enabled");
|
// throw new Exception($zipClass . " library is not enabled");
|
||||||
// }
|
// }
|
||||||
|
|
||||||
$mimeType = 'UNKNOWN';
|
$mimeType = 'UNKNOWN';
|
||||||
|
@ -74,7 +74,11 @@ class OOCalc extends BaseReader implements IReader
|
||||||
if ($stat && ($stat['size'] <= 255)) {
|
if ($stat && ($stat['size'] <= 255)) {
|
||||||
$mimeType = $zip->getFromName($stat['name']);
|
$mimeType = $zip->getFromName($stat['name']);
|
||||||
} elseif ($stat = $zip->statName('META-INF/manifest.xml')) {
|
} elseif ($stat = $zip->statName('META-INF/manifest.xml')) {
|
||||||
$xml = simplexml_load_string($this->securityScan($zip->getFromName('META-INF/manifest.xml')), 'SimpleXMLElement', PHPExcel_Settings::getLibXmlLoaderOptions());
|
$xml = simplexml_load_string(
|
||||||
|
$this->securityScan($zip->getFromName('META-INF/manifest.xml')),
|
||||||
|
'SimpleXMLElement',
|
||||||
|
\PHPExcel\Settings::getLibXmlLoaderOptions()
|
||||||
|
);
|
||||||
$namespacesContent = $xml->getNamespaces(true);
|
$namespacesContent = $xml->getNamespaces(true);
|
||||||
if (isset($namespacesContent['manifest'])) {
|
if (isset($namespacesContent['manifest'])) {
|
||||||
$manifest = $xml->children($namespacesContent['manifest']);
|
$manifest = $xml->children($namespacesContent['manifest']);
|
||||||
|
@ -101,26 +105,30 @@ class OOCalc extends BaseReader implements IReader
|
||||||
* Reads names of the worksheets from a file, without parsing the whole file to a PHPExcel object
|
* Reads names of the worksheets from a file, without parsing the whole file to a PHPExcel object
|
||||||
*
|
*
|
||||||
* @param string $pFilename
|
* @param string $pFilename
|
||||||
* @throws PHPExcel_Reader_Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
public function listWorksheetNames($pFilename)
|
public function listWorksheetNames($pFilename)
|
||||||
{
|
{
|
||||||
// Check if file exists
|
// Check if file exists
|
||||||
if (!file_exists($pFilename)) {
|
if (!file_exists($pFilename)) {
|
||||||
throw new PHPExcel_Reader_Exception("Could not open " . $pFilename . " for reading! File does not exist.");
|
throw new Exception("Could not open " . $pFilename . " for reading! File does not exist.");
|
||||||
}
|
}
|
||||||
|
|
||||||
$zipClass = PHPExcel_Settings::getZipClass();
|
$zipClass = \PHPExcel\Settings::getZipClass();
|
||||||
|
|
||||||
$zip = new $zipClass;
|
$zip = new $zipClass;
|
||||||
if (!$zip->open($pFilename)) {
|
if (!$zip->open($pFilename)) {
|
||||||
throw new PHPExcel_Reader_Exception("Could not open " . $pFilename . " for reading! Error opening file.");
|
throw new Exception("Could not open " . $pFilename . " for reading! Error opening file.");
|
||||||
}
|
}
|
||||||
|
|
||||||
$worksheetNames = array();
|
$worksheetNames = array();
|
||||||
|
|
||||||
$xml = new XMLReader();
|
$xml = new XMLReader();
|
||||||
$res = $xml->xml($this->securityScanFile('zip://'.realpath($pFilename).'#content.xml'), null, PHPExcel_Settings::getLibXmlLoaderOptions());
|
$res = $xml->xml(
|
||||||
|
$this->securityScanFile('zip://'.realpath($pFilename).'#content.xml'),
|
||||||
|
null,
|
||||||
|
\PHPExcel\Settings::getLibXmlLoaderOptions()
|
||||||
|
);
|
||||||
$xml->setParserProperty(2, true);
|
$xml->setParserProperty(2, true);
|
||||||
|
|
||||||
// Step into the first level of content of the XML
|
// Step into the first level of content of the XML
|
||||||
|
@ -153,26 +161,30 @@ class OOCalc extends BaseReader implements IReader
|
||||||
* Return worksheet info (Name, Last Column Letter, Last Column Index, Total Rows, Total Columns)
|
* Return worksheet info (Name, Last Column Letter, Last Column Index, Total Rows, Total Columns)
|
||||||
*
|
*
|
||||||
* @param string $pFilename
|
* @param string $pFilename
|
||||||
* @throws PHPExcel_Reader_Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
public function listWorksheetInfo($pFilename)
|
public function listWorksheetInfo($pFilename)
|
||||||
{
|
{
|
||||||
// Check if file exists
|
// Check if file exists
|
||||||
if (!file_exists($pFilename)) {
|
if (!file_exists($pFilename)) {
|
||||||
throw new PHPExcel_Reader_Exception("Could not open " . $pFilename . " for reading! File does not exist.");
|
throw new Exception("Could not open " . $pFilename . " for reading! File does not exist.");
|
||||||
}
|
}
|
||||||
|
|
||||||
$worksheetInfo = array();
|
$worksheetInfo = array();
|
||||||
|
|
||||||
$zipClass = PHPExcel_Settings::getZipClass();
|
$zipClass = \PHPExcel\Settings::getZipClass();
|
||||||
|
|
||||||
$zip = new $zipClass;
|
$zip = new $zipClass;
|
||||||
if (!$zip->open($pFilename)) {
|
if (!$zip->open($pFilename)) {
|
||||||
throw new PHPExcel_Reader_Exception("Could not open " . $pFilename . " for reading! Error opening file.");
|
throw new Exception("Could not open " . $pFilename . " for reading! Error opening file.");
|
||||||
}
|
}
|
||||||
|
|
||||||
$xml = new XMLReader();
|
$xml = new XMLReader();
|
||||||
$res = $xml->xml($this->securityScanFile('zip://'.realpath($pFilename).'#content.xml'), null, PHPExcel_Settings::getLibXmlLoaderOptions());
|
$res = $xml->xml(
|
||||||
|
$this->securityScanFile('zip://'.realpath($pFilename).'#content.xml'),
|
||||||
|
null,
|
||||||
|
\PHPExcel\Settings::getLibXmlLoaderOptions()
|
||||||
|
);
|
||||||
$xml->setParserProperty(2, true);
|
$xml->setParserProperty(2, true);
|
||||||
|
|
||||||
// Step into the first level of content of the XML
|
// Step into the first level of content of the XML
|
||||||
|
@ -230,7 +242,7 @@ class OOCalc extends BaseReader implements IReader
|
||||||
|
|
||||||
$tmpInfo['totalColumns'] = max($tmpInfo['totalColumns'], $currCells);
|
$tmpInfo['totalColumns'] = max($tmpInfo['totalColumns'], $currCells);
|
||||||
$tmpInfo['lastColumnIndex'] = $tmpInfo['totalColumns'] - 1;
|
$tmpInfo['lastColumnIndex'] = $tmpInfo['totalColumns'] - 1;
|
||||||
$tmpInfo['lastColumnLetter'] = PHPExcel_Cell::stringFromColumnIndex($tmpInfo['lastColumnIndex']);
|
$tmpInfo['lastColumnLetter'] = \PHPExcel\Cell::stringFromColumnIndex($tmpInfo['lastColumnIndex']);
|
||||||
$worksheetInfo[] = $tmpInfo;
|
$worksheetInfo[] = $tmpInfo;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -264,7 +276,7 @@ class OOCalc extends BaseReader implements IReader
|
||||||
// }
|
// }
|
||||||
// }
|
// }
|
||||||
//
|
//
|
||||||
// $tmpInfo['lastColumnLetter'] = PHPExcel_Cell::stringFromColumnIndex($tmpInfo['lastColumnIndex']);
|
// $tmpInfo['lastColumnLetter'] = \PHPExcel\Cell::stringFromColumnIndex($tmpInfo['lastColumnIndex']);
|
||||||
// $tmpInfo['totalColumns'] = $tmpInfo['lastColumnIndex'] + 1;
|
// $tmpInfo['totalColumns'] = $tmpInfo['lastColumnIndex'] + 1;
|
||||||
//
|
//
|
||||||
// }
|
// }
|
||||||
|
@ -278,8 +290,8 @@ class OOCalc extends BaseReader implements IReader
|
||||||
* Loads PHPExcel from file
|
* Loads PHPExcel from file
|
||||||
*
|
*
|
||||||
* @param string $pFilename
|
* @param string $pFilename
|
||||||
* @return PHPExcel
|
* @return Spreadsheet
|
||||||
* @throws PHPExcel_Reader_Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
public function load($pFilename)
|
public function load($pFilename)
|
||||||
{
|
{
|
||||||
|
@ -306,29 +318,33 @@ class OOCalc extends BaseReader implements IReader
|
||||||
* Loads PHPExcel from file into PHPExcel instance
|
* Loads PHPExcel from file into PHPExcel instance
|
||||||
*
|
*
|
||||||
* @param string $pFilename
|
* @param string $pFilename
|
||||||
* @param PHPExcel $objPHPExcel
|
* @param Spreadsheet $objPHPExcel
|
||||||
* @return PHPExcel
|
* @return Spreadsheet
|
||||||
* @throws PHPExcel_Reader_Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
public function loadIntoExisting($pFilename, PHPExcel $objPHPExcel)
|
public function loadIntoExisting($pFilename, PHPExcel $objPHPExcel)
|
||||||
{
|
{
|
||||||
// Check if file exists
|
// Check if file exists
|
||||||
if (!file_exists($pFilename)) {
|
if (!file_exists($pFilename)) {
|
||||||
throw new PHPExcel_Reader_Exception("Could not open " . $pFilename . " for reading! File does not exist.");
|
throw new Exception("Could not open " . $pFilename . " for reading! File does not exist.");
|
||||||
}
|
}
|
||||||
|
|
||||||
$timezoneObj = new DateTimeZone('Europe/London');
|
$timezoneObj = new DateTimeZone('Europe/London');
|
||||||
$GMT = new DateTimeZone('UTC');
|
$GMT = new DateTimeZone('UTC');
|
||||||
|
|
||||||
$zipClass = PHPExcel_Settings::getZipClass();
|
$zipClass = \PHPExcel\Settings::getZipClass();
|
||||||
|
|
||||||
$zip = new $zipClass;
|
$zip = new $zipClass;
|
||||||
if (!$zip->open($pFilename)) {
|
if (!$zip->open($pFilename)) {
|
||||||
throw new PHPExcel_Reader_Exception("Could not open " . $pFilename . " for reading! Error opening file.");
|
throw new Exception("Could not open " . $pFilename . " for reading! Error opening file.");
|
||||||
}
|
}
|
||||||
|
|
||||||
// echo '<h1>Meta Information</h1>';
|
// echo '<h1>Meta Information</h1>';
|
||||||
$xml = simplexml_load_string($this->securityScan($zip->getFromName("meta.xml")), 'SimpleXMLElement', PHPExcel_Settings::getLibXmlLoaderOptions());
|
$xml = simplexml_load_string(
|
||||||
|
$this->securityScan($zip->getFromName("meta.xml")),
|
||||||
|
'SimpleXMLElement',
|
||||||
|
\PHPExcel\Settings::getLibXmlLoaderOptions()
|
||||||
|
);
|
||||||
$namespacesMeta = $xml->getNamespaces(true);
|
$namespacesMeta = $xml->getNamespaces(true);
|
||||||
// echo '<pre>';
|
// echo '<pre>';
|
||||||
// print_r($namespacesMeta);
|
// print_r($namespacesMeta);
|
||||||
|
@ -414,7 +430,11 @@ class OOCalc extends BaseReader implements IReader
|
||||||
|
|
||||||
|
|
||||||
// echo '<h1>Workbook Content</h1>';
|
// echo '<h1>Workbook Content</h1>';
|
||||||
$xml = simplexml_load_string($this->securityScan($zip->getFromName("content.xml")), 'SimpleXMLElement', PHPExcel_Settings::getLibXmlLoaderOptions());
|
$xml = simplexml_load_string(
|
||||||
|
$this->securityScan($zip->getFromName("content.xml")),
|
||||||
|
'SimpleXMLElement',
|
||||||
|
\PHPExcel\Settings::getLibXmlLoaderOptions()
|
||||||
|
);
|
||||||
$namespacesContent = $xml->getNamespaces(true);
|
$namespacesContent = $xml->getNamespaces(true);
|
||||||
// echo '<pre>';
|
// echo '<pre>';
|
||||||
// print_r($namespacesContent);
|
// print_r($namespacesContent);
|
||||||
|
@ -533,7 +553,7 @@ class OOCalc extends BaseReader implements IReader
|
||||||
// echo 'Value Type is '.$cellDataOfficeAttributes['value-type'].'<br />';
|
// echo 'Value Type is '.$cellDataOfficeAttributes['value-type'].'<br />';
|
||||||
switch ($cellDataOfficeAttributes['value-type']) {
|
switch ($cellDataOfficeAttributes['value-type']) {
|
||||||
case 'string':
|
case 'string':
|
||||||
$type = PHPExcel_Cell_DataType::TYPE_STRING;
|
$type = \PHPExcel\Cell\DataType::TYPE_STRING;
|
||||||
$dataValue = $allCellDataText;
|
$dataValue = $allCellDataText;
|
||||||
if (isset($dataValue->a)) {
|
if (isset($dataValue->a)) {
|
||||||
$dataValue = $dataValue->a;
|
$dataValue = $dataValue->a;
|
||||||
|
@ -542,27 +562,27 @@ class OOCalc extends BaseReader implements IReader
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 'boolean':
|
case 'boolean':
|
||||||
$type = PHPExcel_Cell_DataType::TYPE_BOOL;
|
$type = \PHPExcel\Cell\DataType::TYPE_BOOL;
|
||||||
$dataValue = ($allCellDataText == 'TRUE') ? true : false;
|
$dataValue = ($allCellDataText == 'TRUE') ? true : false;
|
||||||
break;
|
break;
|
||||||
case 'percentage':
|
case 'percentage':
|
||||||
$type = PHPExcel_Cell_DataType::TYPE_NUMERIC;
|
$type = \PHPExcel\Cell\DataType::TYPE_NUMERIC;
|
||||||
$dataValue = (float) $cellDataOfficeAttributes['value'];
|
$dataValue = (float) $cellDataOfficeAttributes['value'];
|
||||||
if (floor($dataValue) == $dataValue) {
|
if (floor($dataValue) == $dataValue) {
|
||||||
$dataValue = (integer) $dataValue;
|
$dataValue = (integer) $dataValue;
|
||||||
}
|
}
|
||||||
$formatting = PHPExcel_Style_NumberFormat::FORMAT_PERCENTAGE_00;
|
$formatting = \PHPExcel\Style\NumberFormat::FORMAT_PERCENTAGE_00;
|
||||||
break;
|
break;
|
||||||
case 'currency':
|
case 'currency':
|
||||||
$type = PHPExcel_Cell_DataType::TYPE_NUMERIC;
|
$type = \PHPExcel\Cell\DataType::TYPE_NUMERIC;
|
||||||
$dataValue = (float) $cellDataOfficeAttributes['value'];
|
$dataValue = (float) $cellDataOfficeAttributes['value'];
|
||||||
if (floor($dataValue) == $dataValue) {
|
if (floor($dataValue) == $dataValue) {
|
||||||
$dataValue = (integer) $dataValue;
|
$dataValue = (integer) $dataValue;
|
||||||
}
|
}
|
||||||
$formatting = PHPExcel_Style_NumberFormat::FORMAT_CURRENCY_USD_SIMPLE;
|
$formatting = \PHPExcel\Style\NumberFormat::FORMAT_CURRENCY_USD_SIMPLE;
|
||||||
break;
|
break;
|
||||||
case 'float':
|
case 'float':
|
||||||
$type = PHPExcel_Cell_DataType::TYPE_NUMERIC;
|
$type = \PHPExcel\Cell\DataType::TYPE_NUMERIC;
|
||||||
$dataValue = (float) $cellDataOfficeAttributes['value'];
|
$dataValue = (float) $cellDataOfficeAttributes['value'];
|
||||||
if (floor($dataValue) == $dataValue) {
|
if (floor($dataValue) == $dataValue) {
|
||||||
if ($dataValue == (integer) $dataValue) {
|
if ($dataValue == (integer) $dataValue) {
|
||||||
|
@ -573,21 +593,21 @@ class OOCalc extends BaseReader implements IReader
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 'date':
|
case 'date':
|
||||||
$type = PHPExcel_Cell_DataType::TYPE_NUMERIC;
|
$type = \PHPExcel\Cell\DataType::TYPE_NUMERIC;
|
||||||
$dateObj = new DateTime($cellDataOfficeAttributes['date-value'], $GMT);
|
$dateObj = new DateTime($cellDataOfficeAttributes['date-value'], $GMT);
|
||||||
$dateObj->setTimeZone($timezoneObj);
|
$dateObj->setTimeZone($timezoneObj);
|
||||||
list($year, $month, $day, $hour, $minute, $second) = explode(' ', $dateObj->format('Y m d H i s'));
|
list($year, $month, $day, $hour, $minute, $second) = explode(' ', $dateObj->format('Y m d H i s'));
|
||||||
$dataValue = PHPExcel_Shared_Date::FormattedPHPToExcel($year, $month, $day, $hour, $minute, $second);
|
$dataValue = \PHPExcel\Shared\Date::FormattedPHPToExcel($year, $month, $day, $hour, $minute, $second);
|
||||||
if ($dataValue != floor($dataValue)) {
|
if ($dataValue != floor($dataValue)) {
|
||||||
$formatting = PHPExcel_Style_NumberFormat::FORMAT_DATE_XLSX15.' '.PHPExcel_Style_NumberFormat::FORMAT_DATE_TIME4;
|
$formatting = \PHPExcel\Style\NumberFormat::FORMAT_DATE_XLSX15.' '.\PHPExcel\Style\NumberFormat::FORMAT_DATE_TIME4;
|
||||||
} else {
|
} else {
|
||||||
$formatting = PHPExcel_Style_NumberFormat::FORMAT_DATE_XLSX15;
|
$formatting = \PHPExcel\Style\NumberFormat::FORMAT_DATE_XLSX15;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 'time':
|
case 'time':
|
||||||
$type = PHPExcel_Cell_DataType::TYPE_NUMERIC;
|
$type = \PHPExcel\Cell\DataType::TYPE_NUMERIC;
|
||||||
$dataValue = PHPExcel_Shared_Date::PHPToExcel(strtotime('01-01-1970 '.implode(':', sscanf($cellDataOfficeAttributes['time-value'], 'PT%dH%dM%dS'))));
|
$dataValue = \PHPExcel\Shared\Date::PHPToExcel(strtotime('01-01-1970 '.implode(':', sscanf($cellDataOfficeAttributes['time-value'], 'PT%dH%dM%dS'))));
|
||||||
$formatting = PHPExcel_Style_NumberFormat::FORMAT_DATE_TIME4;
|
$formatting = \PHPExcel\Style\NumberFormat::FORMAT_DATE_TIME4;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
// echo 'Data value is '.$dataValue.'<br />';
|
// echo 'Data value is '.$dataValue.'<br />';
|
||||||
|
@ -595,12 +615,12 @@ class OOCalc extends BaseReader implements IReader
|
||||||
// echo 'Hyperlink is '.$hyperlink.'<br />';
|
// echo 'Hyperlink is '.$hyperlink.'<br />';
|
||||||
// }
|
// }
|
||||||
} else {
|
} else {
|
||||||
$type = PHPExcel_Cell_DataType::TYPE_NULL;
|
$type = \PHPExcel\Cell\DataType::TYPE_NULL;
|
||||||
$dataValue = null;
|
$dataValue = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($hasCalculatedValue) {
|
if ($hasCalculatedValue) {
|
||||||
$type = PHPExcel_Cell_DataType::TYPE_FORMULA;
|
$type = \PHPExcel\Cell\DataType::TYPE_FORMULA;
|
||||||
// echo 'Formula: ', $cellDataFormula, PHP_EOL;
|
// echo 'Formula: ', $cellDataFormula, PHP_EOL;
|
||||||
$cellDataFormula = substr($cellDataFormula, strpos($cellDataFormula, ':=')+1);
|
$cellDataFormula = substr($cellDataFormula, strpos($cellDataFormula, ':=')+1);
|
||||||
$temp = explode('"', $cellDataFormula);
|
$temp = explode('"', $cellDataFormula);
|
||||||
|
@ -612,7 +632,7 @@ class OOCalc extends BaseReader implements IReader
|
||||||
$value = preg_replace('/\[([^\.]+)\.([^\.]+)\]/Ui', '$1!$2', $value); // Cell reference in another sheet
|
$value = preg_replace('/\[([^\.]+)\.([^\.]+)\]/Ui', '$1!$2', $value); // Cell reference in another sheet
|
||||||
$value = preg_replace('/\[\.([^\.]+):\.([^\.]+)\]/Ui', '$1:$2', $value); // Cell range reference
|
$value = preg_replace('/\[\.([^\.]+):\.([^\.]+)\]/Ui', '$1:$2', $value); // Cell range reference
|
||||||
$value = preg_replace('/\[\.([^\.]+)\]/Ui', '$1', $value); // Simple cell reference
|
$value = preg_replace('/\[\.([^\.]+)\]/Ui', '$1', $value); // Simple cell reference
|
||||||
$value = PHPExcel_Calculation::translateSeparator(';', ',', $value, $inBraces);
|
$value = \PHPExcel\Calculation::translateSeparator(';', ',', $value, $inBraces);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
unset($value);
|
unset($value);
|
||||||
|
@ -627,7 +647,7 @@ class OOCalc extends BaseReader implements IReader
|
||||||
if ($i > 0) {
|
if ($i > 0) {
|
||||||
++$columnID;
|
++$columnID;
|
||||||
}
|
}
|
||||||
if ($type !== PHPExcel_Cell_DataType::TYPE_NULL) {
|
if ($type !== \PHPExcel\Cell\DataType::TYPE_NULL) {
|
||||||
for ($rowAdjust = 0; $rowAdjust < $rowRepeats; ++$rowAdjust) {
|
for ($rowAdjust = 0; $rowAdjust < $rowRepeats; ++$rowAdjust) {
|
||||||
$rID = $rowID + $rowAdjust;
|
$rID = $rowID + $rowAdjust;
|
||||||
$objPHPExcel->getActiveSheet()->getCell($columnID.$rID)->setValueExplicit((($hasCalculatedValue) ? $cellDataFormula : $dataValue), $type);
|
$objPHPExcel->getActiveSheet()->getCell($columnID.$rID)->setValueExplicit((($hasCalculatedValue) ? $cellDataFormula : $dataValue), $type);
|
||||||
|
@ -638,7 +658,7 @@ class OOCalc extends BaseReader implements IReader
|
||||||
if ($formatting !== null) {
|
if ($formatting !== null) {
|
||||||
$objPHPExcel->getActiveSheet()->getStyle($columnID.$rID)->getNumberFormat()->setFormatCode($formatting);
|
$objPHPExcel->getActiveSheet()->getStyle($columnID.$rID)->getNumberFormat()->setFormatCode($formatting);
|
||||||
} else {
|
} else {
|
||||||
$objPHPExcel->getActiveSheet()->getStyle($columnID.$rID)->getNumberFormat()->setFormatCode(PHPExcel_Style_NumberFormat::FORMAT_GENERAL);
|
$objPHPExcel->getActiveSheet()->getStyle($columnID.$rID)->getNumberFormat()->setFormatCode(\PHPExcel\Style\NumberFormat::FORMAT_GENERAL);
|
||||||
}
|
}
|
||||||
if ($hyperlink !== null) {
|
if ($hyperlink !== null) {
|
||||||
$objPHPExcel->getActiveSheet()->getCell($columnID.$rID)->getHyperlink()->setUrl($hyperlink);
|
$objPHPExcel->getActiveSheet()->getCell($columnID.$rID)->getHyperlink()->setUrl($hyperlink);
|
||||||
|
@ -650,10 +670,10 @@ class OOCalc extends BaseReader implements IReader
|
||||||
|
|
||||||
// Merged cells
|
// Merged cells
|
||||||
if ((isset($cellDataTableAttributes['number-columns-spanned'])) || (isset($cellDataTableAttributes['number-rows-spanned']))) {
|
if ((isset($cellDataTableAttributes['number-columns-spanned'])) || (isset($cellDataTableAttributes['number-rows-spanned']))) {
|
||||||
if (($type !== PHPExcel_Cell_DataType::TYPE_NULL) || (!$this->readDataOnly)) {
|
if (($type !== \PHPExcel\Cell\DataType::TYPE_NULL) || (!$this->readDataOnly)) {
|
||||||
$columnTo = $columnID;
|
$columnTo = $columnID;
|
||||||
if (isset($cellDataTableAttributes['number-columns-spanned'])) {
|
if (isset($cellDataTableAttributes['number-columns-spanned'])) {
|
||||||
$columnTo = PHPExcel_Cell::stringFromColumnIndex(PHPExcel_Cell::columnIndexFromString($columnID) + $cellDataTableAttributes['number-columns-spanned'] -2);
|
$columnTo = \PHPExcel\Cell::stringFromColumnIndex(\PHPExcel\Cell::columnIndexFromString($columnID) + $cellDataTableAttributes['number-columns-spanned'] -2);
|
||||||
}
|
}
|
||||||
$rowTo = $rowID;
|
$rowTo = $rowID;
|
||||||
if (isset($cellDataTableAttributes['number-rows-spanned'])) {
|
if (isset($cellDataTableAttributes['number-rows-spanned'])) {
|
||||||
|
@ -680,7 +700,7 @@ class OOCalc extends BaseReader implements IReader
|
||||||
|
|
||||||
private function parseRichText($is = '')
|
private function parseRichText($is = '')
|
||||||
{
|
{
|
||||||
$value = new PHPExcel_RichText();
|
$value = new \PHPExcel\RichText();
|
||||||
|
|
||||||
$value->createText($is);
|
$value->createText($is);
|
||||||
|
|
||||||
|
|
|
@ -58,11 +58,11 @@ class SYLK extends BaseReader implements IReader
|
||||||
private $format = 0;
|
private $format = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new PHPExcel_Reader_SYLK
|
* Create a new SYLK Reader instance
|
||||||
*/
|
*/
|
||||||
public function __construct()
|
public function __construct()
|
||||||
{
|
{
|
||||||
$this->readFilter = new PHPExcel_Reader_DefaultReadFilter();
|
$this->readFilter = new DefaultReadFilter();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -114,8 +114,8 @@ class SYLK extends BaseReader implements IReader
|
||||||
/**
|
/**
|
||||||
* Return worksheet info (Name, Last Column Letter, Last Column Index, Total Rows, Total Columns)
|
* Return worksheet info (Name, Last Column Letter, Last Column Index, Total Rows, Total Columns)
|
||||||
*
|
*
|
||||||
* @param string $pFilename
|
* @param string $pFilename
|
||||||
* @throws PHPExcel_Reader_Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
public function listWorksheetInfo($pFilename)
|
public function listWorksheetInfo($pFilename)
|
||||||
{
|
{
|
||||||
|
@ -123,7 +123,7 @@ class SYLK extends BaseReader implements IReader
|
||||||
$this->openFile($pFilename);
|
$this->openFile($pFilename);
|
||||||
if (!$this->isValidFormat()) {
|
if (!$this->isValidFormat()) {
|
||||||
fclose($this->fileHandle);
|
fclose($this->fileHandle);
|
||||||
throw new PHPExcel_Reader_Exception($pFilename . " is an Invalid Spreadsheet file.");
|
throw new Exception($pFilename . " is an Invalid Spreadsheet file.");
|
||||||
}
|
}
|
||||||
$fileHandle = $this->fileHandle;
|
$fileHandle = $this->fileHandle;
|
||||||
rewind($fileHandle);
|
rewind($fileHandle);
|
||||||
|
@ -144,7 +144,7 @@ class SYLK extends BaseReader implements IReader
|
||||||
$columnIndex = 0;
|
$columnIndex = 0;
|
||||||
|
|
||||||
// convert SYLK encoded $rowData to UTF-8
|
// convert SYLK encoded $rowData to UTF-8
|
||||||
$rowData = PHPExcel_Shared_String::SYLKtoUTF8($rowData);
|
$rowData = \PHPExcel\Shared\String::SYLKtoUTF8($rowData);
|
||||||
|
|
||||||
// explode each row at semicolons while taking into account that literal semicolon (;)
|
// explode each row at semicolons while taking into account that literal semicolon (;)
|
||||||
// is escaped like this (;;)
|
// is escaped like this (;;)
|
||||||
|
@ -171,7 +171,7 @@ class SYLK extends BaseReader implements IReader
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$worksheetInfo[0]['lastColumnLetter'] = PHPExcel_Cell::stringFromColumnIndex($worksheetInfo[0]['lastColumnIndex']);
|
$worksheetInfo[0]['lastColumnLetter'] = \PHPExcel\Cell::stringFromColumnIndex($worksheetInfo[0]['lastColumnIndex']);
|
||||||
$worksheetInfo[0]['totalColumns'] = $worksheetInfo[0]['lastColumnIndex'] + 1;
|
$worksheetInfo[0]['totalColumns'] = $worksheetInfo[0]['lastColumnIndex'] + 1;
|
||||||
|
|
||||||
// Close file
|
// Close file
|
||||||
|
@ -184,13 +184,13 @@ class SYLK extends BaseReader implements IReader
|
||||||
* Loads PHPExcel from file
|
* Loads PHPExcel from file
|
||||||
*
|
*
|
||||||
* @param string $pFilename
|
* @param string $pFilename
|
||||||
* @return PHPExcel
|
* @return Spreadsheet
|
||||||
* @throws PHPExcel_Reader_Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
public function load($pFilename)
|
public function load($pFilename)
|
||||||
{
|
{
|
||||||
// Create new PHPExcel
|
// Create new PHPExcel
|
||||||
$objPHPExcel = new PHPExcel();
|
$objPHPExcel = new Spreadsheet();
|
||||||
|
|
||||||
// Load into this instance
|
// Load into this instance
|
||||||
return $this->loadIntoExisting($pFilename, $objPHPExcel);
|
return $this->loadIntoExisting($pFilename, $objPHPExcel);
|
||||||
|
@ -200,22 +200,22 @@ class SYLK extends BaseReader implements IReader
|
||||||
* Loads PHPExcel from file into PHPExcel instance
|
* Loads PHPExcel from file into PHPExcel instance
|
||||||
*
|
*
|
||||||
* @param string $pFilename
|
* @param string $pFilename
|
||||||
* @param PHPExcel $objPHPExcel
|
* @param Spreadsheet $objPHPExcel
|
||||||
* @return PHPExcel
|
* @return Spreadsheet
|
||||||
* @throws PHPExcel_Reader_Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
public function loadIntoExisting($pFilename, PHPExcel $objPHPExcel)
|
public function loadIntoExisting($pFilename, Spreadsheet $objPHPExcel)
|
||||||
{
|
{
|
||||||
// Open file
|
// Open file
|
||||||
$this->openFile($pFilename);
|
$this->openFile($pFilename);
|
||||||
if (!$this->isValidFormat()) {
|
if (!$this->isValidFormat()) {
|
||||||
fclose($this->fileHandle);
|
fclose($this->fileHandle);
|
||||||
throw new PHPExcel_Reader_Exception($pFilename . " is an Invalid Spreadsheet file.");
|
throw new Exception($pFilename . " is an Invalid Spreadsheet file.");
|
||||||
}
|
}
|
||||||
$fileHandle = $this->fileHandle;
|
$fileHandle = $this->fileHandle;
|
||||||
rewind($fileHandle);
|
rewind($fileHandle);
|
||||||
|
|
||||||
// Create new PHPExcel
|
// Create new Worksheets
|
||||||
while ($objPHPExcel->getSheetCount() <= $this->sheetIndex) {
|
while ($objPHPExcel->getSheetCount() <= $this->sheetIndex) {
|
||||||
$objPHPExcel->createSheet();
|
$objPHPExcel->createSheet();
|
||||||
}
|
}
|
||||||
|
@ -231,7 +231,7 @@ class SYLK extends BaseReader implements IReader
|
||||||
// loop through one row (line) at a time in the file
|
// loop through one row (line) at a time in the file
|
||||||
while (($rowData = fgets($fileHandle)) !== false) {
|
while (($rowData = fgets($fileHandle)) !== false) {
|
||||||
// convert SYLK encoded $rowData to UTF-8
|
// convert SYLK encoded $rowData to UTF-8
|
||||||
$rowData = PHPExcel_Shared_String::SYLKtoUTF8($rowData);
|
$rowData = \PHPExcel\Shared\String::SYLKtoUTF8($rowData);
|
||||||
|
|
||||||
// explode each row at semicolons while taking into account that literal semicolon (;)
|
// explode each row at semicolons while taking into account that literal semicolon (;)
|
||||||
// is escaped like this (;;)
|
// is escaped like this (;;)
|
||||||
|
@ -264,16 +264,16 @@ class SYLK extends BaseReader implements IReader
|
||||||
$formatArray['font']['bold'] = true;
|
$formatArray['font']['bold'] = true;
|
||||||
break;
|
break;
|
||||||
case 'T':
|
case 'T':
|
||||||
$formatArray['borders']['top']['style'] = PHPExcel_Style_Border::BORDER_THIN;
|
$formatArray['borders']['top']['style'] = \PHPExcel\Style\Border::BORDER_THIN;
|
||||||
break;
|
break;
|
||||||
case 'B':
|
case 'B':
|
||||||
$formatArray['borders']['bottom']['style'] = PHPExcel_Style_Border::BORDER_THIN;
|
$formatArray['borders']['bottom']['style'] = \PHPExcel\Style\Border::BORDER_THIN;
|
||||||
break;
|
break;
|
||||||
case 'L':
|
case 'L':
|
||||||
$formatArray['borders']['left']['style'] = PHPExcel_Style_Border::BORDER_THIN;
|
$formatArray['borders']['left']['style'] = \PHPExcel\Style\Border::BORDER_THIN;
|
||||||
break;
|
break;
|
||||||
case 'R':
|
case 'R':
|
||||||
$formatArray['borders']['right']['style'] = PHPExcel_Style_Border::BORDER_THIN;
|
$formatArray['borders']['right']['style'] = \PHPExcel\Style\Border::BORDER_THIN;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -332,7 +332,7 @@ class SYLK extends BaseReader implements IReader
|
||||||
if ($columnReference{0} == '[') {
|
if ($columnReference{0} == '[') {
|
||||||
$columnReference = $column + trim($columnReference, '[]');
|
$columnReference = $column + trim($columnReference, '[]');
|
||||||
}
|
}
|
||||||
$A1CellReference = PHPExcel_Cell::stringFromColumnIndex($columnReference-1).$rowReference;
|
$A1CellReference = \PHPExcel\Cell::stringFromColumnIndex($columnReference-1).$rowReference;
|
||||||
|
|
||||||
$value = substr_replace($value, $A1CellReference, $cellReference[0][1], strlen($cellReference[0][0]));
|
$value = substr_replace($value, $A1CellReference, $cellReference[0][1], strlen($cellReference[0][0]));
|
||||||
}
|
}
|
||||||
|
@ -345,13 +345,13 @@ class SYLK extends BaseReader implements IReader
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$columnLetter = PHPExcel_Cell::stringFromColumnIndex($column-1);
|
$columnLetter = \PHPExcel\Cell::stringFromColumnIndex($column-1);
|
||||||
$cellData = PHPExcel_Calculation::unwrapResult($cellData);
|
$cellData = \PHPExcel\Calculation::unwrapResult($cellData);
|
||||||
|
|
||||||
// Set cell value
|
// Set cell value
|
||||||
$objPHPExcel->getActiveSheet()->getCell($columnLetter.$row)->setValue(($hasCalculatedValue) ? $cellDataFormula : $cellData);
|
$objPHPExcel->getActiveSheet()->getCell($columnLetter.$row)->setValue(($hasCalculatedValue) ? $cellDataFormula : $cellData);
|
||||||
if ($hasCalculatedValue) {
|
if ($hasCalculatedValue) {
|
||||||
$cellData = PHPExcel_Calculation::unwrapResult($cellData);
|
$cellData = \PHPExcel\Calculation::unwrapResult($cellData);
|
||||||
$objPHPExcel->getActiveSheet()->getCell($columnLetter.$row)->setCalculatedValue($cellData);
|
$objPHPExcel->getActiveSheet()->getCell($columnLetter.$row)->setCalculatedValue($cellData);
|
||||||
}
|
}
|
||||||
// Read cell formatting
|
// Read cell formatting
|
||||||
|
@ -385,16 +385,16 @@ class SYLK extends BaseReader implements IReader
|
||||||
$styleData['font']['bold'] = true;
|
$styleData['font']['bold'] = true;
|
||||||
break;
|
break;
|
||||||
case 'T':
|
case 'T':
|
||||||
$styleData['borders']['top']['style'] = PHPExcel_Style_Border::BORDER_THIN;
|
$styleData['borders']['top']['style'] = \PHPExcel\Style\Border::BORDER_THIN;
|
||||||
break;
|
break;
|
||||||
case 'B':
|
case 'B':
|
||||||
$styleData['borders']['bottom']['style'] = PHPExcel_Style_Border::BORDER_THIN;
|
$styleData['borders']['bottom']['style'] = \PHPExcel\Style\Border::BORDER_THIN;
|
||||||
break;
|
break;
|
||||||
case 'L':
|
case 'L':
|
||||||
$styleData['borders']['left']['style'] = PHPExcel_Style_Border::BORDER_THIN;
|
$styleData['borders']['left']['style'] = \PHPExcel\Style\Border::BORDER_THIN;
|
||||||
break;
|
break;
|
||||||
case 'R':
|
case 'R':
|
||||||
$styleData['borders']['right']['style'] = PHPExcel_Style_Border::BORDER_THIN;
|
$styleData['borders']['right']['style'] = \PHPExcel\Style\Border::BORDER_THIN;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -402,22 +402,22 @@ class SYLK extends BaseReader implements IReader
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (($formatStyle > '') && ($column > '') && ($row > '')) {
|
if (($formatStyle > '') && ($column > '') && ($row > '')) {
|
||||||
$columnLetter = PHPExcel_Cell::stringFromColumnIndex($column-1);
|
$columnLetter = \PHPExcel\Cell::stringFromColumnIndex($column-1);
|
||||||
if (isset($this->formats[$formatStyle])) {
|
if (isset($this->formats[$formatStyle])) {
|
||||||
$objPHPExcel->getActiveSheet()->getStyle($columnLetter.$row)->applyFromArray($this->formats[$formatStyle]);
|
$objPHPExcel->getActiveSheet()->getStyle($columnLetter.$row)->applyFromArray($this->formats[$formatStyle]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ((!empty($styleData)) && ($column > '') && ($row > '')) {
|
if ((!empty($styleData)) && ($column > '') && ($row > '')) {
|
||||||
$columnLetter = PHPExcel_Cell::stringFromColumnIndex($column-1);
|
$columnLetter = \PHPExcel\Cell::stringFromColumnIndex($column-1);
|
||||||
$objPHPExcel->getActiveSheet()->getStyle($columnLetter.$row)->applyFromArray($styleData);
|
$objPHPExcel->getActiveSheet()->getStyle($columnLetter.$row)->applyFromArray($styleData);
|
||||||
}
|
}
|
||||||
if ($columnWidth > '') {
|
if ($columnWidth > '') {
|
||||||
if ($startCol == $endCol) {
|
if ($startCol == $endCol) {
|
||||||
$startCol = PHPExcel_Cell::stringFromColumnIndex($startCol-1);
|
$startCol = \PHPExcel\Cell::stringFromColumnIndex($startCol-1);
|
||||||
$objPHPExcel->getActiveSheet()->getColumnDimension($startCol)->setWidth($columnWidth);
|
$objPHPExcel->getActiveSheet()->getColumnDimension($startCol)->setWidth($columnWidth);
|
||||||
} else {
|
} else {
|
||||||
$startCol = PHPExcel_Cell::stringFromColumnIndex($startCol-1);
|
$startCol = \PHPExcel\Cell::stringFromColumnIndex($startCol-1);
|
||||||
$endCol = PHPExcel_Cell::stringFromColumnIndex($endCol-1);
|
$endCol = \PHPExcel\Cell::stringFromColumnIndex($endCol-1);
|
||||||
$objPHPExcel->getActiveSheet()->getColumnDimension($startCol)->setWidth($columnWidth);
|
$objPHPExcel->getActiveSheet()->getColumnDimension($startCol)->setWidth($columnWidth);
|
||||||
do {
|
do {
|
||||||
$objPHPExcel->getActiveSheet()->getColumnDimension(++$startCol)->setWidth($columnWidth);
|
$objPHPExcel->getActiveSheet()->getColumnDimension(++$startCol)->setWidth($columnWidth);
|
||||||
|
@ -461,7 +461,7 @@ class SYLK extends BaseReader implements IReader
|
||||||
* Set sheet index
|
* Set sheet index
|
||||||
*
|
*
|
||||||
* @param int $pValue Sheet index
|
* @param int $pValue Sheet index
|
||||||
* @return PHPExcel_Reader_SYLK
|
* @return SYLK
|
||||||
*/
|
*/
|
||||||
public function setSheetIndex($pValue = 0)
|
public function setSheetIndex($pValue = 0)
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
namespace PHPExcel\Writer\PDF;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* PHPExcel_Writer_PDF_Core
|
* PHPExcel_Writer_PDF_Core
|
||||||
*
|
*
|
||||||
|
@ -25,7 +27,7 @@
|
||||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||||
* @version ##VERSION##, ##DATE##
|
* @version ##VERSION##, ##DATE##
|
||||||
*/
|
*/
|
||||||
abstract class PHPExcel_Writer_PDF_Core extends PHPExcel_Writer_HTML
|
abstract class Core extends \PHPExcel\Writer\HTML
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Temporary storage directory
|
* Temporary storage directory
|
||||||
|
@ -204,11 +206,11 @@ abstract class PHPExcel_Writer_PDF_Core extends PHPExcel_Writer_HTML
|
||||||
);
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new PHPExcel_Writer_PDF
|
* Create a new PDF Writer instance
|
||||||
*
|
*
|
||||||
* @param PHPExcel $phpExcel PHPExcel object
|
* @param Spreadsheet $phpExcel Spreadsheet object
|
||||||
*/
|
*/
|
||||||
public function __construct(PHPExcel $phpExcel)
|
public function __construct(Spreadsheet $phpExcel)
|
||||||
{
|
{
|
||||||
parent::__construct($phpExcel);
|
parent::__construct($phpExcel);
|
||||||
$this->setUseInlineCss(true);
|
$this->setUseInlineCss(true);
|
||||||
|
@ -312,7 +314,7 @@ abstract class PHPExcel_Writer_PDF_Core extends PHPExcel_Writer_HTML
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Save PHPExcel to PDF file, pre-save
|
* Save Spreadsheet to PDF file, pre-save
|
||||||
*
|
*
|
||||||
* @param string $pFilename Name of the file to save as
|
* @param string $pFilename Name of the file to save as
|
||||||
* @throws PHPExcel_Writer_Exception
|
* @throws PHPExcel_Writer_Exception
|
||||||
|
|
|
@ -1,11 +1,13 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
namespace PHPExcel\Writer\PDF;
|
||||||
|
|
||||||
/** Require DomPDF library */
|
/** Require DomPDF library */
|
||||||
$pdfRendererClassFile = PHPExcel_Settings::getPdfRendererPath() . '/dompdf_config.inc.php';
|
$pdfRendererClassFile = \PHPExcel\Settings::getPdfRendererPath() . '/dompdf_config.inc.php';
|
||||||
if (file_exists($pdfRendererClassFile)) {
|
if (file_exists($pdfRendererClassFile)) {
|
||||||
require_once $pdfRendererClassFile;
|
require_once $pdfRendererClassFile;
|
||||||
} else {
|
} else {
|
||||||
throw new PHPExcel_Writer_Exception('Unable to load PDF Rendering library');
|
throw new \PHPExcel\Writer\Exception('Unable to load PDF Rendering library');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -33,20 +35,20 @@ if (file_exists($pdfRendererClassFile)) {
|
||||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||||
* @version ##VERSION##, ##DATE##
|
* @version ##VERSION##, ##DATE##
|
||||||
*/
|
*/
|
||||||
class PHPExcel_Writer_PDF_DomPDF extends PHPExcel_Writer_PDF_Core implements PHPExcel_Writer_IWriter
|
class DomPDF extends Core implements \PHPExcel\Writer\IWriter
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Create a new PHPExcel_Writer_PDF
|
* Create a new DomPDF Writer instance
|
||||||
*
|
*
|
||||||
* @param PHPExcel $phpExcel PHPExcel object
|
* @param Spreadsheet $phpExcel Spreadsheet object
|
||||||
*/
|
*/
|
||||||
public function __construct(PHPExcel $phpExcel)
|
public function __construct(Spreadsheet $phpExcel)
|
||||||
{
|
{
|
||||||
parent::__construct($phpExcel);
|
parent::__construct($phpExcel);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Save PHPExcel to file
|
* Save Spreadsheet to file
|
||||||
*
|
*
|
||||||
* @param string $pFilename Name of the file to save as
|
* @param string $pFilename Name of the file to save as
|
||||||
* @throws PHPExcel_Writer_Exception
|
* @throws PHPExcel_Writer_Exception
|
||||||
|
|
|
@ -1,11 +1,13 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
namespace PHPExcel\Writer\PDF;
|
||||||
|
|
||||||
/** Require mPDF library */
|
/** Require mPDF library */
|
||||||
$pdfRendererClassFile = PHPExcel_Settings::getPdfRendererPath() . '/mpdf.php';
|
$pdfRendererClassFile = \PHPExcel\Settings::getPdfRendererPath() . '/mpdf.php';
|
||||||
if (file_exists($pdfRendererClassFile)) {
|
if (file_exists($pdfRendererClassFile)) {
|
||||||
require_once $pdfRendererClassFile;
|
require_once $pdfRendererClassFile;
|
||||||
} else {
|
} else {
|
||||||
throw new PHPExcel_Writer_Exception('Unable to load PDF Rendering library');
|
throw new \PHPExcel\Writer\Exception('Unable to load PDF Rendering library');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -33,20 +35,20 @@ if (file_exists($pdfRendererClassFile)) {
|
||||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||||
* @version ##VERSION##, ##DATE##
|
* @version ##VERSION##, ##DATE##
|
||||||
*/
|
*/
|
||||||
class PHPExcel_Writer_PDF_mPDF extends PHPExcel_Writer_PDF_Core implements PHPExcel_Writer_IWriter
|
class mPDF extends Core implements \PHPExcel\Writer\IWriter
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Create a new PHPExcel_Writer_PDF
|
* Create a mPDF Writer instance
|
||||||
*
|
*
|
||||||
* @param PHPExcel $phpExcel PHPExcel object
|
* @param Spreadsheet $phpExcel Spreadsheet object
|
||||||
*/
|
*/
|
||||||
public function __construct(PHPExcel $phpExcel)
|
public function __construct(Spreadsheet $phpExcel)
|
||||||
{
|
{
|
||||||
parent::__construct($phpExcel);
|
parent::__construct($phpExcel);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Save PHPExcel to file
|
* Save Spreadsheet to file
|
||||||
*
|
*
|
||||||
* @param string $pFilename Name of the file to save as
|
* @param string $pFilename Name of the file to save as
|
||||||
* @throws PHPExcel_Writer_Exception
|
* @throws PHPExcel_Writer_Exception
|
||||||
|
|
|
@ -1,12 +1,14 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
namespace PHPExcel\Writer\PDF;
|
||||||
|
|
||||||
/** Require tcPDF library */
|
/** Require tcPDF library */
|
||||||
$pdfRendererClassFile = PHPExcel_Settings::getPdfRendererPath() . '/tcpdf.php';
|
$pdfRendererClassFile = \PHPExcel\Settings::getPdfRendererPath() . '/tcpdf.php';
|
||||||
if (file_exists($pdfRendererClassFile)) {
|
if (file_exists($pdfRendererClassFile)) {
|
||||||
$k_path_url = PHPExcel_Settings::getPdfRendererPath();
|
$k_path_url = \PHPExcel\Settings::getPdfRendererPath();
|
||||||
require_once $pdfRendererClassFile;
|
require_once $pdfRendererClassFile;
|
||||||
} else {
|
} else {
|
||||||
throw new PHPExcel_Writer_Exception('Unable to load PDF Rendering library');
|
throw new \PHPExcel\Writer\Exception('Unable to load PDF Rendering library');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -34,20 +36,20 @@ if (file_exists($pdfRendererClassFile)) {
|
||||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||||
* @version ##VERSION##, ##DATE##
|
* @version ##VERSION##, ##DATE##
|
||||||
*/
|
*/
|
||||||
class PHPExcel_Writer_PDF_tcPDF extends PHPExcel_Writer_PDF_Core implements PHPExcel_Writer_IWriter
|
class tcPDF extends Core implements \PHPExcel\Writer\IWriter
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Create a new PHPExcel_Writer_PDF
|
* Create a new tcPDF Writer instance
|
||||||
*
|
*
|
||||||
* @param PHPExcel $phpExcel PHPExcel object
|
* @param Spreadsheet $phpExcel Spreadsheet object
|
||||||
*/
|
*/
|
||||||
public function __construct(PHPExcel $phpExcel)
|
public function __construct(Spreadsheet $phpExcel)
|
||||||
{
|
{
|
||||||
parent::__construct($phpExcel);
|
parent::__construct($phpExcel);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Save PHPExcel to file
|
* Save Spreadsheet to file
|
||||||
*
|
*
|
||||||
* @param string $pFilename Name of the file to save as
|
* @param string $pFilename Name of the file to save as
|
||||||
* @throws PHPExcel_Writer_Exception
|
* @throws PHPExcel_Writer_Exception
|
||||||
|
|
Loading…
Reference in New Issue