Added Horizontal FILL alignment for Excel5 and Excel2007 Readers/Writers, and Horizontal DISTRIBUTED alignment for Excel2007 Reader/Writer

This commit is contained in:
Mark Baker 2013-07-02 13:13:07 +01:00
parent 39953ff49f
commit 509bfd39e2
4 changed files with 14 additions and 2 deletions

View File

@ -1569,11 +1569,15 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce
private function _readFilepass() private function _readFilepass()
{ {
$length = self::_GetInt2d($this->_data, $this->_pos + 2); $length = self::_GetInt2d($this->_data, $this->_pos + 2);
// $recordData = substr($this->_data, $this->_pos + 4, $length); $recordData = substr($this->_data, $this->_pos + 4, $length);
// move stream pointer to next record // move stream pointer to next record
$this->_pos += 4 + $length; $this->_pos += 4 + $length;
if (!$this->_readDataOnly) {
// offset: 0; size: 2; 16-bit hash value of password
$password = strtoupper(dechex(self::_GetInt2d($recordData, 0))); // the hashed password
}
throw new PHPExcel_Reader_Exception('Cannot read encrypted file'); throw new PHPExcel_Reader_Exception('Cannot read encrypted file');
} }
@ -1836,6 +1840,9 @@ class PHPExcel_Reader_Excel5 extends PHPExcel_Reader_Abstract implements PHPExce
case 3: case 3:
$objStyle->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_RIGHT); $objStyle->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_RIGHT);
break; break;
case 4:
$objStyle->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_FILL);
break;
case 5: case 5:
$objStyle->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_JUSTIFY); $objStyle->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_JUSTIFY);
break; break;

View File

@ -42,12 +42,15 @@ class PHPExcel_Style_Alignment extends PHPExcel_Style_Supervisor implements PHPE
const HORIZONTAL_CENTER = 'center'; const HORIZONTAL_CENTER = 'center';
const HORIZONTAL_CENTER_CONTINUOUS = 'centerContinuous'; const HORIZONTAL_CENTER_CONTINUOUS = 'centerContinuous';
const HORIZONTAL_JUSTIFY = 'justify'; const HORIZONTAL_JUSTIFY = 'justify';
const HORIZONTAL_FILL = 'fill';
const HORIZONTAL_DISTRIBUTED = 'distributed'; // Excel2007 only
/* Vertical alignment styles */ /* Vertical alignment styles */
const VERTICAL_BOTTOM = 'bottom'; const VERTICAL_BOTTOM = 'bottom';
const VERTICAL_TOP = 'top'; const VERTICAL_TOP = 'top';
const VERTICAL_CENTER = 'center'; const VERTICAL_CENTER = 'center';
const VERTICAL_JUSTIFY = 'justify'; const VERTICAL_JUSTIFY = 'justify';
const VERTICAL_DISTRIBUTED = 'distributed'; // Excel2007 only
/** /**
* Horizontal * Horizontal

View File

@ -179,7 +179,7 @@ class PHPExcel_Writer_Excel5_Xf
// Flags to indicate if attributes have been set. // Flags to indicate if attributes have been set.
$atr_num = ($this->_numberFormatIndex != 0)?1:0; $atr_num = ($this->_numberFormatIndex != 0)?1:0;
$atr_fnt = ($this->_fontIndex != 0)?1:0; $atr_fnt = ($this->_fontIndex != 0)?1:0;
$atr_alc = ((int) $this->_style->getAlignment()->getWrapText())?1:0; $atr_alc = ((int) $this->_style->getAlignment()->getWrapText()) ? 1 : 0;
$atr_bdr = (self::_mapBorderStyle($this->_style->getBorders()->getBottom()->getBorderStyle()) || $atr_bdr = (self::_mapBorderStyle($this->_style->getBorders()->getBottom()->getBorderStyle()) ||
self::_mapBorderStyle($this->_style->getBorders()->getTop()->getBorderStyle()) || self::_mapBorderStyle($this->_style->getBorders()->getTop()->getBorderStyle()) ||
self::_mapBorderStyle($this->_style->getBorders()->getLeft()->getBorderStyle()) || self::_mapBorderStyle($this->_style->getBorders()->getLeft()->getBorderStyle()) ||
@ -457,6 +457,7 @@ class PHPExcel_Writer_Excel5_Xf
PHPExcel_Style_Alignment::HORIZONTAL_LEFT => 1, PHPExcel_Style_Alignment::HORIZONTAL_LEFT => 1,
PHPExcel_Style_Alignment::HORIZONTAL_CENTER => 2, PHPExcel_Style_Alignment::HORIZONTAL_CENTER => 2,
PHPExcel_Style_Alignment::HORIZONTAL_RIGHT => 3, PHPExcel_Style_Alignment::HORIZONTAL_RIGHT => 3,
PHPExcel_Style_Alignment::HORIZONTAL_FILL => 4,
PHPExcel_Style_Alignment::HORIZONTAL_JUSTIFY => 5, PHPExcel_Style_Alignment::HORIZONTAL_JUSTIFY => 5,
PHPExcel_Style_Alignment::HORIZONTAL_CENTER_CONTINUOUS => 6, PHPExcel_Style_Alignment::HORIZONTAL_CENTER_CONTINUOUS => 6,
); );

View File

@ -29,6 +29,7 @@ Fixed in develop branch for release v1.7.9a:
- Bugfix: (MBaker) - Problem with cloning worksheets - Bugfix: (MBaker) - Problem with cloning worksheets
- Feature: (amerov) - Implementation of the Excel HLOOKUP() function - Feature: (amerov) - Implementation of the Excel HLOOKUP() function
- Feature: (MBaker) - Added "Quote Prefix" to style settings (Excel2007 Reader and Writer only) - Feature: (MBaker) - Added "Quote Prefix" to style settings (Excel2007 Reader and Writer only)
- Feature: (MBaker) - Added Horizontal FILL alignment for Excel5 and Excel2007 Readers/Writers, and Horizontal DISTRIBUTED alignment for Excel2007 Reader/Writer
Fixed in develop branch for release v1.7.9: Fixed in develop branch for release v1.7.9:
- Feature: (MBaker) Include charts option for HTML Writer - Feature: (MBaker) Include charts option for HTML Writer