Example #1
0
 /**
  * Write BorderPr
  *
  * @param 	PHPExcel_Shared_XMLWriter		$objWriter 		XML Writer
  * @param 	string							$pName			Element name
  * @param 	PHPExcel_Style_Border			$pBorder		Border style
  * @throws 	Exception
  */
 private function _writeBorderPr(PHPExcel_Shared_XMLWriter $objWriter = null, $pName = 'left', PHPExcel_Style_Border $pBorder = null)
 {
     // Write BorderPr
     if ($pBorder->getBorderStyle() != PHPExcel_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();
     }
 }
Example #2
0
 /**
  * Create CSS style (PHPExcel_Style_Border)
  *
  * @param	PHPExcel_Style_Border		$pStyle			PHPExcel_Style_Border
  * @return	string
  */
 private function _createCSSStyleBorder(PHPExcel_Style_Border $pStyle)
 {
     // Create CSS
     //		$css = $this->_mapBorderStyle($pStyle->getBorderStyle()) . ' #' . $pStyle->getColor()->getRGB();
     //	Create CSS - add !important to non-none border styles for merged cells
     $borderStyle = $this->_mapBorderStyle($pStyle->getBorderStyle());
     $css = $borderStyle . ' #' . $pStyle->getColor()->getRGB() . ($borderStyle == 'none' ? '' : ' !important');
     // Return
     return $css;
 }
Example #3
0
 /**
  * Get Horizontal
  *
  * @return PHPExcel_Style_Border
  */
 public function getHorizontal()
 {
     $property = $this->propertyGetBound();
     if (isset($property->_horizontal)) {
         return $property->_horizontal;
     }
     $property = new PHPExcel_Style_Border();
     $property->propertyPrepareBind($this, "_horizontal");
     return $property;
 }
Example #4
0
 /**
  * Create CSS style (PHPExcel_Style_Border)
  *
  * @param	PHPExcel_Style_Border		$pStyle			PHPExcel_Style_Border
  * @return	string
  */
 private function _createCSSStyleBorder(PHPExcel_Style_Border $pStyle)
 {
     // Construct HTML
     $css = '';
     // Create CSS
     $css .= $this->_mapBorderStyle($pStyle->getBorderStyle()) . ' #' . $pStyle->getColor()->getRGB();
     // Return
     return $css;
 }
Example #5
0
 /**
  * Create CSS style (PHPExcel_Style_Border)
  *
  * @param	PHPExcel_Style_Border		$pStyle			PHPExcel_Style_Border
  * @return	string
  */
 private function _createCSSStyleBorder(PHPExcel_Style_Border $pStyle, PHPExcel_Style_Fill $fill)
 {
     // Construct HTML
     $css = '';
     // Create CSS
     $borderWidth = $this->_mapBorderStyle($pStyle->getBorderStyle());
     if ($borderWidth == '0px' && $this->_isPdf) {
         //	tcPDF treats a 0px border with a colour of black as a thick black border, so we set the colour to the
         //		background colour for the cell if we're generating PDF output
         $bValue = $fill->getFillType() == PHPExcel_Style_Fill::FILL_NONE ? 'FFFFFF' : $fill->getStartColor()->getRGB();
         $css .= $borderWidth . ' #' . $bValue;
     } else {
         $css .= $borderWidth . ' #' . $pStyle->getColor()->getRGB();
     }
     // Return
     return $css;
 }
Example #6
0
 /**
  * Create a new PHPExcel_Style_Borders
  */
 public function __construct($isSupervisor = false)
 {
     // Supervisor?
     $this->_isSupervisor = $isSupervisor;
     // Initialise values
     $this->_left = new PHPExcel_Style_Border($isSupervisor);
     $this->_right = new PHPExcel_Style_Border($isSupervisor);
     $this->_top = new PHPExcel_Style_Border($isSupervisor);
     $this->_bottom = new PHPExcel_Style_Border($isSupervisor);
     $this->_diagonal = new PHPExcel_Style_Border($isSupervisor);
     $this->_diagonalDirection = PHPExcel_Style_Borders::DIAGONAL_NONE;
     // Specially for supervisor
     if ($isSupervisor) {
         // Initialize pseudo-borders
         $this->_allBorders = new PHPExcel_Style_Border(true);
         $this->_outline = new PHPExcel_Style_Border(true);
         $this->_inside = new PHPExcel_Style_Border(true);
         $this->_vertical = new PHPExcel_Style_Border(true);
         $this->_horizontal = new PHPExcel_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');
     }
 }
Example #7
0
 /**
  * Create a new PHPExcel_Style_Borders
  *
  * @param    boolean    $isSupervisor    Flag indicating if this is a supervisor or not
  *                                    Leave this value at default unless you understand exactly what
  *                                        its ramifications are
  * @param    boolean    $isConditional    Flag indicating if this is a conditional style or not
  *                                    Leave this value at default unless you understand exactly what
  *                                        its ramifications are
  */
 public function __construct($isSupervisor = false, $isConditional = false)
 {
     // Supervisor?
     parent::__construct($isSupervisor);
     // Initialise values
     $this->left = new PHPExcel_Style_Border($isSupervisor, $isConditional);
     $this->right = new PHPExcel_Style_Border($isSupervisor, $isConditional);
     $this->top = new PHPExcel_Style_Border($isSupervisor, $isConditional);
     $this->bottom = new PHPExcel_Style_Border($isSupervisor, $isConditional);
     $this->diagonal = new PHPExcel_Style_Border($isSupervisor, $isConditional);
     $this->diagonalDirection = PHPExcel_Style_Borders::DIAGONAL_NONE;
     // Specially for supervisor
     if ($isSupervisor) {
         // Initialize pseudo-borders
         $this->allBorders = new PHPExcel_Style_Border(true);
         $this->outline = new PHPExcel_Style_Border(true);
         $this->inside = new PHPExcel_Style_Border(true);
         $this->vertical = new PHPExcel_Style_Border(true);
         $this->horizontal = new PHPExcel_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');
     }
 }