PSR-2 : Fixes
This commit is contained in:
parent
5bb747f8cc
commit
f37630e938
|
@ -48,7 +48,8 @@ abstract class PHPExcel_Writer_Excel2007_WriterPart
|
|||
* @param PHPExcel_Writer_IWriter $pWriter
|
||||
* @throws PHPExcel_Writer_Exception
|
||||
*/
|
||||
public function setParentWriter(PHPExcel_Writer_IWriter $pWriter = null) {
|
||||
public function setParentWriter(PHPExcel_Writer_IWriter $pWriter = null)
|
||||
{
|
||||
$this->_parentWriter = $pWriter;
|
||||
}
|
||||
|
||||
|
@ -58,7 +59,8 @@ abstract class PHPExcel_Writer_Excel2007_WriterPart
|
|||
* @return PHPExcel_Writer_IWriter
|
||||
* @throws PHPExcel_Writer_Exception
|
||||
*/
|
||||
public function getParentWriter() {
|
||||
public function getParentWriter()
|
||||
{
|
||||
if (!is_null($this->_parentWriter)) {
|
||||
return $this->_parentWriter;
|
||||
} else {
|
||||
|
@ -72,10 +74,10 @@ abstract class PHPExcel_Writer_Excel2007_WriterPart
|
|||
* @param PHPExcel_Writer_IWriter $pWriter
|
||||
* @throws PHPExcel_Writer_Exception
|
||||
*/
|
||||
public function __construct(PHPExcel_Writer_IWriter $pWriter = null) {
|
||||
public function __construct(PHPExcel_Writer_IWriter $pWriter = null)
|
||||
{
|
||||
if (!is_null($pWriter)) {
|
||||
$this->_parentWriter = $pWriter;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -95,7 +95,8 @@ class PHPExcel_Writer_Excel5 extends PHPExcel_Writer_Abstract implements PHPExce
|
|||
*
|
||||
* @param PHPExcel $phpExcel PHPExcel object
|
||||
*/
|
||||
public function __construct(PHPExcel $phpExcel) {
|
||||
public function __construct(PHPExcel $phpExcel)
|
||||
{
|
||||
$this->_phpExcel = $phpExcel;
|
||||
|
||||
$this->_parser = new PHPExcel_Writer_Excel5_Parser();
|
||||
|
@ -107,13 +108,14 @@ class PHPExcel_Writer_Excel5 extends PHPExcel_Writer_Abstract implements PHPExce
|
|||
* @param string $pFilename
|
||||
* @throws PHPExcel_Writer_Exception
|
||||
*/
|
||||
public function save($pFilename = null) {
|
||||
public function save($pFilename = null)
|
||||
{
|
||||
|
||||
// garbage collect
|
||||
$this->_phpExcel->garbageCollect();
|
||||
|
||||
$saveDebugLog = PHPExcel_Calculation::getInstance($this->_phpExcel)->getDebugLog()->getWriteDebugLog();
|
||||
PHPExcel_Calculation::getInstance($this->_phpExcel)->getDebugLog()->setWriteDebugLog(FALSE);
|
||||
PHPExcel_Calculation::getInstance($this->_phpExcel)->getDebugLog()->setWriteDebugLog(false);
|
||||
$saveDateReturnType = PHPExcel_Calculation_Functions::getReturnDateType();
|
||||
PHPExcel_Calculation_Functions::setReturnDateType(PHPExcel_Calculation_Functions::RETURNDATE_EXCEL);
|
||||
|
||||
|
@ -121,18 +123,12 @@ class PHPExcel_Writer_Excel5 extends PHPExcel_Writer_Abstract implements PHPExce
|
|||
$this->_colors = array();
|
||||
|
||||
// Initialise workbook writer
|
||||
$this->_writerWorkbook = new PHPExcel_Writer_Excel5_Workbook($this->_phpExcel,
|
||||
$this->_str_total, $this->_str_unique, $this->_str_table,
|
||||
$this->_colors, $this->_parser);
|
||||
$this->_writerWorkbook = new PHPExcel_Writer_Excel5_Workbook($this->_phpExcel, $this->_str_total, $this->_str_unique, $this->_str_table, $this->_colors, $this->_parser);
|
||||
|
||||
// Initialise worksheet writers
|
||||
$countSheets = $this->_phpExcel->getSheetCount();
|
||||
for ($i = 0; $i < $countSheets; ++$i) {
|
||||
$this->_writerWorksheets[$i] = new PHPExcel_Writer_Excel5_Worksheet($this->_str_total, $this->_str_unique,
|
||||
$this->_str_table, $this->_colors,
|
||||
$this->_parser,
|
||||
$this->_preCalculateFormulas,
|
||||
$this->_phpExcel->getSheet($i));
|
||||
$this->_writerWorksheets[$i] = new PHPExcel_Writer_Excel5_Worksheet($this->_str_total, $this->_str_unique, $this->_str_table, $this->_colors, $this->_parser, $this->_preCalculateFormulas, $this->_phpExcel->getSheet($i));
|
||||
}
|
||||
|
||||
// build Escher objects. Escher objects for workbooks needs to be build before Escher object for workbook.
|
||||
|
@ -190,26 +186,26 @@ class PHPExcel_Writer_Excel5 extends PHPExcel_Writer_Abstract implements PHPExce
|
|||
|
||||
$this->_documentSummaryInformation = $this->_writeDocumentSummaryInformation();
|
||||
// initialize OLE Document Summary Information
|
||||
if(isset($this->_documentSummaryInformation) && !empty($this->_documentSummaryInformation)){
|
||||
if (isset($this->_documentSummaryInformation) && !empty($this->_documentSummaryInformation)) {
|
||||
$OLE_DocumentSummaryInformation = new PHPExcel_Shared_OLE_PPS_File(PHPExcel_Shared_OLE::Asc2Ucs(chr(5) . 'DocumentSummaryInformation'));
|
||||
$OLE_DocumentSummaryInformation->append($this->_documentSummaryInformation);
|
||||
}
|
||||
|
||||
$this->_summaryInformation = $this->_writeSummaryInformation();
|
||||
// initialize OLE Summary Information
|
||||
if(isset($this->_summaryInformation) && !empty($this->_summaryInformation)){
|
||||
$OLE_SummaryInformation = new PHPExcel_Shared_OLE_PPS_File(PHPExcel_Shared_OLE::Asc2Ucs(chr(5) . 'SummaryInformation'));
|
||||
$OLE_SummaryInformation->append($this->_summaryInformation);
|
||||
if (isset($this->_summaryInformation) && !empty($this->_summaryInformation)) {
|
||||
$OLE_SummaryInformation = new PHPExcel_Shared_OLE_PPS_File(PHPExcel_Shared_OLE::Asc2Ucs(chr(5) . 'SummaryInformation'));
|
||||
$OLE_SummaryInformation->append($this->_summaryInformation);
|
||||
}
|
||||
|
||||
// define OLE Parts
|
||||
$arrRootData = array($OLE);
|
||||
// initialize OLE Properties file
|
||||
if(isset($OLE_SummaryInformation)){
|
||||
if (isset($OLE_SummaryInformation)) {
|
||||
$arrRootData[] = $OLE_SummaryInformation;
|
||||
}
|
||||
// initialize OLE Extended Properties file
|
||||
if(isset($OLE_DocumentSummaryInformation)){
|
||||
if (isset($OLE_DocumentSummaryInformation)) {
|
||||
$arrRootData[] = $OLE_DocumentSummaryInformation;
|
||||
}
|
||||
|
||||
|
@ -229,7 +225,8 @@ class PHPExcel_Writer_Excel5 extends PHPExcel_Writer_Abstract implements PHPExce
|
|||
* @throws PHPExcel_Writer_Exception when directory does not exist
|
||||
* @return PHPExcel_Writer_Excel5
|
||||
*/
|
||||
public function setTempDir($pValue = '') {
|
||||
public function setTempDir($pValue = '')
|
||||
{
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
@ -330,13 +327,13 @@ class PHPExcel_Writer_Excel5 extends PHPExcel_Writer_Abstract implements PHPExce
|
|||
}
|
||||
|
||||
// AutoFilters
|
||||
if(!empty($filterRange)){
|
||||
if (!empty($filterRange)) {
|
||||
$rangeBounds = PHPExcel_Cell::rangeBoundaries($filterRange);
|
||||
$iNumColStart = $rangeBounds[0][0];
|
||||
$iNumColEnd = $rangeBounds[1][0];
|
||||
|
||||
$iInc = $iNumColStart;
|
||||
while($iInc <= $iNumColEnd){
|
||||
while($iInc <= $iNumColEnd) {
|
||||
++$countShapes[$sheetIndex];
|
||||
|
||||
// create an Drawing Object for the dropdown
|
||||
|
@ -444,8 +441,7 @@ class PHPExcel_Writer_Excel5 extends PHPExcel_Writer_Abstract implements PHPExce
|
|||
++$sheetCountShapes;
|
||||
++$totalCountShapes;
|
||||
|
||||
$spId = $sheetCountShapes
|
||||
| ($this->_phpExcel->getIndex($sheet) + 1) << 10;
|
||||
$spId = $sheetCountShapes | ($this->_phpExcel->getIndex($sheet) + 1) << 10;
|
||||
$spIdMax = max($spId, $spIdMax);
|
||||
}
|
||||
}
|
||||
|
@ -463,41 +459,35 @@ class PHPExcel_Writer_Excel5 extends PHPExcel_Writer_Abstract implements PHPExce
|
|||
foreach ($this->_phpExcel->getAllsheets() as $sheet) {
|
||||
foreach ($sheet->getDrawingCollection() as $drawing) {
|
||||
if ($drawing instanceof PHPExcel_Worksheet_Drawing) {
|
||||
|
||||
$filename = $drawing->getPath();
|
||||
|
||||
list($imagesx, $imagesy, $imageFormat) = getimagesize($filename);
|
||||
|
||||
switch ($imageFormat) {
|
||||
|
||||
case 1: // GIF, not supported by BIFF8, we convert to PNG
|
||||
$blipType = PHPExcel_Shared_Escher_DggContainer_BstoreContainer_BSE::BLIPTYPE_PNG;
|
||||
ob_start();
|
||||
imagepng(imagecreatefromgif($filename));
|
||||
$blipData = ob_get_contents();
|
||||
ob_end_clean();
|
||||
break;
|
||||
|
||||
case 2: // JPEG
|
||||
$blipType = PHPExcel_Shared_Escher_DggContainer_BstoreContainer_BSE::BLIPTYPE_JPEG;
|
||||
$blipData = file_get_contents($filename);
|
||||
break;
|
||||
|
||||
case 3: // PNG
|
||||
$blipType = PHPExcel_Shared_Escher_DggContainer_BstoreContainer_BSE::BLIPTYPE_PNG;
|
||||
$blipData = file_get_contents($filename);
|
||||
break;
|
||||
|
||||
case 6: // Windows DIB (BMP), we convert to PNG
|
||||
$blipType = PHPExcel_Shared_Escher_DggContainer_BstoreContainer_BSE::BLIPTYPE_PNG;
|
||||
ob_start();
|
||||
imagepng(PHPExcel_Shared_Drawing::imagecreatefrombmp($filename));
|
||||
$blipData = ob_get_contents();
|
||||
ob_end_clean();
|
||||
break;
|
||||
|
||||
default: continue 2;
|
||||
|
||||
case 1: // GIF, not supported by BIFF8, we convert to PNG
|
||||
$blipType = PHPExcel_Shared_Escher_DggContainer_BstoreContainer_BSE::BLIPTYPE_PNG;
|
||||
ob_start();
|
||||
imagepng(imagecreatefromgif ($filename));
|
||||
$blipData = ob_get_contents();
|
||||
ob_end_clean();
|
||||
break;
|
||||
case 2: // JPEG
|
||||
$blipType = PHPExcel_Shared_Escher_DggContainer_BstoreContainer_BSE::BLIPTYPE_JPEG;
|
||||
$blipData = file_get_contents($filename);
|
||||
break;
|
||||
case 3: // PNG
|
||||
$blipType = PHPExcel_Shared_Escher_DggContainer_BstoreContainer_BSE::BLIPTYPE_PNG;
|
||||
$blipData = file_get_contents($filename);
|
||||
break;
|
||||
case 6: // Windows DIB (BMP), we convert to PNG
|
||||
$blipType = PHPExcel_Shared_Escher_DggContainer_BstoreContainer_BSE::BLIPTYPE_PNG;
|
||||
ob_start();
|
||||
imagepng(PHPExcel_Shared_Drawing::imagecreatefrombmp($filename));
|
||||
$blipData = ob_get_contents();
|
||||
ob_end_clean();
|
||||
break;
|
||||
default:
|
||||
continue 2;
|
||||
}
|
||||
|
||||
$blip = new PHPExcel_Shared_Escher_DggContainer_BstoreContainer_BSE_Blip();
|
||||
|
@ -508,23 +498,18 @@ class PHPExcel_Writer_Excel5 extends PHPExcel_Writer_Abstract implements PHPExce
|
|||
$BSE->setBlip($blip);
|
||||
|
||||
$bstoreContainer->addBSE($BSE);
|
||||
|
||||
} else if ($drawing instanceof PHPExcel_Worksheet_MemoryDrawing) {
|
||||
|
||||
switch ($drawing->getRenderingFunction()) {
|
||||
|
||||
case PHPExcel_Worksheet_MemoryDrawing::RENDERING_JPEG:
|
||||
$blipType = PHPExcel_Shared_Escher_DggContainer_BstoreContainer_BSE::BLIPTYPE_JPEG;
|
||||
$renderingFunction = 'imagejpeg';
|
||||
break;
|
||||
|
||||
case PHPExcel_Worksheet_MemoryDrawing::RENDERING_GIF:
|
||||
case PHPExcel_Worksheet_MemoryDrawing::RENDERING_PNG:
|
||||
case PHPExcel_Worksheet_MemoryDrawing::RENDERING_DEFAULT:
|
||||
$blipType = PHPExcel_Shared_Escher_DggContainer_BstoreContainer_BSE::BLIPTYPE_PNG;
|
||||
$renderingFunction = 'imagepng';
|
||||
break;
|
||||
|
||||
case PHPExcel_Worksheet_MemoryDrawing::RENDERING_JPEG:
|
||||
$blipType = PHPExcel_Shared_Escher_DggContainer_BstoreContainer_BSE::BLIPTYPE_JPEG;
|
||||
$renderingFunction = 'imagejpeg';
|
||||
break;
|
||||
case PHPExcel_Worksheet_MemoryDrawing::RENDERING_GIF:
|
||||
case PHPExcel_Worksheet_MemoryDrawing::RENDERING_PNG:
|
||||
case PHPExcel_Worksheet_MemoryDrawing::RENDERING_DEFAULT:
|
||||
$blipType = PHPExcel_Shared_Escher_DggContainer_BstoreContainer_BSE::BLIPTYPE_PNG;
|
||||
$renderingFunction = 'imagepng';
|
||||
break;
|
||||
}
|
||||
|
||||
ob_start();
|
||||
|
@ -552,8 +537,8 @@ class PHPExcel_Writer_Excel5 extends PHPExcel_Writer_Abstract implements PHPExce
|
|||
* Build the OLE Part for DocumentSummary Information
|
||||
* @return string
|
||||
*/
|
||||
private function _writeDocumentSummaryInformation(){
|
||||
|
||||
private function _writeDocumentSummaryInformation()
|
||||
{
|
||||
// offset: 0; size: 2; must be 0xFE 0xFF (UTF-16 LE byte order mark)
|
||||
$data = pack('v', 0xFFFE);
|
||||
// offset: 2; size: 2;
|
||||
|
@ -586,7 +571,7 @@ class PHPExcel_Writer_Excel5 extends PHPExcel_Writer_Abstract implements PHPExce
|
|||
$dataSection_NumProps++;
|
||||
|
||||
// GKPIDDSI_CATEGORY : Category
|
||||
if($this->_phpExcel->getProperties()->getCategory()){
|
||||
if ($this->_phpExcel->getProperties()->getCategory()) {
|
||||
$dataProp = $this->_phpExcel->getProperties()->getCategory();
|
||||
$dataSection[] = array('summary'=> array('pack' => 'V', 'data' => 0x02),
|
||||
'offset' => array('pack' => 'V'),
|
||||
|
@ -682,7 +667,7 @@ class PHPExcel_Writer_Excel5 extends PHPExcel_Writer_Abstract implements PHPExce
|
|||
// 4 Property count
|
||||
// 8 * $dataSection_NumProps (8 = ID (4) + OffSet(4))
|
||||
$dataSection_Content_Offset = 8 + $dataSection_NumProps * 8;
|
||||
foreach ($dataSection as $dataProp){
|
||||
foreach ($dataSection as $dataProp) {
|
||||
// Summary
|
||||
$dataSection_Summary .= pack($dataProp['summary']['pack'], $dataProp['summary']['data']);
|
||||
// Offset
|
||||
|
@ -690,25 +675,25 @@ class PHPExcel_Writer_Excel5 extends PHPExcel_Writer_Abstract implements PHPExce
|
|||
// DataType
|
||||
$dataSection_Content .= pack($dataProp['type']['pack'], $dataProp['type']['data']);
|
||||
// Data
|
||||
if($dataProp['type']['data'] == 0x02){ // 2 byte signed integer
|
||||
if ($dataProp['type']['data'] == 0x02) { // 2 byte signed integer
|
||||
$dataSection_Content .= pack('V', $dataProp['data']['data']);
|
||||
|
||||
$dataSection_Content_Offset += 4 + 4;
|
||||
}
|
||||
elseif($dataProp['type']['data'] == 0x03){ // 4 byte signed integer
|
||||
elseif ($dataProp['type']['data'] == 0x03) { // 4 byte signed integer
|
||||
$dataSection_Content .= pack('V', $dataProp['data']['data']);
|
||||
|
||||
$dataSection_Content_Offset += 4 + 4;
|
||||
}
|
||||
elseif($dataProp['type']['data'] == 0x0B){ // Boolean
|
||||
if($dataProp['data']['data'] == false){
|
||||
elseif ($dataProp['type']['data'] == 0x0B) { // Boolean
|
||||
if ($dataProp['data']['data'] == false) {
|
||||
$dataSection_Content .= pack('V', 0x0000);
|
||||
} else {
|
||||
$dataSection_Content .= pack('V', 0x0001);
|
||||
}
|
||||
$dataSection_Content_Offset += 4 + 4;
|
||||
}
|
||||
elseif($dataProp['type']['data'] == 0x1E){ // null-terminated string prepended by dword string length
|
||||
elseif ($dataProp['type']['data'] == 0x1E) { // null-terminated string prepended by dword string length
|
||||
// Null-terminated string
|
||||
$dataProp['data']['data'] .= chr(0);
|
||||
$dataProp['data']['length'] += 1;
|
||||
|
@ -721,7 +706,7 @@ class PHPExcel_Writer_Excel5 extends PHPExcel_Writer_Abstract implements PHPExce
|
|||
|
||||
$dataSection_Content_Offset += 4 + 4 + strlen($dataProp['data']['data']);
|
||||
}
|
||||
elseif($dataProp['type']['data'] == 0x40){ // Filetime (64-bit value representing the number of 100-nanosecond intervals since January 1, 1601)
|
||||
elseif ($dataProp['type']['data'] == 0x40) { // Filetime (64-bit value representing the number of 100-nanosecond intervals since January 1, 1601)
|
||||
$dataSection_Content .= $dataProp['data']['data'];
|
||||
|
||||
$dataSection_Content_Offset += 4 + 8;
|
||||
|
@ -753,7 +738,8 @@ class PHPExcel_Writer_Excel5 extends PHPExcel_Writer_Abstract implements PHPExce
|
|||
* Build the OLE Part for Summary Information
|
||||
* @return string
|
||||
*/
|
||||
private function _writeSummaryInformation(){
|
||||
private function _writeSummaryInformation()
|
||||
{
|
||||
// offset: 0; size: 2; must be 0xFE 0xFF (UTF-16 LE byte order mark)
|
||||
$data = pack('v', 0xFFFE);
|
||||
// offset: 2; size: 2;
|
||||
|
@ -786,7 +772,7 @@ class PHPExcel_Writer_Excel5 extends PHPExcel_Writer_Abstract implements PHPExce
|
|||
$dataSection_NumProps++;
|
||||
|
||||
// Title
|
||||
if($this->_phpExcel->getProperties()->getTitle()){
|
||||
if ($this->_phpExcel->getProperties()->getTitle()) {
|
||||
$dataProp = $this->_phpExcel->getProperties()->getTitle();
|
||||
$dataSection[] = array('summary'=> array('pack' => 'V', 'data' => 0x02),
|
||||
'offset' => array('pack' => 'V'),
|
||||
|
@ -795,7 +781,7 @@ class PHPExcel_Writer_Excel5 extends PHPExcel_Writer_Abstract implements PHPExce
|
|||
$dataSection_NumProps++;
|
||||
}
|
||||
// Subject
|
||||
if($this->_phpExcel->getProperties()->getSubject()){
|
||||
if ($this->_phpExcel->getProperties()->getSubject()) {
|
||||
$dataProp = $this->_phpExcel->getProperties()->getSubject();
|
||||
$dataSection[] = array('summary'=> array('pack' => 'V', 'data' => 0x03),
|
||||
'offset' => array('pack' => 'V'),
|
||||
|
@ -804,7 +790,7 @@ class PHPExcel_Writer_Excel5 extends PHPExcel_Writer_Abstract implements PHPExce
|
|||
$dataSection_NumProps++;
|
||||
}
|
||||
// Author (Creator)
|
||||
if($this->_phpExcel->getProperties()->getCreator()){
|
||||
if ($this->_phpExcel->getProperties()->getCreator()) {
|
||||
$dataProp = $this->_phpExcel->getProperties()->getCreator();
|
||||
$dataSection[] = array('summary'=> array('pack' => 'V', 'data' => 0x04),
|
||||
'offset' => array('pack' => 'V'),
|
||||
|
@ -813,7 +799,7 @@ class PHPExcel_Writer_Excel5 extends PHPExcel_Writer_Abstract implements PHPExce
|
|||
$dataSection_NumProps++;
|
||||
}
|
||||
// Keywords
|
||||
if($this->_phpExcel->getProperties()->getKeywords()){
|
||||
if ($this->_phpExcel->getProperties()->getKeywords()) {
|
||||
$dataProp = $this->_phpExcel->getProperties()->getKeywords();
|
||||
$dataSection[] = array('summary'=> array('pack' => 'V', 'data' => 0x05),
|
||||
'offset' => array('pack' => 'V'),
|
||||
|
@ -822,7 +808,7 @@ class PHPExcel_Writer_Excel5 extends PHPExcel_Writer_Abstract implements PHPExce
|
|||
$dataSection_NumProps++;
|
||||
}
|
||||
// Comments (Description)
|
||||
if($this->_phpExcel->getProperties()->getDescription()){
|
||||
if ($this->_phpExcel->getProperties()->getDescription()) {
|
||||
$dataProp = $this->_phpExcel->getProperties()->getDescription();
|
||||
$dataSection[] = array('summary'=> array('pack' => 'V', 'data' => 0x06),
|
||||
'offset' => array('pack' => 'V'),
|
||||
|
@ -831,7 +817,7 @@ class PHPExcel_Writer_Excel5 extends PHPExcel_Writer_Abstract implements PHPExce
|
|||
$dataSection_NumProps++;
|
||||
}
|
||||
// Last Saved By (LastModifiedBy)
|
||||
if($this->_phpExcel->getProperties()->getLastModifiedBy()){
|
||||
if ($this->_phpExcel->getProperties()->getLastModifiedBy()) {
|
||||
$dataProp = $this->_phpExcel->getProperties()->getLastModifiedBy();
|
||||
$dataSection[] = array('summary'=> array('pack' => 'V', 'data' => 0x08),
|
||||
'offset' => array('pack' => 'V'),
|
||||
|
@ -840,7 +826,7 @@ class PHPExcel_Writer_Excel5 extends PHPExcel_Writer_Abstract implements PHPExce
|
|||
$dataSection_NumProps++;
|
||||
}
|
||||
// Created Date/Time
|
||||
if($this->_phpExcel->getProperties()->getCreated()){
|
||||
if ($this->_phpExcel->getProperties()->getCreated()) {
|
||||
$dataProp = $this->_phpExcel->getProperties()->getCreated();
|
||||
$dataSection[] = array('summary'=> array('pack' => 'V', 'data' => 0x0C),
|
||||
'offset' => array('pack' => 'V'),
|
||||
|
@ -849,7 +835,7 @@ class PHPExcel_Writer_Excel5 extends PHPExcel_Writer_Abstract implements PHPExce
|
|||
$dataSection_NumProps++;
|
||||
}
|
||||
// Modified Date/Time
|
||||
if($this->_phpExcel->getProperties()->getModified()){
|
||||
if ($this->_phpExcel->getProperties()->getModified()) {
|
||||
$dataProp = $this->_phpExcel->getProperties()->getModified();
|
||||
$dataSection[] = array('summary'=> array('pack' => 'V', 'data' => 0x0D),
|
||||
'offset' => array('pack' => 'V'),
|
||||
|
@ -869,7 +855,7 @@ class PHPExcel_Writer_Excel5 extends PHPExcel_Writer_Abstract implements PHPExce
|
|||
// 4 Property count
|
||||
// 8 * $dataSection_NumProps (8 = ID (4) + OffSet(4))
|
||||
$dataSection_Content_Offset = 8 + $dataSection_NumProps * 8;
|
||||
foreach ($dataSection as $dataProp){
|
||||
foreach ($dataSection as $dataProp) {
|
||||
// Summary
|
||||
$dataSection_Summary .= pack($dataProp['summary']['pack'], $dataProp['summary']['data']);
|
||||
// Offset
|
||||
|
@ -877,17 +863,17 @@ class PHPExcel_Writer_Excel5 extends PHPExcel_Writer_Abstract implements PHPExce
|
|||
// DataType
|
||||
$dataSection_Content .= pack($dataProp['type']['pack'], $dataProp['type']['data']);
|
||||
// Data
|
||||
if($dataProp['type']['data'] == 0x02){ // 2 byte signed integer
|
||||
if ($dataProp['type']['data'] == 0x02) { // 2 byte signed integer
|
||||
$dataSection_Content .= pack('V', $dataProp['data']['data']);
|
||||
|
||||
$dataSection_Content_Offset += 4 + 4;
|
||||
}
|
||||
elseif($dataProp['type']['data'] == 0x03){ // 4 byte signed integer
|
||||
elseif ($dataProp['type']['data'] == 0x03) { // 4 byte signed integer
|
||||
$dataSection_Content .= pack('V', $dataProp['data']['data']);
|
||||
|
||||
$dataSection_Content_Offset += 4 + 4;
|
||||
}
|
||||
elseif($dataProp['type']['data'] == 0x1E){ // null-terminated string prepended by dword string length
|
||||
elseif ($dataProp['type']['data'] == 0x1E) { // null-terminated string prepended by dword string length
|
||||
// Null-terminated string
|
||||
$dataProp['data']['data'] .= chr(0);
|
||||
$dataProp['data']['length'] += 1;
|
||||
|
@ -900,7 +886,7 @@ class PHPExcel_Writer_Excel5 extends PHPExcel_Writer_Abstract implements PHPExce
|
|||
|
||||
$dataSection_Content_Offset += 4 + 4 + strlen($dataProp['data']['data']);
|
||||
}
|
||||
elseif($dataProp['type']['data'] == 0x40){ // Filetime (64-bit value representing the number of 100-nanosecond intervals since January 1, 1601)
|
||||
elseif ($dataProp['type']['data'] == 0x40) { // Filetime (64-bit value representing the number of 100-nanosecond intervals since January 1, 1601)
|
||||
$dataSection_Content .= $dataProp['data']['data'];
|
||||
|
||||
$dataSection_Content_Offset += 4 + 8;
|
||||
|
|
|
@ -118,7 +118,7 @@ class PHPExcel_Writer_Excel5_BIFFwriter
|
|||
$number = pack("C8", 0x8D, 0x97, 0x6E, 0x12, 0x83, 0xC0, 0xF3, 0x3F);
|
||||
if ($number == $teststr) {
|
||||
$byte_order = 0; // Little Endian
|
||||
} elseif ($number == strrev($teststr)){
|
||||
} elseif ($number == strrev($teststr)) {
|
||||
$byte_order = 1; // Big Endian
|
||||
} else {
|
||||
// Give up. I'll fix this in a later version.
|
||||
|
@ -136,7 +136,7 @@ class PHPExcel_Writer_Excel5_BIFFwriter
|
|||
* @param string $data binary data to append
|
||||
* @access private
|
||||
*/
|
||||
function _append($data)
|
||||
private function _append($data)
|
||||
{
|
||||
if (strlen($data) - 4 > $this->_limit) {
|
||||
$data = $this->_addContinue($data);
|
||||
|
@ -169,7 +169,7 @@ class PHPExcel_Writer_Excel5_BIFFwriter
|
|||
* 0x0010 Worksheet.
|
||||
* @access private
|
||||
*/
|
||||
function _storeBof($type)
|
||||
private function _storeBof($type)
|
||||
{
|
||||
$record = 0x0809; // Record identifier (BIFF5-BIFF8)
|
||||
$length = 0x0010;
|
||||
|
@ -182,7 +182,7 @@ class PHPExcel_Writer_Excel5_BIFFwriter
|
|||
|
||||
$version = 0x0600; // BIFF8
|
||||
|
||||
$header = pack("vv", $record, $length);
|
||||
$header = pack("vv", $record, $length);
|
||||
$data = pack("vvvv", $version, $type, $build, $year);
|
||||
$this->_append($header . $data . $unknown);
|
||||
}
|
||||
|
@ -192,7 +192,7 @@ class PHPExcel_Writer_Excel5_BIFFwriter
|
|||
*
|
||||
* @access private
|
||||
*/
|
||||
function _storeEof()
|
||||
private function _storeEof()
|
||||
{
|
||||
$record = 0x000A; // Record identifier
|
||||
$length = 0x0000; // Number of bytes to follow
|
||||
|
@ -226,7 +226,7 @@ class PHPExcel_Writer_Excel5_BIFFwriter
|
|||
* @return string A very convenient string of continue blocks
|
||||
* @access private
|
||||
*/
|
||||
function _addContinue($data)
|
||||
private function _addContinue($data)
|
||||
{
|
||||
$limit = $this->_limit;
|
||||
$record = 0x003C; // Record identifier
|
||||
|
@ -251,5 +251,4 @@ class PHPExcel_Writer_Excel5_BIFFwriter
|
|||
|
||||
return $tmp;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -78,436 +78,423 @@ class PHPExcel_Writer_Excel5_Escher
|
|||
$this->_data = '';
|
||||
|
||||
switch (get_class($this->_object)) {
|
||||
case 'PHPExcel_Shared_Escher':
|
||||
if ($dggContainer = $this->_object->getDggContainer()) {
|
||||
$writer = new PHPExcel_Writer_Excel5_Escher($dggContainer);
|
||||
$this->_data = $writer->close();
|
||||
} else if ($dgContainer = $this->_object->getDgContainer()) {
|
||||
$writer = new PHPExcel_Writer_Excel5_Escher($dgContainer);
|
||||
$this->_data = $writer->close();
|
||||
$this->_spOffsets = $writer->getSpOffsets();
|
||||
$this->_spTypes = $writer->getSpTypes();
|
||||
}
|
||||
break;
|
||||
case 'PHPExcel_Shared_Escher_DggContainer':
|
||||
// this is a container record
|
||||
|
||||
case 'PHPExcel_Shared_Escher':
|
||||
if ($dggContainer = $this->_object->getDggContainer()) {
|
||||
$writer = new PHPExcel_Writer_Excel5_Escher($dggContainer);
|
||||
$this->_data = $writer->close();
|
||||
} else if ($dgContainer = $this->_object->getDgContainer()) {
|
||||
$writer = new PHPExcel_Writer_Excel5_Escher($dgContainer);
|
||||
$this->_data = $writer->close();
|
||||
$this->_spOffsets = $writer->getSpOffsets();
|
||||
$this->_spTypes = $writer->getSpTypes();
|
||||
}
|
||||
break;
|
||||
// initialize
|
||||
$innerData = '';
|
||||
|
||||
case 'PHPExcel_Shared_Escher_DggContainer':
|
||||
// this is a container record
|
||||
// write the dgg
|
||||
$recVer = 0x0;
|
||||
$recInstance = 0x0000;
|
||||
$recType = 0xF006;
|
||||
|
||||
// initialize
|
||||
$innerData = '';
|
||||
$recVerInstance = $recVer;
|
||||
$recVerInstance |= $recInstance << 4;
|
||||
|
||||
// write the dgg
|
||||
$recVer = 0x0;
|
||||
$recInstance = 0x0000;
|
||||
$recType = 0xF006;
|
||||
// dgg data
|
||||
$dggData =
|
||||
pack('VVVV',
|
||||
$this->_object->getSpIdMax(), // maximum shape identifier increased by one
|
||||
$this->_object->getCDgSaved() + 1, // number of file identifier clusters increased by one
|
||||
$this->_object->getCSpSaved(),
|
||||
$this->_object->getCDgSaved() // count total number of drawings saved
|
||||
);
|
||||
|
||||
$recVerInstance = $recVer;
|
||||
$recVerInstance |= $recInstance << 4;
|
||||
// add file identifier clusters (one per drawing)
|
||||
$IDCLs = $this->_object->getIDCLs();
|
||||
|
||||
// dgg data
|
||||
$dggData =
|
||||
pack('VVVV'
|
||||
, $this->_object->getSpIdMax() // maximum shape identifier increased by one
|
||||
, $this->_object->getCDgSaved() + 1 // number of file identifier clusters increased by one
|
||||
, $this->_object->getCSpSaved()
|
||||
, $this->_object->getCDgSaved() // count total number of drawings saved
|
||||
);
|
||||
foreach ($IDCLs as $dgId => $maxReducedSpId) {
|
||||
$dggData .= pack('VV', $dgId, $maxReducedSpId + 1);
|
||||
}
|
||||
|
||||
// add file identifier clusters (one per drawing)
|
||||
$IDCLs = $this->_object->getIDCLs();
|
||||
$header = pack('vvV', $recVerInstance, $recType, strlen($dggData));
|
||||
$innerData .= $header . $dggData;
|
||||
|
||||
foreach ($IDCLs as $dgId => $maxReducedSpId) {
|
||||
$dggData .= pack('VV', $dgId, $maxReducedSpId + 1);
|
||||
}
|
||||
|
||||
$header = pack('vvV', $recVerInstance, $recType, strlen($dggData));
|
||||
$innerData .= $header . $dggData;
|
||||
|
||||
// write the bstoreContainer
|
||||
if ($bstoreContainer = $this->_object->getBstoreContainer()) {
|
||||
$writer = new PHPExcel_Writer_Excel5_Escher($bstoreContainer);
|
||||
$innerData .= $writer->close();
|
||||
}
|
||||
|
||||
// write the record
|
||||
$recVer = 0xF;
|
||||
$recInstance = 0x0000;
|
||||
$recType = 0xF000;
|
||||
$length = strlen($innerData);
|
||||
|
||||
$recVerInstance = $recVer;
|
||||
$recVerInstance |= $recInstance << 4;
|
||||
|
||||
$header = pack('vvV', $recVerInstance, $recType, $length);
|
||||
|
||||
$this->_data = $header . $innerData;
|
||||
break;
|
||||
|
||||
case 'PHPExcel_Shared_Escher_DggContainer_BstoreContainer':
|
||||
// this is a container record
|
||||
|
||||
// initialize
|
||||
$innerData = '';
|
||||
|
||||
// treat the inner data
|
||||
if ($BSECollection = $this->_object->getBSECollection()) {
|
||||
foreach ($BSECollection as $BSE) {
|
||||
$writer = new PHPExcel_Writer_Excel5_Escher($BSE);
|
||||
// write the bstoreContainer
|
||||
if ($bstoreContainer = $this->_object->getBstoreContainer()) {
|
||||
$writer = new PHPExcel_Writer_Excel5_Escher($bstoreContainer);
|
||||
$innerData .= $writer->close();
|
||||
}
|
||||
}
|
||||
|
||||
// write the record
|
||||
$recVer = 0xF;
|
||||
$recInstance = count($this->_object->getBSECollection());
|
||||
$recType = 0xF001;
|
||||
$length = strlen($innerData);
|
||||
|
||||
$recVerInstance = $recVer;
|
||||
$recVerInstance |= $recInstance << 4;
|
||||
|
||||
$header = pack('vvV', $recVerInstance, $recType, $length);
|
||||
|
||||
$this->_data = $header . $innerData;
|
||||
break;
|
||||
|
||||
case 'PHPExcel_Shared_Escher_DggContainer_BstoreContainer_BSE':
|
||||
// this is a semi-container record
|
||||
|
||||
// initialize
|
||||
$innerData = '';
|
||||
|
||||
// here we treat the inner data
|
||||
if ($blip = $this->_object->getBlip()) {
|
||||
$writer = new PHPExcel_Writer_Excel5_Escher($blip);
|
||||
$innerData .= $writer->close();
|
||||
}
|
||||
|
||||
// initialize
|
||||
$data = '';
|
||||
|
||||
$btWin32 = $this->_object->getBlipType();
|
||||
$btMacOS = $this->_object->getBlipType();
|
||||
$data .= pack('CC', $btWin32, $btMacOS);
|
||||
|
||||
$rgbUid = pack('VVVV', 0,0,0,0); // todo
|
||||
$data .= $rgbUid;
|
||||
|
||||
$tag = 0;
|
||||
$size = strlen($innerData);
|
||||
$cRef = 1;
|
||||
$foDelay = 0; //todo
|
||||
$unused1 = 0x0;
|
||||
$cbName = 0x0;
|
||||
$unused2 = 0x0;
|
||||
$unused3 = 0x0;
|
||||
$data .= pack('vVVVCCCC', $tag, $size, $cRef, $foDelay, $unused1, $cbName, $unused2, $unused3);
|
||||
|
||||
$data .= $innerData;
|
||||
|
||||
// write the record
|
||||
$recVer = 0x2;
|
||||
$recInstance = $this->_object->getBlipType();
|
||||
$recType = 0xF007;
|
||||
$length = strlen($data);
|
||||
|
||||
$recVerInstance = $recVer;
|
||||
$recVerInstance |= $recInstance << 4;
|
||||
|
||||
$header = pack('vvV', $recVerInstance, $recType, $length);
|
||||
|
||||
$this->_data = $header;
|
||||
|
||||
$this->_data .= $data;
|
||||
break;
|
||||
|
||||
case 'PHPExcel_Shared_Escher_DggContainer_BstoreContainer_BSE_Blip':
|
||||
// this is an atom record
|
||||
|
||||
// write the record
|
||||
switch ($this->_object->getParent()->getBlipType()) {
|
||||
|
||||
case PHPExcel_Shared_Escher_DggContainer_BstoreContainer_BSE::BLIPTYPE_JPEG:
|
||||
// initialize
|
||||
$innerData = '';
|
||||
|
||||
$rgbUid1 = pack('VVVV', 0,0,0,0); // todo
|
||||
$innerData .= $rgbUid1;
|
||||
|
||||
$tag = 0xFF; // todo
|
||||
$innerData .= pack('C', $tag);
|
||||
|
||||
$innerData .= $this->_object->getData();
|
||||
|
||||
$recVer = 0x0;
|
||||
$recInstance = 0x46A;
|
||||
$recType = 0xF01D;
|
||||
// write the record
|
||||
$recVer = 0xF;
|
||||
$recInstance = 0x0000;
|
||||
$recType = 0xF000;
|
||||
$length = strlen($innerData);
|
||||
|
||||
$recVerInstance = $recVer;
|
||||
$recVerInstance |= $recInstance << 4;
|
||||
$recVerInstance |= $recInstance << 4;
|
||||
|
||||
$header = pack('vvV', $recVerInstance, $recType, $length);
|
||||
|
||||
$this->_data = $header;
|
||||
|
||||
$this->_data .= $innerData;
|
||||
$this->_data = $header . $innerData;
|
||||
break;
|
||||
case 'PHPExcel_Shared_Escher_DggContainer_BstoreContainer':
|
||||
// this is a container record
|
||||
|
||||
case PHPExcel_Shared_Escher_DggContainer_BstoreContainer_BSE::BLIPTYPE_PNG:
|
||||
// initialize
|
||||
$innerData = '';
|
||||
|
||||
$rgbUid1 = pack('VVVV', 0,0,0,0); // todo
|
||||
$innerData .= $rgbUid1;
|
||||
|
||||
$tag = 0xFF; // todo
|
||||
$innerData .= pack('C', $tag);
|
||||
|
||||
$innerData .= $this->_object->getData();
|
||||
|
||||
$recVer = 0x0;
|
||||
$recInstance = 0x6E0;
|
||||
$recType = 0xF01E;
|
||||
$length = strlen($innerData);
|
||||
|
||||
$recVerInstance = $recVer;
|
||||
$recVerInstance |= $recInstance << 4;
|
||||
|
||||
$header = pack('vvV', $recVerInstance, $recType, $length);
|
||||
|
||||
$this->_data = $header;
|
||||
|
||||
$this->_data .= $innerData;
|
||||
break;
|
||||
|
||||
}
|
||||
break;
|
||||
|
||||
case 'PHPExcel_Shared_Escher_DgContainer':
|
||||
// this is a container record
|
||||
|
||||
// initialize
|
||||
$innerData = '';
|
||||
|
||||
// write the dg
|
||||
$recVer = 0x0;
|
||||
$recInstance = $this->_object->getDgId();
|
||||
$recType = 0xF008;
|
||||
$length = 8;
|
||||
|
||||
$recVerInstance = $recVer;
|
||||
$recVerInstance |= $recInstance << 4;
|
||||
|
||||
$header = pack('vvV', $recVerInstance, $recType, $length);
|
||||
|
||||
// number of shapes in this drawing (including group shape)
|
||||
$countShapes = count($this->_object->getSpgrContainer()->getChildren());
|
||||
$innerData .= $header . pack('VV', $countShapes, $this->_object->getLastSpId());
|
||||
//$innerData .= $header . pack('VV', 0, 0);
|
||||
|
||||
// write the spgrContainer
|
||||
if ($spgrContainer = $this->_object->getSpgrContainer()) {
|
||||
$writer = new PHPExcel_Writer_Excel5_Escher($spgrContainer);
|
||||
$innerData .= $writer->close();
|
||||
|
||||
// get the shape offsets relative to the spgrContainer record
|
||||
$spOffsets = $writer->getSpOffsets();
|
||||
$spTypes = $writer->getSpTypes();
|
||||
|
||||
// save the shape offsets relative to dgContainer
|
||||
foreach ($spOffsets as & $spOffset) {
|
||||
$spOffset += 24; // add length of dgContainer header data (8 bytes) plus dg data (16 bytes)
|
||||
// treat the inner data
|
||||
if ($BSECollection = $this->_object->getBSECollection()) {
|
||||
foreach ($BSECollection as $BSE) {
|
||||
$writer = new PHPExcel_Writer_Excel5_Escher($BSE);
|
||||
$innerData .= $writer->close();
|
||||
}
|
||||
}
|
||||
|
||||
// write the record
|
||||
$recVer = 0xF;
|
||||
$recInstance = count($this->_object->getBSECollection());
|
||||
$recType = 0xF001;
|
||||
$length = strlen($innerData);
|
||||
|
||||
$recVerInstance = $recVer;
|
||||
$recVerInstance |= $recInstance << 4;
|
||||
|
||||
$header = pack('vvV', $recVerInstance, $recType, $length);
|
||||
|
||||
$this->_data = $header . $innerData;
|
||||
break;
|
||||
case 'PHPExcel_Shared_Escher_DggContainer_BstoreContainer_BSE':
|
||||
// this is a semi-container record
|
||||
|
||||
// initialize
|
||||
$innerData = '';
|
||||
|
||||
// here we treat the inner data
|
||||
if ($blip = $this->_object->getBlip()) {
|
||||
$writer = new PHPExcel_Writer_Excel5_Escher($blip);
|
||||
$innerData .= $writer->close();
|
||||
}
|
||||
|
||||
// initialize
|
||||
$data = '';
|
||||
|
||||
$btWin32 = $this->_object->getBlipType();
|
||||
$btMacOS = $this->_object->getBlipType();
|
||||
$data .= pack('CC', $btWin32, $btMacOS);
|
||||
|
||||
$rgbUid = pack('VVVV', 0,0,0,0); // todo
|
||||
$data .= $rgbUid;
|
||||
|
||||
$tag = 0;
|
||||
$size = strlen($innerData);
|
||||
$cRef = 1;
|
||||
$foDelay = 0; //todo
|
||||
$unused1 = 0x0;
|
||||
$cbName = 0x0;
|
||||
$unused2 = 0x0;
|
||||
$unused3 = 0x0;
|
||||
$data .= pack('vVVVCCCC', $tag, $size, $cRef, $foDelay, $unused1, $cbName, $unused2, $unused3);
|
||||
|
||||
$data .= $innerData;
|
||||
|
||||
// write the record
|
||||
$recVer = 0x2;
|
||||
$recInstance = $this->_object->getBlipType();
|
||||
$recType = 0xF007;
|
||||
$length = strlen($data);
|
||||
|
||||
$recVerInstance = $recVer;
|
||||
$recVerInstance |= $recInstance << 4;
|
||||
|
||||
$header = pack('vvV', $recVerInstance, $recType, $length);
|
||||
|
||||
$this->_data = $header;
|
||||
|
||||
$this->_data .= $data;
|
||||
break;
|
||||
case 'PHPExcel_Shared_Escher_DggContainer_BstoreContainer_BSE_Blip':
|
||||
// this is an atom record
|
||||
|
||||
// write the record
|
||||
switch ($this->_object->getParent()->getBlipType()) {
|
||||
case PHPExcel_Shared_Escher_DggContainer_BstoreContainer_BSE::BLIPTYPE_JPEG:
|
||||
// initialize
|
||||
$innerData = '';
|
||||
|
||||
$rgbUid1 = pack('VVVV', 0,0,0,0); // todo
|
||||
$innerData .= $rgbUid1;
|
||||
|
||||
$tag = 0xFF; // todo
|
||||
$innerData .= pack('C', $tag);
|
||||
|
||||
$innerData .= $this->_object->getData();
|
||||
|
||||
$recVer = 0x0;
|
||||
$recInstance = 0x46A;
|
||||
$recType = 0xF01D;
|
||||
$length = strlen($innerData);
|
||||
|
||||
$recVerInstance = $recVer;
|
||||
$recVerInstance |= $recInstance << 4;
|
||||
|
||||
$header = pack('vvV', $recVerInstance, $recType, $length);
|
||||
|
||||
$this->_data = $header;
|
||||
|
||||
$this->_data .= $innerData;
|
||||
break;
|
||||
|
||||
case PHPExcel_Shared_Escher_DggContainer_BstoreContainer_BSE::BLIPTYPE_PNG:
|
||||
// initialize
|
||||
$innerData = '';
|
||||
|
||||
$rgbUid1 = pack('VVVV', 0,0,0,0); // todo
|
||||
$innerData .= $rgbUid1;
|
||||
|
||||
$tag = 0xFF; // todo
|
||||
$innerData .= pack('C', $tag);
|
||||
|
||||
$innerData .= $this->_object->getData();
|
||||
|
||||
$recVer = 0x0;
|
||||
$recInstance = 0x6E0;
|
||||
$recType = 0xF01E;
|
||||
$length = strlen($innerData);
|
||||
|
||||
$recVerInstance = $recVer;
|
||||
$recVerInstance |= $recInstance << 4;
|
||||
|
||||
$header = pack('vvV', $recVerInstance, $recType, $length);
|
||||
|
||||
$this->_data = $header;
|
||||
|
||||
$this->_data .= $innerData;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case 'PHPExcel_Shared_Escher_DgContainer':
|
||||
// this is a container record
|
||||
|
||||
// initialize
|
||||
$innerData = '';
|
||||
|
||||
// write the dg
|
||||
$recVer = 0x0;
|
||||
$recInstance = $this->_object->getDgId();
|
||||
$recType = 0xF008;
|
||||
$length = 8;
|
||||
|
||||
$recVerInstance = $recVer;
|
||||
$recVerInstance |= $recInstance << 4;
|
||||
|
||||
$header = pack('vvV', $recVerInstance, $recType, $length);
|
||||
|
||||
// number of shapes in this drawing (including group shape)
|
||||
$countShapes = count($this->_object->getSpgrContainer()->getChildren());
|
||||
$innerData .= $header . pack('VV', $countShapes, $this->_object->getLastSpId());
|
||||
//$innerData .= $header . pack('VV', 0, 0);
|
||||
|
||||
// write the spgrContainer
|
||||
if ($spgrContainer = $this->_object->getSpgrContainer()) {
|
||||
$writer = new PHPExcel_Writer_Excel5_Escher($spgrContainer);
|
||||
$innerData .= $writer->close();
|
||||
|
||||
// get the shape offsets relative to the spgrContainer record
|
||||
$spOffsets = $writer->getSpOffsets();
|
||||
$spTypes = $writer->getSpTypes();
|
||||
|
||||
// save the shape offsets relative to dgContainer
|
||||
foreach ($spOffsets as & $spOffset) {
|
||||
$spOffset += 24; // add length of dgContainer header data (8 bytes) plus dg data (16 bytes)
|
||||
}
|
||||
|
||||
$this->_spOffsets = $spOffsets;
|
||||
$this->_spTypes = $spTypes;
|
||||
}
|
||||
|
||||
// write the record
|
||||
$recVer = 0xF;
|
||||
$recInstance = 0x0000;
|
||||
$recType = 0xF002;
|
||||
$length = strlen($innerData);
|
||||
|
||||
$recVerInstance = $recVer;
|
||||
$recVerInstance |= $recInstance << 4;
|
||||
|
||||
$header = pack('vvV', $recVerInstance, $recType, $length);
|
||||
|
||||
$this->_data = $header . $innerData;
|
||||
break;
|
||||
case 'PHPExcel_Shared_Escher_DgContainer_SpgrContainer':
|
||||
// this is a container record
|
||||
|
||||
// initialize
|
||||
$innerData = '';
|
||||
|
||||
// initialize spape offsets
|
||||
$totalSize = 8;
|
||||
$spOffsets = array();
|
||||
$spTypes = array();
|
||||
|
||||
// treat the inner data
|
||||
foreach ($this->_object->getChildren() as $spContainer) {
|
||||
$writer = new PHPExcel_Writer_Excel5_Escher($spContainer);
|
||||
$spData = $writer->close();
|
||||
$innerData .= $spData;
|
||||
|
||||
// save the shape offsets (where new shape records begin)
|
||||
$totalSize += strlen($spData);
|
||||
$spOffsets[] = $totalSize;
|
||||
|
||||
$spTypes = array_merge($spTypes, $writer->getSpTypes());
|
||||
}
|
||||
|
||||
// write the record
|
||||
$recVer = 0xF;
|
||||
$recInstance = 0x0000;
|
||||
$recType = 0xF003;
|
||||
$length = strlen($innerData);
|
||||
|
||||
$recVerInstance = $recVer;
|
||||
$recVerInstance |= $recInstance << 4;
|
||||
|
||||
$header = pack('vvV', $recVerInstance, $recType, $length);
|
||||
|
||||
$this->_data = $header . $innerData;
|
||||
$this->_spOffsets = $spOffsets;
|
||||
$this->_spTypes = $spTypes;
|
||||
}
|
||||
break;
|
||||
case 'PHPExcel_Shared_Escher_DgContainer_SpgrContainer_SpContainer':
|
||||
// initialize
|
||||
$data = '';
|
||||
|
||||
// write the record
|
||||
$recVer = 0xF;
|
||||
$recInstance = 0x0000;
|
||||
$recType = 0xF002;
|
||||
$length = strlen($innerData);
|
||||
// build the data
|
||||
|
||||
$recVerInstance = $recVer;
|
||||
$recVerInstance |= $recInstance << 4;
|
||||
// write group shape record, if necessary?
|
||||
if ($this->_object->getSpgr()) {
|
||||
$recVer = 0x1;
|
||||
$recInstance = 0x0000;
|
||||
$recType = 0xF009;
|
||||
$length = 0x00000010;
|
||||
|
||||
$header = pack('vvV', $recVerInstance, $recType, $length);
|
||||
$recVerInstance = $recVer;
|
||||
$recVerInstance |= $recInstance << 4;
|
||||
|
||||
$this->_data = $header . $innerData;
|
||||
break;
|
||||
$header = pack('vvV', $recVerInstance, $recType, $length);
|
||||
|
||||
case 'PHPExcel_Shared_Escher_DgContainer_SpgrContainer':
|
||||
// this is a container record
|
||||
|
||||
// initialize
|
||||
$innerData = '';
|
||||
|
||||
// initialize spape offsets
|
||||
$totalSize = 8;
|
||||
$spOffsets = array();
|
||||
$spTypes = array();
|
||||
|
||||
// treat the inner data
|
||||
foreach ($this->_object->getChildren() as $spContainer) {
|
||||
$writer = new PHPExcel_Writer_Excel5_Escher($spContainer);
|
||||
$spData = $writer->close();
|
||||
$innerData .= $spData;
|
||||
|
||||
// save the shape offsets (where new shape records begin)
|
||||
$totalSize += strlen($spData);
|
||||
$spOffsets[] = $totalSize;
|
||||
|
||||
$spTypes = array_merge($spTypes, $writer->getSpTypes());
|
||||
}
|
||||
|
||||
// write the record
|
||||
$recVer = 0xF;
|
||||
$recInstance = 0x0000;
|
||||
$recType = 0xF003;
|
||||
$length = strlen($innerData);
|
||||
|
||||
$recVerInstance = $recVer;
|
||||
$recVerInstance |= $recInstance << 4;
|
||||
|
||||
$header = pack('vvV', $recVerInstance, $recType, $length);
|
||||
|
||||
$this->_data = $header . $innerData;
|
||||
$this->_spOffsets = $spOffsets;
|
||||
$this->_spTypes = $spTypes;
|
||||
break;
|
||||
|
||||
case 'PHPExcel_Shared_Escher_DgContainer_SpgrContainer_SpContainer':
|
||||
// initialize
|
||||
$data = '';
|
||||
|
||||
// build the data
|
||||
|
||||
// write group shape record, if necessary?
|
||||
if ($this->_object->getSpgr()) {
|
||||
$recVer = 0x1;
|
||||
$recInstance = 0x0000;
|
||||
$recType = 0xF009;
|
||||
$length = 0x00000010;
|
||||
|
||||
$recVerInstance = $recVer;
|
||||
$recVerInstance |= $recInstance << 4;
|
||||
|
||||
$header = pack('vvV', $recVerInstance, $recType, $length);
|
||||
|
||||
$data .= $header . pack('VVVV', 0,0,0,0);
|
||||
}
|
||||
$this->_spTypes[] = ($this->_object->getSpType());
|
||||
|
||||
// write the shape record
|
||||
$recVer = 0x2;
|
||||
$recInstance = $this->_object->getSpType(); // shape type
|
||||
$recType = 0xF00A;
|
||||
$length = 0x00000008;
|
||||
|
||||
$recVerInstance = $recVer;
|
||||
$recVerInstance |= $recInstance << 4;
|
||||
|
||||
$header = pack('vvV', $recVerInstance, $recType, $length);
|
||||
|
||||
$data .= $header . pack('VV', $this->_object->getSpId(), $this->_object->getSpgr() ? 0x0005 : 0x0A00);
|
||||
|
||||
|
||||
// the options
|
||||
if ($this->_object->getOPTCollection()) {
|
||||
$optData = '';
|
||||
|
||||
$recVer = 0x3;
|
||||
$recInstance = count($this->_object->getOPTCollection());
|
||||
$recType = 0xF00B;
|
||||
foreach ($this->_object->getOPTCollection() as $property => $value) {
|
||||
$optData .= pack('vV', $property, $value);
|
||||
$data .= $header . pack('VVVV', 0,0,0,0);
|
||||
}
|
||||
$length = strlen($optData);
|
||||
$this->_spTypes[] = ($this->_object->getSpType());
|
||||
|
||||
// write the shape record
|
||||
$recVer = 0x2;
|
||||
$recInstance = $this->_object->getSpType(); // shape type
|
||||
$recType = 0xF00A;
|
||||
$length = 0x00000008;
|
||||
|
||||
$recVerInstance = $recVer;
|
||||
$recVerInstance |= $recInstance << 4;
|
||||
|
||||
$header = pack('vvV', $recVerInstance, $recType, $length);
|
||||
$data .= $header . $optData;
|
||||
}
|
||||
|
||||
// the client anchor
|
||||
if ($this->_object->getStartCoordinates()) {
|
||||
$clientAnchorData = '';
|
||||
$data .= $header . pack('VV', $this->_object->getSpId(), $this->_object->getSpgr() ? 0x0005 : 0x0A00);
|
||||
|
||||
$recVer = 0x0;
|
||||
$recInstance = 0x0;
|
||||
$recType = 0xF010;
|
||||
|
||||
// start coordinates
|
||||
list($column, $row) = PHPExcel_Cell::coordinateFromString($this->_object->getStartCoordinates());
|
||||
$c1 = PHPExcel_Cell::columnIndexFromString($column) - 1;
|
||||
$r1 = $row - 1;
|
||||
// the options
|
||||
if ($this->_object->getOPTCollection()) {
|
||||
$optData = '';
|
||||
|
||||
// start offsetX
|
||||
$startOffsetX = $this->_object->getStartOffsetX();
|
||||
$recVer = 0x3;
|
||||
$recInstance = count($this->_object->getOPTCollection());
|
||||
$recType = 0xF00B;
|
||||
foreach ($this->_object->getOPTCollection() as $property => $value) {
|
||||
$optData .= pack('vV', $property, $value);
|
||||
}
|
||||
$length = strlen($optData);
|
||||
|
||||
// start offsetY
|
||||
$startOffsetY = $this->_object->getStartOffsetY();
|
||||
$recVerInstance = $recVer;
|
||||
$recVerInstance |= $recInstance << 4;
|
||||
|
||||
// end coordinates
|
||||
list($column, $row) = PHPExcel_Cell::coordinateFromString($this->_object->getEndCoordinates());
|
||||
$c2 = PHPExcel_Cell::columnIndexFromString($column) - 1;
|
||||
$r2 = $row - 1;
|
||||
$header = pack('vvV', $recVerInstance, $recType, $length);
|
||||
$data .= $header . $optData;
|
||||
}
|
||||
|
||||
// end offsetX
|
||||
$endOffsetX = $this->_object->getEndOffsetX();
|
||||
// the client anchor
|
||||
if ($this->_object->getStartCoordinates()) {
|
||||
$clientAnchorData = '';
|
||||
|
||||
// end offsetY
|
||||
$endOffsetY = $this->_object->getEndOffsetY();
|
||||
$recVer = 0x0;
|
||||
$recInstance = 0x0;
|
||||
$recType = 0xF010;
|
||||
|
||||
$clientAnchorData = pack('vvvvvvvvv', $this->_object->getSpFlag(),
|
||||
$c1, $startOffsetX, $r1, $startOffsetY,
|
||||
$c2, $endOffsetX, $r2, $endOffsetY);
|
||||
// start coordinates
|
||||
list($column, $row) = PHPExcel_Cell::coordinateFromString($this->_object->getStartCoordinates());
|
||||
$c1 = PHPExcel_Cell::columnIndexFromString($column) - 1;
|
||||
$r1 = $row - 1;
|
||||
|
||||
$length = strlen($clientAnchorData);
|
||||
// start offsetX
|
||||
$startOffsetX = $this->_object->getStartOffsetX();
|
||||
|
||||
// start offsetY
|
||||
$startOffsetY = $this->_object->getStartOffsetY();
|
||||
|
||||
// end coordinates
|
||||
list($column, $row) = PHPExcel_Cell::coordinateFromString($this->_object->getEndCoordinates());
|
||||
$c2 = PHPExcel_Cell::columnIndexFromString($column) - 1;
|
||||
$r2 = $row - 1;
|
||||
|
||||
// end offsetX
|
||||
$endOffsetX = $this->_object->getEndOffsetX();
|
||||
|
||||
// end offsetY
|
||||
$endOffsetY = $this->_object->getEndOffsetY();
|
||||
|
||||
$clientAnchorData = pack('vvvvvvvvv', $this->_object->getSpFlag(), $c1, $startOffsetX, $r1, $startOffsetY, $c2, $endOffsetX, $r2, $endOffsetY);
|
||||
|
||||
$length = strlen($clientAnchorData);
|
||||
|
||||
$recVerInstance = $recVer;
|
||||
$recVerInstance |= $recInstance << 4;
|
||||
|
||||
$header = pack('vvV', $recVerInstance, $recType, $length);
|
||||
$data .= $header . $clientAnchorData;
|
||||
}
|
||||
|
||||
// the client data, just empty for now
|
||||
if (!$this->_object->getSpgr()) {
|
||||
$clientDataData = '';
|
||||
|
||||
$recVer = 0x0;
|
||||
$recInstance = 0x0;
|
||||
$recType = 0xF011;
|
||||
|
||||
$length = strlen($clientDataData);
|
||||
|
||||
$recVerInstance = $recVer;
|
||||
$recVerInstance |= $recInstance << 4;
|
||||
|
||||
$header = pack('vvV', $recVerInstance, $recType, $length);
|
||||
$data .= $header . $clientDataData;
|
||||
}
|
||||
|
||||
// write the record
|
||||
$recVer = 0xF;
|
||||
$recInstance = 0x0000;
|
||||
$recType = 0xF004;
|
||||
$length = strlen($data);
|
||||
|
||||
$recVerInstance = $recVer;
|
||||
$recVerInstance |= $recInstance << 4;
|
||||
|
||||
$header = pack('vvV', $recVerInstance, $recType, $length);
|
||||
$data .= $header . $clientAnchorData;
|
||||
}
|
||||
|
||||
// the client data, just empty for now
|
||||
if (!$this->_object->getSpgr()) {
|
||||
$clientDataData = '';
|
||||
|
||||
$recVer = 0x0;
|
||||
$recInstance = 0x0;
|
||||
$recType = 0xF011;
|
||||
|
||||
$length = strlen($clientDataData);
|
||||
|
||||
$recVerInstance = $recVer;
|
||||
$recVerInstance |= $recInstance << 4;
|
||||
|
||||
$header = pack('vvV', $recVerInstance, $recType, $length);
|
||||
$data .= $header . $clientDataData;
|
||||
}
|
||||
|
||||
// write the record
|
||||
$recVer = 0xF;
|
||||
$recInstance = 0x0000;
|
||||
$recType = 0xF004;
|
||||
$length = strlen($data);
|
||||
|
||||
$recVerInstance = $recVer;
|
||||
$recVerInstance |= $recInstance << 4;
|
||||
|
||||
$header = pack('vvV', $recVerInstance, $recType, $length);
|
||||
|
||||
$this->_data = $header . $data;
|
||||
break;
|
||||
|
||||
$this->_data = $header . $data;
|
||||
break;
|
||||
}
|
||||
|
||||
return $this->_data;
|
||||
|
@ -532,6 +519,4 @@ class PHPExcel_Writer_Excel5_Escher
|
|||
{
|
||||
return $this->_spTypes;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -107,12 +107,17 @@ class PHPExcel_Writer_Excel5_Font
|
|||
$grbit |= 0x20;
|
||||
}
|
||||
|
||||
$data = pack("vvvvvCCCC",
|
||||
$this->_font->getSize() * 20, // Fontsize (in twips)
|
||||
$data = pack(
|
||||
"vvvvvCCCC",
|
||||
// Fontsize (in twips)
|
||||
$this->_font->getSize() * 20,
|
||||
$grbit,
|
||||
$icv, // Colour
|
||||
self::_mapBold($this->_font->getBold()), // Font weight
|
||||
$sss, // Superscript/Subscript
|
||||
// Colour
|
||||
$icv,
|
||||
// Font weight
|
||||
self::_mapBold($this->_font->getBold()),
|
||||
// Superscript/Subscript
|
||||
$sss,
|
||||
self::_mapUnderline($this->_font->getUnderline()),
|
||||
$bFamily,
|
||||
$bCharSet,
|
||||
|
@ -132,7 +137,8 @@ class PHPExcel_Writer_Excel5_Font
|
|||
* @param boolean $bold
|
||||
* @return int
|
||||
*/
|
||||
private static function _mapBold($bold) {
|
||||
private static function _mapBold($bold)
|
||||
{
|
||||
if ($bold) {
|
||||
return 0x2BC; // 700 = Bold font weight
|
||||
}
|
||||
|
@ -144,22 +150,24 @@ class PHPExcel_Writer_Excel5_Font
|
|||
* @static array of int
|
||||
*
|
||||
*/
|
||||
private static $_mapUnderline = array( PHPExcel_Style_Font::UNDERLINE_NONE => 0x00,
|
||||
PHPExcel_Style_Font::UNDERLINE_SINGLE => 0x01,
|
||||
PHPExcel_Style_Font::UNDERLINE_DOUBLE => 0x02,
|
||||
PHPExcel_Style_Font::UNDERLINE_SINGLEACCOUNTING => 0x21,
|
||||
PHPExcel_Style_Font::UNDERLINE_DOUBLEACCOUNTING => 0x22,
|
||||
);
|
||||
private static $_mapUnderline = array(
|
||||
PHPExcel_Style_Font::UNDERLINE_NONE => 0x00,
|
||||
PHPExcel_Style_Font::UNDERLINE_SINGLE => 0x01,
|
||||
PHPExcel_Style_Font::UNDERLINE_DOUBLE => 0x02,
|
||||
PHPExcel_Style_Font::UNDERLINE_SINGLEACCOUNTING => 0x21,
|
||||
PHPExcel_Style_Font::UNDERLINE_DOUBLEACCOUNTING => 0x22,
|
||||
);
|
||||
/**
|
||||
* Map underline
|
||||
*
|
||||
* @param string
|
||||
* @return int
|
||||
*/
|
||||
private static function _mapUnderline($underline) {
|
||||
if (isset(self::$_mapUnderline[$underline]))
|
||||
private static function _mapUnderline($underline)
|
||||
{
|
||||
if (isset(self::$_mapUnderline[$underline])) {
|
||||
return self::$_mapUnderline[$underline];
|
||||
}
|
||||
return 0x00;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -136,7 +136,7 @@ class PHPExcel_Writer_Excel5_Parser
|
|||
*
|
||||
* @access private
|
||||
*/
|
||||
function _initializeHashes()
|
||||
private function _initializeHashes()
|
||||
{
|
||||
// The Excel ptg indices
|
||||
$this->ptg = array(
|
||||
|
@ -512,7 +512,7 @@ class PHPExcel_Writer_Excel5_Parser
|
|||
* @param mixed $token The token to convert.
|
||||
* @return mixed the converted token on success
|
||||
*/
|
||||
function _convert($token)
|
||||
private function _convert($token)
|
||||
{
|
||||
if (preg_match("/\"([^\"]|\"\"){0,255}\"/", $token)) {
|
||||
return $this->_convertString($token);
|
||||
|
@ -521,15 +521,15 @@ class PHPExcel_Writer_Excel5_Parser
|
|||
return $this->_convertNumber($token);
|
||||
|
||||
// match references like A1 or $A$1
|
||||
} elseif (preg_match('/^\$?([A-Ia-i]?[A-Za-z])\$?(\d+)$/',$token)) {
|
||||
} elseif (preg_match('/^\$?([A-Ia-i]?[A-Za-z])\$?(\d+)$/', $token)) {
|
||||
return $this->_convertRef2d($token);
|
||||
|
||||
// match external references like Sheet1!A1 or Sheet1:Sheet2!A1 or Sheet1!$A$1 or Sheet1:Sheet2!$A$1
|
||||
} elseif (preg_match("/^" . self::REGEX_SHEET_TITLE_UNQUOTED . "(\:" . self::REGEX_SHEET_TITLE_UNQUOTED . ")?\!\\$?[A-Ia-i]?[A-Za-z]\\$?(\d+)$/u",$token)) {
|
||||
} elseif (preg_match("/^" . self::REGEX_SHEET_TITLE_UNQUOTED . "(\:" . self::REGEX_SHEET_TITLE_UNQUOTED . ")?\!\\$?[A-Ia-i]?[A-Za-z]\\$?(\d+)$/u", $token)) {
|
||||
return $this->_convertRef3d($token);
|
||||
|
||||
// match external references like 'Sheet1'!A1 or 'Sheet1:Sheet2'!A1 or 'Sheet1'!$A$1 or 'Sheet1:Sheet2'!$A$1
|
||||
} elseif (preg_match("/^'" . self::REGEX_SHEET_TITLE_QUOTED . "(\:" . self::REGEX_SHEET_TITLE_QUOTED . ")?'\!\\$?[A-Ia-i]?[A-Za-z]\\$?(\d+)$/u",$token)) {
|
||||
} elseif (preg_match("/^'" . self::REGEX_SHEET_TITLE_QUOTED . "(\:" . self::REGEX_SHEET_TITLE_QUOTED . ")?'\!\\$?[A-Ia-i]?[A-Za-z]\\$?(\d+)$/u", $token)) {
|
||||
return $this->_convertRef3d($token);
|
||||
|
||||
// match ranges like A1:B2 or $A$1:$B$2
|
||||
|
@ -537,11 +537,11 @@ class PHPExcel_Writer_Excel5_Parser
|
|||
return $this->_convertRange2d($token);
|
||||
|
||||
// match external ranges like Sheet1!A1:B2 or Sheet1:Sheet2!A1:B2 or Sheet1!$A$1:$B$2 or Sheet1:Sheet2!$A$1:$B$2
|
||||
} elseif (preg_match("/^" . self::REGEX_SHEET_TITLE_UNQUOTED . "(\:" . self::REGEX_SHEET_TITLE_UNQUOTED . ")?\!\\$?([A-Ia-i]?[A-Za-z])?\\$?(\d+)\:\\$?([A-Ia-i]?[A-Za-z])?\\$?(\d+)$/u",$token)) {
|
||||
} elseif (preg_match("/^" . self::REGEX_SHEET_TITLE_UNQUOTED . "(\:" . self::REGEX_SHEET_TITLE_UNQUOTED . ")?\!\\$?([A-Ia-i]?[A-Za-z])?\\$?(\d+)\:\\$?([A-Ia-i]?[A-Za-z])?\\$?(\d+)$/u", $token)) {
|
||||
return $this->_convertRange3d($token);
|
||||
|
||||
// match external ranges like 'Sheet1'!A1:B2 or 'Sheet1:Sheet2'!A1:B2 or 'Sheet1'!$A$1:$B$2 or 'Sheet1:Sheet2'!$A$1:$B$2
|
||||
} elseif (preg_match("/^'" . self::REGEX_SHEET_TITLE_QUOTED . "(\:" . self::REGEX_SHEET_TITLE_QUOTED . ")?'\!\\$?([A-Ia-i]?[A-Za-z])?\\$?(\d+)\:\\$?([A-Ia-i]?[A-Za-z])?\\$?(\d+)$/u",$token)) {
|
||||
} elseif (preg_match("/^'" . self::REGEX_SHEET_TITLE_QUOTED . "(\:" . self::REGEX_SHEET_TITLE_QUOTED . ")?'\!\\$?([A-Ia-i]?[A-Za-z])?\\$?(\d+)\:\\$?([A-Ia-i]?[A-Za-z])?\\$?(\d+)$/u", $token)) {
|
||||
return $this->_convertRange3d($token);
|
||||
|
||||
// operators (including parentheses)
|
||||
|
@ -553,9 +553,9 @@ class PHPExcel_Writer_Excel5_Parser
|
|||
return $this->_convertError($token);
|
||||
|
||||
// commented so argument number can be processed correctly. See toReversePolish().
|
||||
/*elseif (preg_match("/[A-Z0-9\xc0-\xdc\.]+/",$token))
|
||||
/*elseif (preg_match("/[A-Z0-9\xc0-\xdc\.]+/", $token))
|
||||
{
|
||||
return($this->_convertFunction($token,$this->_func_args));
|
||||
return($this->_convertFunction($token, $this->_func_args));
|
||||
}*/
|
||||
|
||||
// if it's an argument, ignore the token (the argument remains)
|
||||
|
@ -573,7 +573,7 @@ class PHPExcel_Writer_Excel5_Parser
|
|||
* @access private
|
||||
* @param mixed $num an integer or double for conversion to its ptg value
|
||||
*/
|
||||
function _convertNumber($num)
|
||||
private function _convertNumber($num)
|
||||
{
|
||||
// Integer in the range 0..2**16-1
|
||||
if ((preg_match("/^\d+$/", $num)) and ($num <= 65535)) {
|
||||
|
@ -593,7 +593,7 @@ class PHPExcel_Writer_Excel5_Parser
|
|||
* @param string $string A string for conversion to its ptg value.
|
||||
* @return mixed the converted token on success
|
||||
*/
|
||||
function _convertString($string)
|
||||
private function _convertString($string)
|
||||
{
|
||||
// chop away beggining and ending quotes
|
||||
$string = substr($string, 1, strlen($string) - 2);
|
||||
|
@ -613,16 +613,16 @@ class PHPExcel_Writer_Excel5_Parser
|
|||
* @param integer $num_args The number of arguments the function receives.
|
||||
* @return string The packed ptg for the function
|
||||
*/
|
||||
function _convertFunction($token, $num_args)
|
||||
private function _convertFunction($token, $num_args)
|
||||
{
|
||||
$args = $this->_functions[$token][1];
|
||||
// $volatile = $this->_functions[$token][3];
|
||||
|
||||
// Fixed number of args eg. TIME($i,$j,$k).
|
||||
// Fixed number of args eg. TIME($i, $j, $k).
|
||||
if ($args >= 0) {
|
||||
return pack("Cv", $this->ptg['ptgFuncV'], $this->_functions[$token][0]);
|
||||
}
|
||||
// Variable number of args eg. SUM($i,$j,$k, ..).
|
||||
// Variable number of args eg. SUM($i, $j, $k, ..).
|
||||
if ($args == -1) {
|
||||
return pack("CCv", $this->ptg['ptgFuncVarV'], $num_args, $this->_functions[$token][0]);
|
||||
}
|
||||
|
@ -635,7 +635,7 @@ class PHPExcel_Writer_Excel5_Parser
|
|||
* @param string $range An Excel range in the A1:A2
|
||||
* @param int $class
|
||||
*/
|
||||
function _convertRange2d($range, $class=0)
|
||||
private function _convertRange2d($range, $class = 0)
|
||||
{
|
||||
|
||||
// TODO: possible class value 0,1,2 check Formula.pm
|
||||
|
@ -673,7 +673,7 @@ class PHPExcel_Writer_Excel5_Parser
|
|||
* @param string $token An Excel range in the Sheet1!A1:A2 format.
|
||||
* @return mixed The packed ptgArea3d token on success.
|
||||
*/
|
||||
function _convertRange3d($token)
|
||||
private function _convertRange3d($token)
|
||||
{
|
||||
// $class = 0; // formulas like Sheet1!$A$1:$A$2 in list type data validation need this class (0x3B)
|
||||
|
||||
|
@ -715,7 +715,7 @@ class PHPExcel_Writer_Excel5_Parser
|
|||
* @param string $cell An Excel cell reference
|
||||
* @return string The cell in packed() format with the corresponding ptg
|
||||
*/
|
||||
function _convertRef2d($cell)
|
||||
private function _convertRef2d($cell)
|
||||
{
|
||||
// $class = 2; // as far as I know, this is magick.
|
||||
|
||||
|
@ -745,7 +745,7 @@ class PHPExcel_Writer_Excel5_Parser
|
|||
* @param string $cell An Excel cell reference
|
||||
* @return mixed The packed ptgRef3d token on success.
|
||||
*/
|
||||
function _convertRef3d($cell)
|
||||
private function _convertRef3d($cell)
|
||||
{
|
||||
// $class = 2; // as far as I know, this is magick.
|
||||
|
||||
|
@ -779,16 +779,23 @@ class PHPExcel_Writer_Excel5_Parser
|
|||
* @param string $errorCode The error code for conversion to its ptg value
|
||||
* @return string The error code ptgErr
|
||||
*/
|
||||
function _convertError($errorCode)
|
||||
private function _convertError($errorCode)
|
||||
{
|
||||
switch ($errorCode) {
|
||||
case '#NULL!': return pack("C", 0x00);
|
||||
case '#DIV/0!': return pack("C", 0x07);
|
||||
case '#VALUE!': return pack("C", 0x0F);
|
||||
case '#REF!': return pack("C", 0x17);
|
||||
case '#NAME?': return pack("C", 0x1D);
|
||||
case '#NUM!': return pack("C", 0x24);
|
||||
case '#N/A': return pack("C", 0x2A);
|
||||
case '#NULL!':
|
||||
return pack("C", 0x00);
|
||||
case '#DIV/0!':
|
||||
return pack("C", 0x07);
|
||||
case '#VALUE!':
|
||||
return pack("C", 0x0F);
|
||||
case '#REF!':
|
||||
return pack("C", 0x17);
|
||||
case '#NAME?':
|
||||
return pack("C", 0x1D);
|
||||
case '#NUM!':
|
||||
return pack("C", 0x24);
|
||||
case '#N/A':
|
||||
return pack("C", 0x2A);
|
||||
}
|
||||
return pack("C", 0xFF);
|
||||
}
|
||||
|
@ -801,7 +808,7 @@ class PHPExcel_Writer_Excel5_Parser
|
|||
* @param string $ext_ref The name of the external reference
|
||||
* @return string The reference index in packed() format
|
||||
*/
|
||||
function _packExtRef($ext_ref)
|
||||
private function _packExtRef($ext_ref)
|
||||
{
|
||||
$ext_ref = preg_replace("/^'/", '', $ext_ref); // Remove leading ' if any.
|
||||
$ext_ref = preg_replace("/'$/", '', $ext_ref); // Remove trailing ' if any.
|
||||
|
@ -846,7 +853,7 @@ class PHPExcel_Writer_Excel5_Parser
|
|||
* @param string $ext_ref The name of the external reference
|
||||
* @return mixed The reference index in packed() format on success
|
||||
*/
|
||||
function _getRefIndex($ext_ref)
|
||||
private function _getRefIndex($ext_ref)
|
||||
{
|
||||
$ext_ref = preg_replace("/^'/", '', $ext_ref); // Remove leading ' if any.
|
||||
$ext_ref = preg_replace("/'$/", '', $ext_ref); // Remove trailing ' if any.
|
||||
|
@ -906,7 +913,7 @@ class PHPExcel_Writer_Excel5_Parser
|
|||
* @param string $sheet_name Sheet name
|
||||
* @return integer The sheet index, -1 if the sheet was not found
|
||||
*/
|
||||
function _getSheetIndex($sheet_name)
|
||||
private function _getSheetIndex($sheet_name)
|
||||
{
|
||||
if (!isset($this->_ext_sheets[$sheet_name])) {
|
||||
return -1;
|
||||
|
@ -925,7 +932,7 @@ class PHPExcel_Writer_Excel5_Parser
|
|||
* @param string $name The name of the worksheet being added
|
||||
* @param integer $index The index of the worksheet being added
|
||||
*/
|
||||
function setExtSheet($name, $index)
|
||||
public function setExtSheet($name, $index)
|
||||
{
|
||||
$this->_ext_sheets[$name] = $index;
|
||||
}
|
||||
|
@ -937,7 +944,7 @@ class PHPExcel_Writer_Excel5_Parser
|
|||
* @param string $cell The Excel cell reference to be packed
|
||||
* @return array Array containing the row and column in packed() format
|
||||
*/
|
||||
function _cellToPackedRowcol($cell)
|
||||
private function _cellToPackedRowcol($cell)
|
||||
{
|
||||
$cell = strtoupper($cell);
|
||||
list($row, $col, $row_rel, $col_rel) = $this->_cellToRowcol($cell);
|
||||
|
@ -966,7 +973,7 @@ class PHPExcel_Writer_Excel5_Parser
|
|||
* @param string $range The Excel range to be packed
|
||||
* @return array Array containing (row1,col1,row2,col2) in packed() format
|
||||
*/
|
||||
function _rangeToPackedRange($range)
|
||||
private function _rangeToPackedRange($range)
|
||||
{
|
||||
preg_match('/(\$)?(\d+)\:(\$)?(\d+)/', $range, $match);
|
||||
// return absolute rows if there is a $ in the ref
|
||||
|
@ -1007,9 +1014,9 @@ class PHPExcel_Writer_Excel5_Parser
|
|||
* @param string $cell The Excel cell reference in A1 format.
|
||||
* @return array
|
||||
*/
|
||||
function _cellToRowcol($cell)
|
||||
private function _cellToRowcol($cell)
|
||||
{
|
||||
preg_match('/(\$)?([A-I]?[A-Z])(\$)?(\d+)/',$cell,$match);
|
||||
preg_match('/(\$)?([A-I]?[A-Z])(\$)?(\d+)/', $cell, $match);
|
||||
// return absolute column if there is a $ in the ref
|
||||
$col_rel = empty($match[1]) ? 1 : 0;
|
||||
$col_ref = $match[2];
|
||||
|
@ -1037,7 +1044,7 @@ class PHPExcel_Writer_Excel5_Parser
|
|||
*
|
||||
* @access private
|
||||
*/
|
||||
function _advance()
|
||||
private function _advance()
|
||||
{
|
||||
$i = $this->_current_char;
|
||||
$formula_length = strlen($this->_formula);
|
||||
|
@ -1088,7 +1095,7 @@ class PHPExcel_Writer_Excel5_Parser
|
|||
* @param mixed $token The token to check.
|
||||
* @return mixed The checked token or false on failure
|
||||
*/
|
||||
function _match($token)
|
||||
private function _match($token)
|
||||
{
|
||||
switch($token) {
|
||||
case "+":
|
||||
|
@ -1123,65 +1130,55 @@ class PHPExcel_Writer_Excel5_Parser
|
|||
break;
|
||||
default:
|
||||
// if it's a reference A1 or $A$1 or $A1 or A$1
|
||||
if (preg_match('/^\$?[A-Ia-i]?[A-Za-z]\$?[0-9]+$/',$token) and
|
||||
!preg_match("/[0-9]/",$this->_lookahead) and
|
||||
if (preg_match('/^\$?[A-Ia-i]?[A-Za-z]\$?[0-9]+$/', $token) and
|
||||
!preg_match("/[0-9]/", $this->_lookahead) and
|
||||
($this->_lookahead != ':') and ($this->_lookahead != '.') and
|
||||
($this->_lookahead != '!'))
|
||||
{
|
||||
($this->_lookahead != '!')) {
|
||||
return $token;
|
||||
}
|
||||
// If it's an external reference (Sheet1!A1 or Sheet1:Sheet2!A1 or Sheet1!$A$1 or Sheet1:Sheet2!$A$1)
|
||||
elseif (preg_match("/^" . self::REGEX_SHEET_TITLE_UNQUOTED . "(\:" . self::REGEX_SHEET_TITLE_UNQUOTED . ")?\!\\$?[A-Ia-i]?[A-Za-z]\\$?[0-9]+$/u",$token) and
|
||||
!preg_match("/[0-9]/",$this->_lookahead) and
|
||||
($this->_lookahead != ':') and ($this->_lookahead != '.'))
|
||||
{
|
||||
elseif (preg_match("/^" . self::REGEX_SHEET_TITLE_UNQUOTED . "(\:" . self::REGEX_SHEET_TITLE_UNQUOTED . ")?\!\\$?[A-Ia-i]?[A-Za-z]\\$?[0-9]+$/u", $token) and
|
||||
!preg_match("/[0-9]/", $this->_lookahead) and
|
||||
($this->_lookahead != ':') and ($this->_lookahead != '.')) {
|
||||
return $token;
|
||||
}
|
||||
// If it's an external reference ('Sheet1'!A1 or 'Sheet1:Sheet2'!A1 or 'Sheet1'!$A$1 or 'Sheet1:Sheet2'!$A$1)
|
||||
elseif (preg_match("/^'" . self::REGEX_SHEET_TITLE_QUOTED . "(\:" . self::REGEX_SHEET_TITLE_QUOTED . ")?'\!\\$?[A-Ia-i]?[A-Za-z]\\$?[0-9]+$/u",$token) and
|
||||
!preg_match("/[0-9]/",$this->_lookahead) and
|
||||
($this->_lookahead != ':') and ($this->_lookahead != '.'))
|
||||
{
|
||||
elseif (preg_match("/^'" . self::REGEX_SHEET_TITLE_QUOTED . "(\:" . self::REGEX_SHEET_TITLE_QUOTED . ")?'\!\\$?[A-Ia-i]?[A-Za-z]\\$?[0-9]+$/u", $token) and
|
||||
!preg_match("/[0-9]/", $this->_lookahead) and
|
||||
($this->_lookahead != ':') and ($this->_lookahead != '.')) {
|
||||
return $token;
|
||||
}
|
||||
// if it's a range A1:A2 or $A$1:$A$2
|
||||
elseif (preg_match('/^(\$)?[A-Ia-i]?[A-Za-z](\$)?[0-9]+:(\$)?[A-Ia-i]?[A-Za-z](\$)?[0-9]+$/', $token) and
|
||||
!preg_match("/[0-9]/",$this->_lookahead))
|
||||
{
|
||||
!preg_match("/[0-9]/", $this->_lookahead)) {
|
||||
return $token;
|
||||
}
|
||||
// If it's an external range like Sheet1!A1:B2 or Sheet1:Sheet2!A1:B2 or Sheet1!$A$1:$B$2 or Sheet1:Sheet2!$A$1:$B$2
|
||||
elseif (preg_match("/^" . self::REGEX_SHEET_TITLE_UNQUOTED . "(\:" . self::REGEX_SHEET_TITLE_UNQUOTED . ")?\!\\$?([A-Ia-i]?[A-Za-z])?\\$?[0-9]+:\\$?([A-Ia-i]?[A-Za-z])?\\$?[0-9]+$/u",$token) and
|
||||
!preg_match("/[0-9]/",$this->_lookahead))
|
||||
{
|
||||
elseif (preg_match("/^" . self::REGEX_SHEET_TITLE_UNQUOTED . "(\:" . self::REGEX_SHEET_TITLE_UNQUOTED . ")?\!\\$?([A-Ia-i]?[A-Za-z])?\\$?[0-9]+:\\$?([A-Ia-i]?[A-Za-z])?\\$?[0-9]+$/u", $token) and
|
||||
!preg_match("/[0-9]/", $this->_lookahead)) {
|
||||
return $token;
|
||||
}
|
||||
// If it's an external range like 'Sheet1'!A1:B2 or 'Sheet1:Sheet2'!A1:B2 or 'Sheet1'!$A$1:$B$2 or 'Sheet1:Sheet2'!$A$1:$B$2
|
||||
elseif (preg_match("/^'" . self::REGEX_SHEET_TITLE_QUOTED . "(\:" . self::REGEX_SHEET_TITLE_QUOTED . ")?'\!\\$?([A-Ia-i]?[A-Za-z])?\\$?[0-9]+:\\$?([A-Ia-i]?[A-Za-z])?\\$?[0-9]+$/u",$token) and
|
||||
!preg_match("/[0-9]/",$this->_lookahead))
|
||||
{
|
||||
elseif (preg_match("/^'" . self::REGEX_SHEET_TITLE_QUOTED . "(\:" . self::REGEX_SHEET_TITLE_QUOTED . ")?'\!\\$?([A-Ia-i]?[A-Za-z])?\\$?[0-9]+:\\$?([A-Ia-i]?[A-Za-z])?\\$?[0-9]+$/u", $token) and
|
||||
!preg_match("/[0-9]/", $this->_lookahead)) {
|
||||
return $token;
|
||||
}
|
||||
// If it's a number (check that it's not a sheet name or range)
|
||||
elseif (is_numeric($token) and
|
||||
(!is_numeric($token.$this->_lookahead) or ($this->_lookahead == '')) and
|
||||
($this->_lookahead != '!') and ($this->_lookahead != ':'))
|
||||
{
|
||||
($this->_lookahead != '!') and ($this->_lookahead != ':')) {
|
||||
return $token;
|
||||
}
|
||||
// If it's a string (of maximum 255 characters)
|
||||
elseif (preg_match("/\"([^\"]|\"\"){0,255}\"/",$token) and $this->_lookahead != '"' and (substr_count($token, '"')%2 == 0))
|
||||
{
|
||||
elseif (preg_match("/\"([^\"]|\"\"){0,255}\"/", $token) and $this->_lookahead != '"' and (substr_count($token, '"')%2 == 0)) {
|
||||
return $token;
|
||||
}
|
||||
// If it's an error code
|
||||
elseif (preg_match("/^#[A-Z0\/]{3,5}[!?]{1}$/", $token) or $token == '#N/A')
|
||||
{
|
||||
elseif (preg_match("/^#[A-Z0\/]{3,5}[!?]{1}$/", $token) or $token == '#N/A') {
|
||||
return $token;
|
||||
}
|
||||
// if it's a function call
|
||||
elseif (preg_match("/^[A-Z0-9\xc0-\xdc\.]+$/i",$token) and ($this->_lookahead == "("))
|
||||
{
|
||||
elseif (preg_match("/^[A-Z0-9\xc0-\xdc\.]+$/i", $token) and ($this->_lookahead == "(")) {
|
||||
return $token;
|
||||
}
|
||||
// It's an argument of some description (e.g. a named range),
|
||||
|
@ -1201,7 +1198,7 @@ class PHPExcel_Writer_Excel5_Parser
|
|||
* sign (=).
|
||||
* @return mixed true on success
|
||||
*/
|
||||
function parse($formula)
|
||||
public function parse($formula)
|
||||
{
|
||||
$this->_current_char = 0;
|
||||
$this->_formula = $formula;
|
||||
|
@ -1218,7 +1215,7 @@ class PHPExcel_Writer_Excel5_Parser
|
|||
* @access private
|
||||
* @return mixed The parsed ptg'd tree on success
|
||||
*/
|
||||
function _condition()
|
||||
private function _condition()
|
||||
{
|
||||
$result = $this->_expression();
|
||||
if ($this->_current_token == "<") {
|
||||
|
@ -1264,7 +1261,7 @@ class PHPExcel_Writer_Excel5_Parser
|
|||
* @access private
|
||||
* @return mixed The parsed ptg'd tree on success
|
||||
*/
|
||||
function _expression()
|
||||
private function _expression()
|
||||
{
|
||||
// If it's a string return a string node
|
||||
if (preg_match("/\"([^\"]|\"\"){0,255}\"/", $this->_current_token)) {
|
||||
|
@ -1323,7 +1320,7 @@ class PHPExcel_Writer_Excel5_Parser
|
|||
* @see _fact()
|
||||
* @return array The parsed ptg'd tree
|
||||
*/
|
||||
function _parenthesizedExpression()
|
||||
private function _parenthesizedExpression()
|
||||
{
|
||||
$result = $this->_createTree('ptgParen', $this->_expression(), '');
|
||||
return $result;
|
||||
|
@ -1336,7 +1333,7 @@ class PHPExcel_Writer_Excel5_Parser
|
|||
* @access private
|
||||
* @return mixed The parsed ptg'd tree on success
|
||||
*/
|
||||
function _term()
|
||||
private function _term()
|
||||
{
|
||||
$result = $this->_fact();
|
||||
while (($this->_current_token == "*") or
|
||||
|
@ -1366,7 +1363,7 @@ class PHPExcel_Writer_Excel5_Parser
|
|||
* @access private
|
||||
* @return mixed The parsed ptg'd tree on success
|
||||
*/
|
||||
function _fact()
|
||||
private function _fact()
|
||||
{
|
||||
if ($this->_current_token == "(") {
|
||||
$this->_advance(); // eat the "("
|
||||
|
@ -1378,29 +1375,29 @@ class PHPExcel_Writer_Excel5_Parser
|
|||
return $result;
|
||||
}
|
||||
// if it's a reference
|
||||
if (preg_match('/^\$?[A-Ia-i]?[A-Za-z]\$?[0-9]+$/',$this->_current_token))
|
||||
if (preg_match('/^\$?[A-Ia-i]?[A-Za-z]\$?[0-9]+$/', $this->_current_token))
|
||||
{
|
||||
$result = $this->_createTree($this->_current_token, '', '');
|
||||
$this->_advance();
|
||||
return $result;
|
||||
}
|
||||
// If it's an external reference (Sheet1!A1 or Sheet1:Sheet2!A1 or Sheet1!$A$1 or Sheet1:Sheet2!$A$1)
|
||||
elseif (preg_match("/^" . self::REGEX_SHEET_TITLE_UNQUOTED . "(\:" . self::REGEX_SHEET_TITLE_UNQUOTED . ")?\!\\$?[A-Ia-i]?[A-Za-z]\\$?[0-9]+$/u",$this->_current_token))
|
||||
elseif (preg_match("/^" . self::REGEX_SHEET_TITLE_UNQUOTED . "(\:" . self::REGEX_SHEET_TITLE_UNQUOTED . ")?\!\\$?[A-Ia-i]?[A-Za-z]\\$?[0-9]+$/u", $this->_current_token))
|
||||
{
|
||||
$result = $this->_createTree($this->_current_token, '', '');
|
||||
$this->_advance();
|
||||
return $result;
|
||||
}
|
||||
// If it's an external reference ('Sheet1'!A1 or 'Sheet1:Sheet2'!A1 or 'Sheet1'!$A$1 or 'Sheet1:Sheet2'!$A$1)
|
||||
elseif (preg_match("/^'" . self::REGEX_SHEET_TITLE_QUOTED . "(\:" . self::REGEX_SHEET_TITLE_QUOTED . ")?'\!\\$?[A-Ia-i]?[A-Za-z]\\$?[0-9]+$/u",$this->_current_token))
|
||||
elseif (preg_match("/^'" . self::REGEX_SHEET_TITLE_QUOTED . "(\:" . self::REGEX_SHEET_TITLE_QUOTED . ")?'\!\\$?[A-Ia-i]?[A-Za-z]\\$?[0-9]+$/u", $this->_current_token))
|
||||
{
|
||||
$result = $this->_createTree($this->_current_token, '', '');
|
||||
$this->_advance();
|
||||
return $result;
|
||||
}
|
||||
// if it's a range A1:B2 or $A$1:$B$2
|
||||
elseif (preg_match('/^(\$)?[A-Ia-i]?[A-Za-z](\$)?[0-9]+:(\$)?[A-Ia-i]?[A-Za-z](\$)?[0-9]+$/',$this->_current_token) or
|
||||
preg_match('/^(\$)?[A-Ia-i]?[A-Za-z](\$)?[0-9]+\.\.(\$)?[A-Ia-i]?[A-Za-z](\$)?[0-9]+$/',$this->_current_token))
|
||||
elseif (preg_match('/^(\$)?[A-Ia-i]?[A-Za-z](\$)?[0-9]+:(\$)?[A-Ia-i]?[A-Za-z](\$)?[0-9]+$/', $this->_current_token) or
|
||||
preg_match('/^(\$)?[A-Ia-i]?[A-Za-z](\$)?[0-9]+\.\.(\$)?[A-Ia-i]?[A-Za-z](\$)?[0-9]+$/', $this->_current_token))
|
||||
{
|
||||
// must be an error?
|
||||
$result = $this->_createTree($this->_current_token, '', '');
|
||||
|
@ -1408,7 +1405,7 @@ class PHPExcel_Writer_Excel5_Parser
|
|||
return $result;
|
||||
}
|
||||
// If it's an external range (Sheet1!A1:B2 or Sheet1:Sheet2!A1:B2 or Sheet1!$A$1:$B$2 or Sheet1:Sheet2!$A$1:$B$2)
|
||||
elseif (preg_match("/^" . self::REGEX_SHEET_TITLE_UNQUOTED . "(\:" . self::REGEX_SHEET_TITLE_UNQUOTED . ")?\!\\$?([A-Ia-i]?[A-Za-z])?\\$?[0-9]+:\\$?([A-Ia-i]?[A-Za-z])?\\$?[0-9]+$/u",$this->_current_token))
|
||||
elseif (preg_match("/^" . self::REGEX_SHEET_TITLE_UNQUOTED . "(\:" . self::REGEX_SHEET_TITLE_UNQUOTED . ")?\!\\$?([A-Ia-i]?[A-Za-z])?\\$?[0-9]+:\\$?([A-Ia-i]?[A-Za-z])?\\$?[0-9]+$/u", $this->_current_token))
|
||||
{
|
||||
// must be an error?
|
||||
//$result = $this->_current_token;
|
||||
|
@ -1417,7 +1414,7 @@ class PHPExcel_Writer_Excel5_Parser
|
|||
return $result;
|
||||
}
|
||||
// If it's an external range ('Sheet1'!A1:B2 or 'Sheet1'!A1:B2 or 'Sheet1'!$A$1:$B$2 or 'Sheet1'!$A$1:$B$2)
|
||||
elseif (preg_match("/^'" . self::REGEX_SHEET_TITLE_QUOTED . "(\:" . self::REGEX_SHEET_TITLE_QUOTED . ")?'\!\\$?([A-Ia-i]?[A-Za-z])?\\$?[0-9]+:\\$?([A-Ia-i]?[A-Za-z])?\\$?[0-9]+$/u",$this->_current_token))
|
||||
elseif (preg_match("/^'" . self::REGEX_SHEET_TITLE_QUOTED . "(\:" . self::REGEX_SHEET_TITLE_QUOTED . ")?'\!\\$?([A-Ia-i]?[A-Za-z])?\\$?[0-9]+:\\$?([A-Ia-i]?[A-Za-z])?\\$?[0-9]+$/u", $this->_current_token))
|
||||
{
|
||||
// must be an error?
|
||||
//$result = $this->_current_token;
|
||||
|
@ -1438,7 +1435,7 @@ class PHPExcel_Writer_Excel5_Parser
|
|||
return $result;
|
||||
}
|
||||
// if it's a function call
|
||||
elseif (preg_match("/^[A-Z0-9\xc0-\xdc\.]+$/i",$this->_current_token))
|
||||
elseif (preg_match("/^[A-Z0-9\xc0-\xdc\.]+$/i", $this->_current_token))
|
||||
{
|
||||
$result = $this->_func();
|
||||
return $result;
|
||||
|
@ -1455,7 +1452,7 @@ class PHPExcel_Writer_Excel5_Parser
|
|||
* @access private
|
||||
* @return mixed The parsed ptg'd tree on success
|
||||
*/
|
||||
function _func()
|
||||
private function _func()
|
||||
{
|
||||
$num_args = 0; // number of arguments received
|
||||
$function = strtoupper($this->_current_token);
|
||||
|
@ -1485,7 +1482,7 @@ class PHPExcel_Writer_Excel5_Parser
|
|||
throw new PHPExcel_Writer_Exception("Function $function() doesn't exist");
|
||||
}
|
||||
$args = $this->_functions[$function][1];
|
||||
// If fixed number of args eg. TIME($i,$j,$k). Check that the number of args is valid.
|
||||
// If fixed number of args eg. TIME($i, $j, $k). Check that the number of args is valid.
|
||||
if (($args >= 0) and ($args != $num_args)) {
|
||||
throw new PHPExcel_Writer_Exception("Incorrect number of arguments in function $function() ");
|
||||
}
|
||||
|
@ -1505,7 +1502,7 @@ class PHPExcel_Writer_Excel5_Parser
|
|||
* @param mixed $right The right array (sub-tree) or a final node.
|
||||
* @return array A tree
|
||||
*/
|
||||
function _createTree($value, $left, $right)
|
||||
private function _createTree($value, $left, $right)
|
||||
{
|
||||
return array('value' => $value, 'left' => $left, 'right' => $right);
|
||||
}
|
||||
|
@ -1537,7 +1534,7 @@ class PHPExcel_Writer_Excel5_Parser
|
|||
* @param array $tree The optional tree to convert.
|
||||
* @return string The tree in reverse polish notation
|
||||
*/
|
||||
function toReversePolish($tree = array())
|
||||
public function toReversePolish($tree = array())
|
||||
{
|
||||
$polish = ""; // the string we are going to return
|
||||
if (empty($tree)) { // If it's the first call use _parse_tree
|
||||
|
@ -1559,9 +1556,9 @@ class PHPExcel_Writer_Excel5_Parser
|
|||
$polish .= $converted_tree;
|
||||
}
|
||||
// if it's a function convert it here (so we can set it's arguments)
|
||||
if (preg_match("/^[A-Z0-9\xc0-\xdc\.]+$/",$tree['value']) and
|
||||
!preg_match('/^([A-Ia-i]?[A-Za-z])(\d+)$/',$tree['value']) and
|
||||
!preg_match("/^[A-Ia-i]?[A-Za-z](\d+)\.\.[A-Ia-i]?[A-Za-z](\d+)$/",$tree['value']) and
|
||||
if (preg_match("/^[A-Z0-9\xc0-\xdc\.]+$/", $tree['value']) and
|
||||
!preg_match('/^([A-Ia-i]?[A-Za-z])(\d+)$/', $tree['value']) and
|
||||
!preg_match("/^[A-Ia-i]?[A-Za-z](\d+)\.\.[A-Ia-i]?[A-Za-z](\d+)$/", $tree['value']) and
|
||||
!is_numeric($tree['value']) and
|
||||
!isset($this->ptg[$tree['value']]))
|
||||
{
|
||||
|
@ -1579,5 +1576,4 @@ class PHPExcel_Writer_Excel5_Parser
|
|||
$polish .= $converted_tree;
|
||||
return $polish;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -200,9 +200,7 @@ class PHPExcel_Writer_Excel5_Workbook extends PHPExcel_Writer_Excel5_BIFFwriter
|
|||
* @param array &$colors Colour Table
|
||||
* @param mixed $parser The formula parser created for the Workbook
|
||||
*/
|
||||
public function __construct(PHPExcel $phpExcel = null,
|
||||
&$str_total, &$str_unique, &$str_table, &$colors,
|
||||
$parser )
|
||||
public function __construct(PHPExcel $phpExcel = null, &$str_total, &$str_unique, &$str_table, &$colors, $parser)
|
||||
{
|
||||
// It needs to call its parent's constructor explicitly
|
||||
parent::__construct();
|
||||
|
@ -303,7 +301,7 @@ class PHPExcel_Writer_Excel5_Workbook extends PHPExcel_Writer_Excel5_BIFFwriter
|
|||
public function _addFont(PHPExcel_Style_Font $font)
|
||||
{
|
||||
$fontHashCode = $font->getHashCode();
|
||||
if(isset($this->_addedFonts[$fontHashCode])){
|
||||
if (isset($this->_addedFonts[$fontHashCode])) {
|
||||
$fontIndex = $this->_addedFonts[$fontHashCode];
|
||||
} else {
|
||||
$countFonts = count($this->_fontWriters);
|
||||
|
@ -324,7 +322,8 @@ class PHPExcel_Writer_Excel5_Workbook extends PHPExcel_Writer_Excel5_BIFFwriter
|
|||
* @param string $rgb E.g. 'FF00AA'
|
||||
* @return int Color index
|
||||
*/
|
||||
private function _addColor($rgb) {
|
||||
private function _addColor($rgb)
|
||||
{
|
||||
if (!isset($this->_colors[$rgb])) {
|
||||
if (count($this->_colors) < 57) {
|
||||
// then we add a custom color altering the palette
|
||||
|
@ -354,7 +353,7 @@ class PHPExcel_Writer_Excel5_Workbook extends PHPExcel_Writer_Excel5_BIFFwriter
|
|||
*
|
||||
* @access private
|
||||
*/
|
||||
function _setPaletteXl97()
|
||||
private function _setPaletteXl97()
|
||||
{
|
||||
$this->_palette = array(
|
||||
0x08 => array(0x00, 0x00, 0x00, 0x00),
|
||||
|
@ -477,7 +476,7 @@ class PHPExcel_Writer_Excel5_Workbook extends PHPExcel_Writer_Excel5_BIFFwriter
|
|||
*
|
||||
* @access private
|
||||
*/
|
||||
function _calcSheetOffsets()
|
||||
private function _calcSheetOffsets()
|
||||
{
|
||||
$boundsheet_length = 10; // fixed length for a BOUNDSHEET record
|
||||
|
||||
|
@ -583,7 +582,7 @@ class PHPExcel_Writer_Excel5_Workbook extends PHPExcel_Writer_Excel5_BIFFwriter
|
|||
$print_rowmax,
|
||||
$print_colmin,
|
||||
$print_colmax
|
||||
);
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -608,11 +607,10 @@ class PHPExcel_Writer_Excel5_Workbook extends PHPExcel_Writer_Excel5_BIFFwriter
|
|||
$rowmax,
|
||||
$colmin,
|
||||
$colmax
|
||||
);
|
||||
);
|
||||
|
||||
// (exclusive) either repeatColumns or repeatRows
|
||||
} else if ($sheetSetup->isColumnsToRepeatAtLeftSet() || $sheetSetup->isRowsToRepeatAtTopSet()) {
|
||||
|
||||
// Columns to repeat
|
||||
if ($sheetSetup->isColumnsToRepeatAtLeftSet()) {
|
||||
$repeat = $sheetSetup->getColumnsToRepeatAtLeft();
|
||||
|
@ -640,7 +638,7 @@ class PHPExcel_Writer_Excel5_Workbook extends PHPExcel_Writer_Excel5_BIFFwriter
|
|||
$rowmax,
|
||||
$colmin,
|
||||
$colmax
|
||||
);
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -658,7 +656,6 @@ class PHPExcel_Writer_Excel5_Workbook extends PHPExcel_Writer_Excel5_BIFFwriter
|
|||
// Loop named ranges
|
||||
$namedRanges = $this->_phpExcel->getNamedRanges();
|
||||
foreach ($namedRanges as $namedRange) {
|
||||
|
||||
// Create absolute coordinate
|
||||
$range = PHPExcel_Cell::splitRange($namedRange->getRange());
|
||||
for ($i = 0; $i < count($range); $i++) {
|
||||
|
@ -688,7 +685,7 @@ class PHPExcel_Writer_Excel5_Workbook extends PHPExcel_Writer_Excel5_BIFFwriter
|
|||
}
|
||||
$chunk .= $this->writeData($this->_writeDefinedNameBiff8($namedRange->getName(), $formulaData, $scope, false));
|
||||
|
||||
} catch(PHPExcel_Exception $e) {
|
||||
} catch (PHPExcel_Exception $e) {
|
||||
// do nothing
|
||||
}
|
||||
}
|
||||
|
@ -721,7 +718,6 @@ class PHPExcel_Writer_Excel5_Workbook extends PHPExcel_Writer_Excel5_BIFFwriter
|
|||
|
||||
// (exclusive) either repeatColumns or repeatRows
|
||||
} else if ($sheetSetup->isColumnsToRepeatAtLeftSet() || $sheetSetup->isRowsToRepeatAtTopSet()) {
|
||||
|
||||
// Columns to repeat
|
||||
if ($sheetSetup->isColumnsToRepeatAtLeftSet()) {
|
||||
$repeat = $sheetSetup->getColumnsToRepeatAtLeft();
|
||||
|
@ -785,7 +781,7 @@ class PHPExcel_Writer_Excel5_Workbook extends PHPExcel_Writer_Excel5_BIFFwriter
|
|||
for ($i = 0; $i < $total_worksheets; ++$i) {
|
||||
$sheetAutoFilter = $this->_phpExcel->getSheet($i)->getAutoFilter();
|
||||
$autoFilterRange = $sheetAutoFilter->getRange();
|
||||
if(!empty($autoFilterRange)) {
|
||||
if (!empty($autoFilterRange)) {
|
||||
$rangeBounds = PHPExcel_Cell::rangeBoundaries($autoFilterRange);
|
||||
|
||||
//Autofilter built in name
|
||||
|
@ -842,19 +838,21 @@ class PHPExcel_Writer_Excel5_Workbook extends PHPExcel_Writer_Excel5_BIFFwriter
|
|||
* @param boolean $isHidden
|
||||
* @return string Complete binary record data
|
||||
* */
|
||||
private function _writeShortNameBiff8($name, $sheetIndex = 0, $rangeBounds, $isHidden = false){
|
||||
private function _writeShortNameBiff8($name, $sheetIndex = 0, $rangeBounds, $isHidden = false)
|
||||
{
|
||||
$record = 0x0018;
|
||||
|
||||
// option flags
|
||||
$options = ($isHidden ? 0x21 : 0x00);
|
||||
|
||||
$extra = pack('Cvvvvv',
|
||||
0x3B,
|
||||
$sheetIndex - 1,
|
||||
$rangeBounds[0][1] - 1,
|
||||
$rangeBounds[1][1] - 1,
|
||||
$rangeBounds[0][0] - 1,
|
||||
$rangeBounds[1][0] - 1);
|
||||
0x3B,
|
||||
$sheetIndex - 1,
|
||||
$rangeBounds[0][1] - 1,
|
||||
$rangeBounds[1][1] - 1,
|
||||
$rangeBounds[0][0] - 1,
|
||||
$rangeBounds[1][0] - 1
|
||||
);
|
||||
|
||||
// size of the formula (in bytes)
|
||||
$sz = strlen($extra);
|
||||
|
@ -879,7 +877,7 @@ class PHPExcel_Writer_Excel5_Workbook extends PHPExcel_Writer_Excel5_BIFFwriter
|
|||
$cv = $this->_codepage; // The code page
|
||||
|
||||
$header = pack('vv', $record, $length);
|
||||
$data = pack('v', $cv);
|
||||
$data = pack('v', $cv);
|
||||
|
||||
$this->_append($header . $data);
|
||||
}
|
||||
|
@ -909,10 +907,7 @@ class PHPExcel_Writer_Excel5_Workbook extends PHPExcel_Writer_Excel5_BIFFwriter
|
|||
$itabCur = $this->_phpExcel->getActiveSheetIndex(); // Active worksheet
|
||||
|
||||
$header = pack("vv", $record, $length);
|
||||
$data = pack("vvvvvvvvv", $xWn, $yWn, $dxWn, $dyWn,
|
||||
$grbit,
|
||||
$itabCur, $itabFirst,
|
||||
$ctabsel, $wTabRatio);
|
||||
$data = pack("vvvvvvvvv", $xWn, $yWn, $dxWn, $dyWn, $grbit, $itabCur, $itabFirst, $ctabsel, $wTabRatio);
|
||||
$this->_append($header . $data);
|
||||
}
|
||||
|
||||
|
@ -929,10 +924,18 @@ class PHPExcel_Writer_Excel5_Workbook extends PHPExcel_Writer_Excel5_BIFFwriter
|
|||
|
||||
// sheet state
|
||||
switch ($sheet->getSheetState()) {
|
||||
case PHPExcel_Worksheet::SHEETSTATE_VISIBLE: $ss = 0x00; break;
|
||||
case PHPExcel_Worksheet::SHEETSTATE_HIDDEN: $ss = 0x01; break;
|
||||
case PHPExcel_Worksheet::SHEETSTATE_VERYHIDDEN: $ss = 0x02; break;
|
||||
default: $ss = 0x00; break;
|
||||
case PHPExcel_Worksheet::SHEETSTATE_VISIBLE:
|
||||
$ss = 0x00;
|
||||
break;
|
||||
case PHPExcel_Worksheet::SHEETSTATE_HIDDEN:
|
||||
$ss = 0x01;
|
||||
break;
|
||||
case PHPExcel_Worksheet::SHEETSTATE_VERYHIDDEN:
|
||||
$ss = 0x02;
|
||||
break;
|
||||
default:
|
||||
$ss = 0x00;
|
||||
break;
|
||||
}
|
||||
|
||||
// sheet type
|
||||
|
@ -944,7 +947,7 @@ class PHPExcel_Writer_Excel5_Workbook extends PHPExcel_Writer_Excel5_BIFFwriter
|
|||
$data .= PHPExcel_Shared_String::UTF8toBIFF8UnicodeShort($sheetname);
|
||||
|
||||
$length = strlen($data);
|
||||
$header = pack("vv", $record, $length);
|
||||
$header = pack("vv", $record, $length);
|
||||
$this->_append($header . $data);
|
||||
}
|
||||
|
||||
|
@ -973,7 +976,7 @@ class PHPExcel_Writer_Excel5_Workbook extends PHPExcel_Writer_Excel5_BIFFwriter
|
|||
$length = 2 + 6 * $total_references; // Number of bytes to follow
|
||||
|
||||
$supbook_index = 0; // FIXME: only using internal SUPBOOK record
|
||||
$header = pack("vv", $record, $length);
|
||||
$header = pack("vv", $record, $length);
|
||||
$data = pack('v', $total_references);
|
||||
for ($i = 0; $i < $total_references; ++$i) {
|
||||
$data .= $this->_parser->_references[$i];
|
||||
|
@ -993,7 +996,7 @@ class PHPExcel_Writer_Excel5_Workbook extends PHPExcel_Writer_Excel5_BIFFwriter
|
|||
$BuiltIn = 0x00; // Built-in style
|
||||
$iLevel = 0xff; // Outline style level
|
||||
|
||||
$header = pack("vv", $record, $length);
|
||||
$header = pack("vv", $record, $length);
|
||||
$data = pack("vCC", $ixfe, $BuiltIn, $iLevel);
|
||||
$this->_append($header . $data);
|
||||
}
|
||||
|
@ -1051,7 +1054,7 @@ class PHPExcel_Writer_Excel5_Workbook extends PHPExcel_Writer_Excel5_BIFFwriter
|
|||
$length = 0x0002; // Number of bytes to follow
|
||||
|
||||
$header = pack("vv", $record, $length);
|
||||
$data = pack("v", $cxals);
|
||||
$data = pack("v", $cxals);
|
||||
$this->_append($header . $data);
|
||||
}
|
||||
|
||||
|
@ -1072,7 +1075,7 @@ class PHPExcel_Writer_Excel5_Workbook extends PHPExcel_Writer_Excel5_BIFFwriter
|
|||
$cch = strlen($sheetname); // Length of sheet name
|
||||
$rgch = 0x03; // Filename encoding
|
||||
|
||||
$header = pack("vv", $record, $length);
|
||||
$header = pack("vv", $record, $length);
|
||||
$data = pack("CC", $cch, $rgch);
|
||||
$this->_append($header . $data . $sheetname);
|
||||
}
|
||||
|
@ -1177,7 +1180,7 @@ class PHPExcel_Writer_Excel5_Workbook extends PHPExcel_Writer_Excel5_BIFFwriter
|
|||
$unknown07 = 0x1087;
|
||||
$unknown08 = 0x8008;
|
||||
|
||||
$header = pack("vv", $record, $length);
|
||||
$header = pack("vv", $record, $length);
|
||||
$data = pack("v", $grbit);
|
||||
$data .= pack("C", $chKey);
|
||||
$data .= pack("C", $cch);
|
||||
|
@ -1232,7 +1235,7 @@ class PHPExcel_Writer_Excel5_Workbook extends PHPExcel_Writer_Excel5_BIFFwriter
|
|||
$record = 0x008C; // Record identifier
|
||||
$length = 4; // Number of bytes to follow
|
||||
|
||||
$header = pack('vv', $record, $length);
|
||||
$header = pack('vv', $record, $length);
|
||||
/* using the same country code always for simplicity */
|
||||
$data = pack('vv', $this->_country_code, $this->_country_code);
|
||||
//$this->_append($header . $data);
|
||||
|
@ -1249,7 +1252,7 @@ class PHPExcel_Writer_Excel5_Workbook extends PHPExcel_Writer_Excel5_BIFFwriter
|
|||
$record = 0x01C1; // Record identifier
|
||||
$length = 8; // Number of bytes to follow
|
||||
|
||||
$header = pack('vv', $record, $length);
|
||||
$header = pack('vv', $record, $length);
|
||||
|
||||
// by inspection of real Excel files, MS Office Excel 2007 writes this
|
||||
$data = pack('VV', 0x000001C1, 0x00001E667);
|
||||
|
@ -1276,7 +1279,7 @@ class PHPExcel_Writer_Excel5_Workbook extends PHPExcel_Writer_Excel5_BIFFwriter
|
|||
}
|
||||
}
|
||||
|
||||
$header = pack("vvv", $record, $length, $ccv);
|
||||
$header = pack("vvv", $record, $length, $ccv);
|
||||
$this->_append($header . $data);
|
||||
}
|
||||
|
||||
|
@ -1307,7 +1310,6 @@ class PHPExcel_Writer_Excel5_Workbook extends PHPExcel_Writer_Excel5_BIFFwriter
|
|||
|
||||
// loop through all (unique) strings in shared strings table
|
||||
foreach (array_keys($this->_str_table) as $string) {
|
||||
|
||||
// here $string is a BIFF8 encoded string
|
||||
|
||||
// length = character count
|
||||
|
@ -1320,7 +1322,6 @@ class PHPExcel_Writer_Excel5_Workbook extends PHPExcel_Writer_Excel5_BIFFwriter
|
|||
$finished = false;
|
||||
|
||||
while ($finished === false) {
|
||||
|
||||
// normally, there will be only one cycle, but if string cannot immediately be written as is
|
||||
// there will be need for more than one cylcle, if string longer than one record data block, there
|
||||
// may be need for even more cycles
|
||||
|
@ -1369,7 +1370,7 @@ class PHPExcel_Writer_Excel5_Workbook extends PHPExcel_Writer_Excel5_BIFFwriter
|
|||
$effective_space_remaining = $space_remaining;
|
||||
|
||||
// for uncompressed strings, sometimes effective space remaining is reduced by 1
|
||||
if ( $encoding == 1 && (strlen($string) - $space_remaining) % 2 == 1 ) {
|
||||
if ($encoding == 1 && (strlen($string) - $space_remaining) % 2 == 1) {
|
||||
--$effective_space_remaining;
|
||||
}
|
||||
|
||||
|
@ -1419,10 +1420,9 @@ class PHPExcel_Writer_Excel5_Workbook extends PHPExcel_Writer_Excel5_BIFFwriter
|
|||
|
||||
$record = 0x00EB;
|
||||
$length = strlen($data);
|
||||
$header = pack("vv", $record, $length);
|
||||
$header = pack("vv", $record, $length);
|
||||
|
||||
return $this->writeData($header . $data);
|
||||
|
||||
} else {
|
||||
return '';
|
||||
}
|
||||
|
|
|
@ -1254,7 +1254,7 @@ class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter
|
|||
$grbit |= 0x0100;
|
||||
|
||||
$header = pack("vv", $record, $length);
|
||||
$data = pack("vvvvvvvv", $row, $colMic, $colMac, $miyRw, $irwMac,$reserved, $grbit, $ixfe);
|
||||
$data = pack("vvvvvvvv", $row, $colMic, $colMac, $miyRw, $irwMac, $reserved, $grbit, $ixfe);
|
||||
$this->_append($header.$data);
|
||||
}
|
||||
|
||||
|
@ -1313,7 +1313,7 @@ class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter
|
|||
$grbit |= $fPaged << 10;
|
||||
$grbit |= $fPageBreakPreview << 11;
|
||||
|
||||
$header = pack("vv", $record, $length);
|
||||
$header = pack("vv", $record, $length);
|
||||
$data = pack("vvv", $grbit, $rwTop, $colLeft);
|
||||
|
||||
// FIXME !!!
|
||||
|
@ -1590,15 +1590,15 @@ class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter
|
|||
|
||||
// record data
|
||||
$recordData = pack(
|
||||
'vVVCVVvv'
|
||||
, 0x0867 // repeated record identifier
|
||||
, 0x0000 // not used
|
||||
, 0x0000 // not used
|
||||
, 0x00 // not used
|
||||
, 0x01000200 // unknown data
|
||||
, 0xFFFFFFFF // unknown data
|
||||
, $options // options
|
||||
, 0x0000 // not used
|
||||
'vVVCVVvv',
|
||||
0x0867, // repeated record identifier
|
||||
0x0000, // not used
|
||||
0x0000, // not used
|
||||
0x00, // not used
|
||||
0x01000200, // unknown data
|
||||
0xFFFFFFFF, // unknown data
|
||||
$options, // options
|
||||
0x0000 // not used
|
||||
);
|
||||
|
||||
$length = strlen($recordData);
|
||||
|
@ -1786,8 +1786,8 @@ class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter
|
|||
|
||||
$this->_active_pane = $pnnAct; // Used in _writeSelection
|
||||
|
||||
$header = pack("vv", $record, $length);
|
||||
$data = pack("vvvvv", $x, $y, $rwTop, $colLeft, $pnnAct);
|
||||
$header = pack("vv", $record, $length);
|
||||
$data = pack("vvvvv", $x, $y, $rwTop, $colLeft, $pnnAct);
|
||||
$this->_append($header . $data);
|
||||
}
|
||||
|
||||
|
@ -1846,14 +1846,7 @@ class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter
|
|||
}
|
||||
|
||||
$header = pack("vv", $record, $length);
|
||||
$data1 = pack("vvvvvvvv", $iPaperSize,
|
||||
$iScale,
|
||||
$iPageStart,
|
||||
$iFitWidth,
|
||||
$iFitHeight,
|
||||
$grbit,
|
||||
$iRes,
|
||||
$iVRes);
|
||||
$data1 = pack("vvvvvvvv", $iPaperSize, $iScale, $iPageStart, $iFitWidth, $iFitHeight, $grbit, $iRes, $iVRes);
|
||||
$data2 = $numHdr.$numFtr;
|
||||
$data3 = pack("v", $iCopies);
|
||||
$this->_append($header . $data1 . $data2 . $data3);
|
||||
|
@ -2086,7 +2079,7 @@ class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter
|
|||
*
|
||||
* @see _writeWsbool()
|
||||
*/
|
||||
private function _writeGuts()
|
||||
private function _writeGuts()
|
||||
{
|
||||
$record = 0x0080; // Record identifier
|
||||
$length = 0x0008; // Bytes to follow
|
||||
|
@ -2194,7 +2187,6 @@ class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter
|
|||
|
||||
//horizontal page breaks
|
||||
if (!empty($hbreaks)) {
|
||||
|
||||
// Sort and filter array of page breaks
|
||||
sort($hbreaks, SORT_NUMERIC);
|
||||
if ($hbreaks[0] == 0) { // don't use first break if it's 0
|
||||
|
@ -2218,7 +2210,6 @@ class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter
|
|||
|
||||
// vertical page breaks
|
||||
if (!empty($vbreaks)) {
|
||||
|
||||
// 1000 vertical pagebreaks appears to be an internal Excel 5 limit.
|
||||
// It is slightly higher in Excel 97/200, approx. 1026
|
||||
$vbreaks = array_slice($vbreaks, 0, 1000);
|
||||
|
@ -2472,10 +2463,7 @@ class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter
|
|||
$x2 = $width / PHPExcel_Shared_Excel5::sizeCol($this->_phpSheet, PHPExcel_Cell::stringFromColumnIndex($col_end)) * 1024; // Distance to right side of object
|
||||
$y2 = $height / PHPExcel_Shared_Excel5::sizeRow($this->_phpSheet, $row_end + 1) * 256; // Distance to bottom of object
|
||||
|
||||
$this->_writeObjPicture($col_start, $x1,
|
||||
$row_start, $y1,
|
||||
$col_end, $x2,
|
||||
$row_end, $y2);
|
||||
$this->_writeObjPicture($col_start, $x1, $row_start, $y1, $col_end, $x2, $row_end, $y2);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -2491,7 +2479,7 @@ class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter
|
|||
* @param integer $rwB Row containing bottom right corner of object
|
||||
* @param integer $dyB Distance from bottom of cell
|
||||
*/
|
||||
private function _writeObjPicture($colL,$dxL,$rwT,$dyT,$colR,$dxR,$rwB,$dyB)
|
||||
private function _writeObjPicture($colL, $dxL, $rwT, $dyT, $colR, $dxR, $rwB, $dyB)
|
||||
{
|
||||
$record = 0x005d; // Record identifier
|
||||
$length = 0x003c; // Bytes to follow
|
||||
|
@ -2598,7 +2586,7 @@ class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter
|
|||
public function _processBitmap($bitmap)
|
||||
{
|
||||
// Open file.
|
||||
$bmp_fd = @fopen($bitmap,"rb");
|
||||
$bmp_fd = @fopen($bitmap, "rb");
|
||||
if (!$bmp_fd) {
|
||||
throw new PHPExcel_Writer_Exception("Couldn't import $bitmap");
|
||||
}
|
||||
|
@ -2748,15 +2736,15 @@ class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter
|
|||
if ($spTypes[$i] == 0x00C9) {
|
||||
// Add ftCmo (common object data) subobject
|
||||
$objData .=
|
||||
pack('vvvvvVVV'
|
||||
, 0x0015 // 0x0015 = ftCmo
|
||||
, 0x0012 // length of ftCmo data
|
||||
, 0x0014 // object type, 0x0014 = filter
|
||||
, $i // object id number, Excel seems to use 1-based index, local for the sheet
|
||||
, 0x2101 // option flags, 0x2001 is what OpenOffice.org uses
|
||||
, 0 // reserved
|
||||
, 0 // reserved
|
||||
, 0 // reserved
|
||||
pack('vvvvvVVV',
|
||||
0x0015, // 0x0015 = ftCmo
|
||||
0x0012, // length of ftCmo data
|
||||
0x0014, // object type, 0x0014 = filter
|
||||
$i, // object id number, Excel seems to use 1-based index, local for the sheet
|
||||
0x2101, // option flags, 0x2001 is what OpenOffice.org uses
|
||||
0, // reserved
|
||||
0, // reserved
|
||||
0 // reserved
|
||||
);
|
||||
|
||||
// Add ftSbs Scroll bar subobject
|
||||
|
@ -2765,27 +2753,26 @@ class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter
|
|||
// Add ftLbsData (List box data) subobject
|
||||
$objData .= pack('vv', 0x0013, 0x1FEE);
|
||||
$objData .= pack('H*', '00000000010001030000020008005700');
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
// Add ftCmo (common object data) subobject
|
||||
$objData .=
|
||||
pack('vvvvvVVV'
|
||||
, 0x0015 // 0x0015 = ftCmo
|
||||
, 0x0012 // length of ftCmo data
|
||||
, 0x0008 // object type, 0x0008 = picture
|
||||
, $i // object id number, Excel seems to use 1-based index, local for the sheet
|
||||
, 0x6011 // option flags, 0x6011 is what OpenOffice.org uses
|
||||
, 0 // reserved
|
||||
, 0 // reserved
|
||||
, 0 // reserved
|
||||
pack('vvvvvVVV',
|
||||
0x0015, // 0x0015 = ftCmo
|
||||
0x0012, // length of ftCmo data
|
||||
0x0008, // object type, 0x0008 = picture
|
||||
$i, // object id number, Excel seems to use 1-based index, local for the sheet
|
||||
0x6011, // option flags, 0x6011 is what OpenOffice.org uses
|
||||
0, // reserved
|
||||
0, // reserved
|
||||
0 // reserved
|
||||
);
|
||||
}
|
||||
|
||||
// ftEnd
|
||||
$objData .=
|
||||
pack('vv'
|
||||
, 0x0000 // 0x0000 = ftEnd
|
||||
, 0x0000 // length of ftEnd data
|
||||
pack('vv',
|
||||
0x0000, // 0x0000 = ftEnd
|
||||
0x0000 // length of ftEnd data
|
||||
);
|
||||
|
||||
$length = strlen($objData);
|
||||
|
@ -2805,19 +2792,17 @@ class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter
|
|||
|
||||
// Write data validations?
|
||||
if (!empty($dataValidationCollection)) {
|
||||
|
||||
// DATAVALIDATIONS record
|
||||
$record = 0x01B2; // Record identifier
|
||||
$length = 0x0012; // Bytes to follow
|
||||
$length = 0x0012; // Bytes to follow
|
||||
|
||||
$grbit = 0x0000; // Prompt box at cell, no cached validity data at DV records
|
||||
$horPos = 0x00000000; // Horizontal position of prompt box, if fixed position
|
||||
$verPos = 0x00000000; // Vertical position of prompt box, if fixed position
|
||||
$horPos = 0x00000000; // Horizontal position of prompt box, if fixed position
|
||||
$verPos = 0x00000000; // Vertical position of prompt box, if fixed position
|
||||
$objId = 0xFFFFFFFF; // Object identifier of drop down arrow object, or -1 if not visible
|
||||
|
||||
$header = pack('vv', $record, $length);
|
||||
$data = pack('vVVVV', $grbit, $horPos, $verPos, $objId,
|
||||
count($dataValidationCollection));
|
||||
$header = pack('vv', $record, $length);
|
||||
$data = pack('vVVVV', $grbit, $horPos, $verPos, $objId, count($dataValidationCollection));
|
||||
$this->_append($header.$data);
|
||||
|
||||
// DATAVALIDATION records
|
||||
|
@ -2877,7 +2862,7 @@ class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter
|
|||
|
||||
// explicit formula?
|
||||
if ($type == 0x03 && preg_match('/^\".*\"$/', $dataValidation->getFormula1())) {
|
||||
$options |= 0x01 << 7;
|
||||
$options |= 0x01 << 7;
|
||||
}
|
||||
|
||||
// empty cells allowed
|
||||
|
@ -2953,8 +2938,7 @@ class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter
|
|||
$this->_parser->parse($formula1);
|
||||
$formula1 = $this->_parser->toReversePolish();
|
||||
$sz1 = strlen($formula1);
|
||||
|
||||
} catch(PHPExcel_Exception $e) {
|
||||
} catch (PHPExcel_Exception $e) {
|
||||
$sz1 = 0;
|
||||
$formula1 = '';
|
||||
}
|
||||
|
@ -2970,8 +2954,7 @@ class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter
|
|||
$this->_parser->parse($formula2);
|
||||
$formula2 = $this->_parser->toReversePolish();
|
||||
$sz2 = strlen($formula2);
|
||||
|
||||
} catch(PHPExcel_Exception $e) {
|
||||
} catch (PHPExcel_Exception $e) {
|
||||
$sz2 = 0;
|
||||
$formula2 = '';
|
||||
}
|
||||
|
@ -2983,7 +2966,7 @@ class PHPExcel_Writer_Excel5_Worksheet extends PHPExcel_Writer_Excel5_BIFFwriter
|
|||
$data .= $this->_writeBIFF8CellRangeAddressFixed($cellCoordinate);
|
||||
|
||||
$length = strlen($data);
|
||||
$header = pack("vv", $record, $length);
|
||||
$header = pack("vv", $record, $length);
|
||||
|
||||
$this->_append($header . $data);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue