/** * Write BorderPr * * @param Shared_XMLWriter $objWriter XML Writer * @param string $pName Element name * @param Style_Border $pBorder Border style * @throws Exception */ private function _writeBorderPr(Shared_XMLWriter $objWriter = null, $pName = 'left', Style_Border $pBorder = null) { // Write BorderPr if ($pBorder->getBorderStyle() != Style_Border::BORDER_NONE) { $objWriter->startElement($pName); $objWriter->writeAttribute('style', $pBorder->getBorderStyle()); // color $objWriter->startElement('color'); $objWriter->writeAttribute('rgb', $pBorder->getColor()->getARGB()); $objWriter->endElement(); $objWriter->endElement(); } }
/** * Create a new Style_Borders */ public function __construct($isSupervisor = false) { // Supervisor? $this->_isSupervisor = $isSupervisor; // Initialise values $this->_left = new Style_Border($isSupervisor); $this->_right = new Style_Border($isSupervisor); $this->_top = new Style_Border($isSupervisor); $this->_bottom = new Style_Border($isSupervisor); $this->_diagonal = new Style_Border($isSupervisor); $this->_diagonalDirection = Style_Borders::DIAGONAL_NONE; // Specially for supervisor if ($isSupervisor) { // Initialize pseudo-borders $this->_allBorders = new Style_Border(true); $this->_outline = new Style_Border(true); $this->_inside = new Style_Border(true); $this->_vertical = new Style_Border(true); $this->_horizontal = new Style_Border(true); // bind parent if we are a supervisor $this->_left->bindParent($this, '_left'); $this->_right->bindParent($this, '_right'); $this->_top->bindParent($this, '_top'); $this->_bottom->bindParent($this, '_bottom'); $this->_diagonal->bindParent($this, '_diagonal'); $this->_allBorders->bindParent($this, '_allBorders'); $this->_outline->bindParent($this, '_outline'); $this->_inside->bindParent($this, '_inside'); $this->_vertical->bindParent($this, '_vertical'); $this->_horizontal->bindParent($this, '_horizontal'); } }
/** * Create CSS style (Style_Border) * * @param Style_Border $pStyle Style_Border * @return string */ private function _createCSSStyleBorder(Style_Border $pStyle) { // Construct HTML $css = ''; // Create CSS $css .= $this->_mapBorderStyle($pStyle->getBorderStyle()) . ' #' . $pStyle->getColor()->getRGB(); // Return return $css; }