示例#1
0
 /**
  * Write the WSBOOL BIFF record, mainly for fit-to-page. Used in conjunction
  * with the SETUP record.
  */
 private function writeWsbool()
 {
     $record = 0x81;
     // Record identifier
     $length = 0x2;
     // Bytes to follow
     $grbit = 0x0;
     // The only option that is of interest is the flag for fit to page. So we
     // set all the options in one go.
     //
     // Set the option flags
     $grbit |= 0x1;
     // Auto page breaks visible
     if ($this->outlineStyle) {
         $grbit |= 0x20;
         // Auto outline styles
     }
     if ($this->phpSheet->getShowSummaryBelow()) {
         $grbit |= 0x40;
         // Outline summary below
     }
     if ($this->phpSheet->getShowSummaryRight()) {
         $grbit |= 0x80;
         // Outline summary right
     }
     if ($this->phpSheet->getPageSetup()->getFitToPage()) {
         $grbit |= 0x100;
         // Page setup fit to page
     }
     if ($this->outlineOn) {
         $grbit |= 0x400;
         // Outline symbols displayed
     }
     $header = pack("vv", $record, $length);
     $data = pack("v", $grbit);
     $this->append($header . $data);
 }
示例#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();
 }