Support for cell readorder Context/LTR/RTL
This commit is contained in:
parent
125f39c745
commit
d777d0283d
|
@ -1893,6 +1893,7 @@ class PHPExcel_Reader_Excel2007 extends PHPExcel_Reader_Abstract implements PHPE
|
||||||
$docStyle->getAlignment()->setWrapText(self::boolean((string) $style->alignment["wrapText"]));
|
$docStyle->getAlignment()->setWrapText(self::boolean((string) $style->alignment["wrapText"]));
|
||||||
$docStyle->getAlignment()->setShrinkToFit(self::boolean((string) $style->alignment["shrinkToFit"]));
|
$docStyle->getAlignment()->setShrinkToFit(self::boolean((string) $style->alignment["shrinkToFit"]));
|
||||||
$docStyle->getAlignment()->setIndent( intval((string)$style->alignment["indent"]) > 0 ? intval((string)$style->alignment["indent"]) : 0 );
|
$docStyle->getAlignment()->setIndent( intval((string)$style->alignment["indent"]) > 0 ? intval((string)$style->alignment["indent"]) : 0 );
|
||||||
|
$docStyle->getAlignment()->setReadorder( intval((string)$style->alignment["readingOrder"]) > 0 ? intval((string)$style->alignment["readingOrder"]) : 0 );
|
||||||
}
|
}
|
||||||
|
|
||||||
// protection
|
// protection
|
||||||
|
|
|
@ -52,15 +52,20 @@ class PHPExcel_Style_Alignment extends PHPExcel_Style_Supervisor implements PHPE
|
||||||
const VERTICAL_JUSTIFY = 'justify';
|
const VERTICAL_JUSTIFY = 'justify';
|
||||||
const VERTICAL_DISTRIBUTED = 'distributed'; // Excel2007 only
|
const VERTICAL_DISTRIBUTED = 'distributed'; // Excel2007 only
|
||||||
|
|
||||||
|
/* Read order */
|
||||||
|
const READORDER_CONTEXT = 0;
|
||||||
|
const READORDER_LTR = 1;
|
||||||
|
const READORDER_RTL = 2;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Horizontal
|
* Horizontal alignment
|
||||||
*
|
*
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
protected $_horizontal = PHPExcel_Style_Alignment::HORIZONTAL_GENERAL;
|
protected $_horizontal = PHPExcel_Style_Alignment::HORIZONTAL_GENERAL;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Vertical
|
* Vertical alignment
|
||||||
*
|
*
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
|
@ -69,7 +74,7 @@ class PHPExcel_Style_Alignment extends PHPExcel_Style_Supervisor implements PHPE
|
||||||
/**
|
/**
|
||||||
* Text rotation
|
* Text rotation
|
||||||
*
|
*
|
||||||
* @var int
|
* @var integer
|
||||||
*/
|
*/
|
||||||
protected $_textRotation = 0;
|
protected $_textRotation = 0;
|
||||||
|
|
||||||
|
@ -90,10 +95,17 @@ class PHPExcel_Style_Alignment extends PHPExcel_Style_Supervisor implements PHPE
|
||||||
/**
|
/**
|
||||||
* Indent - only possible with horizontal alignment left and right
|
* Indent - only possible with horizontal alignment left and right
|
||||||
*
|
*
|
||||||
* @var int
|
* @var integer
|
||||||
*/
|
*/
|
||||||
protected $_indent = 0;
|
protected $_indent = 0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Read order
|
||||||
|
*
|
||||||
|
* @var integer
|
||||||
|
*/
|
||||||
|
protected $_readorder = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new PHPExcel_Style_Alignment
|
* Create a new PHPExcel_Style_Alignment
|
||||||
*
|
*
|
||||||
|
@ -180,6 +192,9 @@ class PHPExcel_Style_Alignment extends PHPExcel_Style_Supervisor implements PHPE
|
||||||
if (isset($pStyles['indent'])) {
|
if (isset($pStyles['indent'])) {
|
||||||
$this->setIndent($pStyles['indent']);
|
$this->setIndent($pStyles['indent']);
|
||||||
}
|
}
|
||||||
|
if (isset($pStyles['readorder'])) {
|
||||||
|
$this->setReadorder($pStyles['readorder']);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
throw new PHPExcel_Exception("Invalid style array passed.");
|
throw new PHPExcel_Exception("Invalid style array passed.");
|
||||||
|
@ -389,6 +404,37 @@ class PHPExcel_Style_Alignment extends PHPExcel_Style_Supervisor implements PHPE
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get read order
|
||||||
|
*
|
||||||
|
* @return integer
|
||||||
|
*/
|
||||||
|
public function getReadorder() {
|
||||||
|
if ($this->_isSupervisor) {
|
||||||
|
return $this->getSharedComponent()->getReadorder();
|
||||||
|
}
|
||||||
|
return $this->_readorder;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set read order
|
||||||
|
*
|
||||||
|
* @param int $pValue
|
||||||
|
* @return PHPExcel_Style_Alignment
|
||||||
|
*/
|
||||||
|
public function setReadorder($pValue = 0) {
|
||||||
|
if ($pValue < 0 || $pValue > 2) {
|
||||||
|
$pValue = 0;
|
||||||
|
}
|
||||||
|
if ($this->_isSupervisor) {
|
||||||
|
$styleArray = $this->getStyleArray(array('readorder' => $pValue));
|
||||||
|
$this->getActiveSheet()->getStyle($this->getSelectedCells())->applyFromArray($styleArray);
|
||||||
|
} else {
|
||||||
|
$this->_readorder = $pValue;
|
||||||
|
}
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get hash code
|
* Get hash code
|
||||||
*
|
*
|
||||||
|
@ -405,6 +451,7 @@ class PHPExcel_Style_Alignment extends PHPExcel_Style_Supervisor implements PHPE
|
||||||
. ($this->_wrapText ? 't' : 'f')
|
. ($this->_wrapText ? 't' : 'f')
|
||||||
. ($this->_shrinkToFit ? 't' : 'f')
|
. ($this->_shrinkToFit ? 't' : 'f')
|
||||||
. $this->_indent
|
. $this->_indent
|
||||||
|
. $this->_readorder
|
||||||
. __CLASS__
|
. __CLASS__
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -439,6 +439,9 @@ class PHPExcel_Writer_Excel2007_Style extends PHPExcel_Writer_Excel2007_WriterPa
|
||||||
if ($pStyle->getAlignment()->getIndent() > 0) {
|
if ($pStyle->getAlignment()->getIndent() > 0) {
|
||||||
$objWriter->writeAttribute('indent', $pStyle->getAlignment()->getIndent());
|
$objWriter->writeAttribute('indent', $pStyle->getAlignment()->getIndent());
|
||||||
}
|
}
|
||||||
|
if ($pStyle->getAlignment()->getReadorder() > 0) {
|
||||||
|
$objWriter->writeAttribute('readingOrder', $pStyle->getAlignment()->getReadorder());
|
||||||
|
}
|
||||||
$objWriter->endElement();
|
$objWriter->endElement();
|
||||||
|
|
||||||
// protection
|
// protection
|
||||||
|
|
Loading…
Reference in New Issue