예제 #1
0
 /**
  * Write Border
  *
  * @param     \PHPExcel\Shared\XMLWriter            $objWriter         XML Writer
  * @param     \PHPExcel\Style\Borders                $pBorders        Borders style
  * @throws     \PHPExcel\Writer\Exception
  */
 private function writeBorder(\PHPExcel\Shared\XMLWriter $objWriter = null, \PHPExcel\Style\Borders $pBorders = null)
 {
     // Write border
     $objWriter->startElement('border');
     // Diagonal?
     switch ($pBorders->getDiagonalDirection()) {
         case \PHPExcel\Style\Borders::DIAGONAL_UP:
             $objWriter->writeAttribute('diagonalUp', 'true');
             $objWriter->writeAttribute('diagonalDown', 'false');
             break;
         case \PHPExcel\Style\Borders::DIAGONAL_DOWN:
             $objWriter->writeAttribute('diagonalUp', 'false');
             $objWriter->writeAttribute('diagonalDown', 'true');
             break;
         case \PHPExcel\Style\Borders::DIAGONAL_BOTH:
             $objWriter->writeAttribute('diagonalUp', 'true');
             $objWriter->writeAttribute('diagonalDown', 'true');
             break;
     }
     // BorderPr
     $this->writeBorderPr($objWriter, 'left', $pBorders->getLeft());
     $this->writeBorderPr($objWriter, 'right', $pBorders->getRight());
     $this->writeBorderPr($objWriter, 'top', $pBorders->getTop());
     $this->writeBorderPr($objWriter, 'bottom', $pBorders->getBottom());
     $this->writeBorderPr($objWriter, 'diagonal', $pBorders->getDiagonal());
     $objWriter->endElement();
 }
예제 #2
0
 /**
  * Create CSS style (\PHPExcel\Style\Borders)
  *
  * @param    \PHPExcel\Style\Borders        $pStyle            \PHPExcel\Style\Borders
  * @return    array
  */
 private function createCSSStyleBorders(\PHPExcel\Style\Borders $pStyle)
 {
     // Construct CSS
     $css = array();
     // Create CSS
     $css['border-bottom'] = $this->createCSSStyleBorder($pStyle->getBottom());
     $css['border-top'] = $this->createCSSStyleBorder($pStyle->getTop());
     $css['border-left'] = $this->createCSSStyleBorder($pStyle->getLeft());
     $css['border-right'] = $this->createCSSStyleBorder($pStyle->getRight());
     return $css;
 }