예제 #1
0
 /**
  * Write SHEETLAYOUT record
  */
 private function writeSheetLayout()
 {
     if (!$this->phpSheet->isTabColorSet()) {
         return;
     }
     $recordData = pack('vvVVVvv', 0x862, 0x0, 0x0, 0x0, 0x14, $this->colors[$this->phpSheet->getTabColor()->getRGB()], 0x0);
     $length = strlen($recordData);
     $record = 0x862;
     // Record identifier
     $header = pack('vv', $record, $length);
     $this->append($header . $recordData);
 }
예제 #2
0
 /**
  * Write SheetPr
  *
  * @param    \PHPExcel\Shared\XMLWriter        $objWriter        XML Writer
  * @param    \PHPExcel\Worksheet                $pSheet            Worksheet
  * @throws    \PHPExcel\Writer\Exception
  */
 private function writeSheetPr(\PHPExcel\Shared\XMLWriter $objWriter = null, \PHPExcel\Worksheet $pSheet = null)
 {
     // sheetPr
     $objWriter->startElement('sheetPr');
     //$objWriter->writeAttribute('codeName',        $pSheet->getTitle());
     if ($pSheet->getParent()->hasMacros()) {
         //if the workbook have macros, we need to have codeName for the sheet
         if ($pSheet->hasCodeName() == false) {
             $pSheet->setCodeName($pSheet->getTitle());
         }
         $objWriter->writeAttribute('codeName', $pSheet->getCodeName());
     }
     $autoFilterRange = $pSheet->getAutoFilter()->getRange();
     if (!empty($autoFilterRange)) {
         $objWriter->writeAttribute('filterMode', 1);
         $pSheet->getAutoFilter()->showHideRows();
     }
     // tabColor
     if ($pSheet->isTabColorSet()) {
         $objWriter->startElement('tabColor');
         $objWriter->writeAttribute('rgb', $pSheet->getTabColor()->getARGB());
         $objWriter->endElement();
     }
     // outlinePr
     $objWriter->startElement('outlinePr');
     $objWriter->writeAttribute('summaryBelow', $pSheet->getShowSummaryBelow() ? '1' : '0');
     $objWriter->writeAttribute('summaryRight', $pSheet->getShowSummaryRight() ? '1' : '0');
     $objWriter->endElement();
     // pageSetUpPr
     if ($pSheet->getPageSetup()->getFitToPage()) {
         $objWriter->startElement('pageSetUpPr');
         $objWriter->writeAttribute('fitToPage', '1');
         $objWriter->endElement();
     }
     $objWriter->endElement();
 }