Exemplo n.º 1
0
 /**
  * Write Cell Style Dxf
  *
  * @param     \PHPExcel\Shared\XMLWriter         $objWriter         XML Writer
  * @param     \PHPExcel\Style                    $pStyle            Style
  * @throws     \PHPExcel\Writer\Exception
  */
 private function writeCellStyleDxf(\PHPExcel\Shared\XMLWriter $objWriter = null, \PHPExcel\Style $pStyle = null)
 {
     // dxf
     $objWriter->startElement('dxf');
     // font
     $this->writeFont($objWriter, $pStyle->getFont());
     // numFmt
     $this->writeNumFmt($objWriter, $pStyle->getNumberFormat());
     // fill
     $this->writeFill($objWriter, $pStyle->getFill());
     // alignment
     $objWriter->startElement('alignment');
     if ($pStyle->getAlignment()->getHorizontal() !== null) {
         $objWriter->writeAttribute('horizontal', $pStyle->getAlignment()->getHorizontal());
     }
     if ($pStyle->getAlignment()->getVertical() !== null) {
         $objWriter->writeAttribute('vertical', $pStyle->getAlignment()->getVertical());
     }
     if ($pStyle->getAlignment()->getTextRotation() !== null) {
         $textRotation = 0;
         if ($pStyle->getAlignment()->getTextRotation() >= 0) {
             $textRotation = $pStyle->getAlignment()->getTextRotation();
         } elseif ($pStyle->getAlignment()->getTextRotation() < 0) {
             $textRotation = 90 - $pStyle->getAlignment()->getTextRotation();
         }
         $objWriter->writeAttribute('textRotation', $textRotation);
     }
     $objWriter->endElement();
     // border
     $this->writeBorder($objWriter, $pStyle->getBorders());
     // protection
     if ($pStyle->getProtection()->getLocked() !== null || $pStyle->getProtection()->getHidden() !== null) {
         if ($pStyle->getProtection()->getLocked() !== \PHPExcel\Style\Protection::PROTECTION_INHERIT || $pStyle->getProtection()->getHidden() !== \PHPExcel\Style\Protection::PROTECTION_INHERIT) {
             $objWriter->startElement('protection');
             if ($pStyle->getProtection()->getLocked() !== null && $pStyle->getProtection()->getLocked() !== \PHPExcel\Style\Protection::PROTECTION_INHERIT) {
                 $objWriter->writeAttribute('locked', $pStyle->getProtection()->getLocked() == \PHPExcel\Style\Protection::PROTECTION_PROTECTED ? 'true' : 'false');
             }
             if ($pStyle->getProtection()->getHidden() !== null && $pStyle->getProtection()->getHidden() !== \PHPExcel\Style\Protection::PROTECTION_INHERIT) {
                 $objWriter->writeAttribute('hidden', $pStyle->getProtection()->getHidden() == \PHPExcel\Style\Protection::PROTECTION_PROTECTED ? 'true' : 'false');
             }
             $objWriter->endElement();
         }
     }
     $objWriter->endElement();
 }
Exemplo n.º 2
0
 /**
  * Create CSS style
  *
  * @param    \PHPExcel\Style        $pStyle            PHPExcel_Style
  * @return    array
  */
 private function createCSSStyle(\PHPExcel\Style $pStyle)
 {
     // Construct CSS
     $css = '';
     // Create CSS
     $css = array_merge($this->createCSSStyleAlignment($pStyle->getAlignment()), $this->createCSSStyleBorders($pStyle->getBorders()), $this->createCSSStyleFont($pStyle->getFont()), $this->createCSSStyleFill($pStyle->getFill()));
     // Return
     return $css;
 }
Exemplo n.º 3
0
 /**
  * Get the currently active sheet. Only used for supervisor
  *
  * @return \PHPExcel\Worksheet
  */
 public function getActiveSheet()
 {
     return $this->parent->getActiveSheet();
 }
Exemplo n.º 4
0
 /**
  * Get hash code
  *
  * @return string    Hash code
  */
 public function getHashCode()
 {
     return md5($this->conditionType . $this->operatorType . implode(';', $this->condition) . $this->style->getHashCode() . __CLASS__);
 }