当前位置: 首页>>代码示例>>PHP>>正文


PHP PHPExcel_Style::getDefaultStyle方法代码示例

本文整理汇总了PHP中PHPExcel_Style::getDefaultStyle方法的典型用法代码示例。如果您正苦于以下问题:PHP PHPExcel_Style::getDefaultStyle方法的具体用法?PHP PHPExcel_Style::getDefaultStyle怎么用?PHP PHPExcel_Style::getDefaultStyle使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在PHPExcel_Style的用法示例。


在下文中一共展示了PHPExcel_Style::getDefaultStyle方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: _writeCellStyleXf

 /**
  * Write Cell Style Xf
  *
  * @param 	PHPExcel_Shared_XMLWriter			$objWriter 		XML Writer
  * @param 	PHPExcel_Style						$pStyle			Style
  * @throws 	Exception
  */
 private function _writeCellStyleXf(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel_Style $pStyle = null)
 {
     // xf
     $objWriter->startElement('xf');
     $objWriter->writeAttribute('xfId', 0);
     $objWriter->writeAttribute('fontId', (int) $this->getParentWriter()->getFontHashTable()->getIndexForHashCode($pStyle->getFont()->getHashCode()));
     $objWriter->writeAttribute('numFmtId', (int) ($this->getParentWriter()->getNumFmtHashTable()->getIndexForHashCode($pStyle->getNumberFormat()->getHashCode()) + 164));
     $objWriter->writeAttribute('fillId', (int) $this->getParentWriter()->getFillHashTable()->getIndexForHashCode($pStyle->getFill()->getHashCode()));
     $objWriter->writeAttribute('borderId', (int) $this->getParentWriter()->getBordersHashTable()->getIndexForHashCode($pStyle->getBorders()->getHashCode()));
     // Apply styles?
     $objWriter->writeAttribute('applyFont', PHPExcel_Style::getDefaultStyle()->getFont()->getHashCode() != $pStyle->getFont()->getHashCode() ? '1' : '0');
     $objWriter->writeAttribute('applyNumberFormat', PHPExcel_Style::getDefaultStyle()->getNumberFormat()->getHashCode() != $pStyle->getNumberFormat()->getHashCode() ? '1' : '0');
     $objWriter->writeAttribute('applyFill', PHPExcel_Style::getDefaultStyle()->getFill()->getHashCode() != $pStyle->getFill()->getHashCode() ? '1' : '0');
     $objWriter->writeAttribute('applyBorder', PHPExcel_Style::getDefaultStyle()->getBorders()->getHashCode() != $pStyle->getBorders()->getHashCode() ? '1' : '0');
     $objWriter->writeAttribute('applyAlignment', PHPExcel_Style::getDefaultStyle()->getAlignment()->getHashCode() != $pStyle->getAlignment()->getHashCode() ? '1' : '0');
     if ($pStyle->getProtection()->getLocked() != PHPExcel_Style_Protection::PROTECTION_INHERIT || $pStyle->getProtection()->getHidden() != PHPExcel_Style_Protection::PROTECTION_INHERIT) {
         $objWriter->writeAttribute('applyProtection', 'true');
     }
     // alignment
     $objWriter->startElement('alignment');
     $objWriter->writeAttribute('horizontal', $pStyle->getAlignment()->getHorizontal());
     $objWriter->writeAttribute('vertical', $pStyle->getAlignment()->getVertical());
     $textRotation = 0;
     if ($pStyle->getAlignment()->getTextRotation() >= 0) {
         $textRotation = $pStyle->getAlignment()->getTextRotation();
     } else {
         if ($pStyle->getAlignment()->getTextRotation() < 0) {
             $textRotation = 90 - $pStyle->getAlignment()->getTextRotation();
         }
     }
     $objWriter->writeAttribute('textRotation', $textRotation);
     $objWriter->writeAttribute('wrapText', $pStyle->getAlignment()->getWrapText() ? 'true' : 'false');
     $objWriter->writeAttribute('shrinkToFit', $pStyle->getAlignment()->getShrinkToFit() ? 'true' : 'false');
     if ($pStyle->getAlignment()->getIndent() > 0) {
         $objWriter->writeAttribute('indent', $pStyle->getAlignment()->getIndent());
     }
     $objWriter->endElement();
     // protection
     if ($pStyle->getProtection()->getLocked() != PHPExcel_Style_Protection::PROTECTION_INHERIT || $pStyle->getProtection()->getHidden() != PHPExcel_Style_Protection::PROTECTION_INHERIT) {
         $objWriter->startElement('protection');
         if ($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() != PHPExcel_Style_Protection::PROTECTION_INHERIT) {
             $objWriter->writeAttribute('hidden', $pStyle->getProtection()->getHidden() == PHPExcel_Style_Protection::PROTECTION_PROTECTED ? 'true' : 'false');
         }
         $objWriter->endElement();
     }
     $objWriter->endElement();
 }
开发者ID:TiMoChao,项目名称:xingfu,代码行数:57,代码来源:Style.php

示例2: getDefaultStyle

 /**
  * Get default style
  *
  * @return 	PHPExcel_Style
  * @throws 	Exception
  */
 public function getDefaultStyle()
 {
     return PHPExcel_Style::getDefaultStyle();
 }
开发者ID:nagiro,项目名称:hospici_cultural,代码行数:10,代码来源:Worksheet.php


注:本文中的PHPExcel_Style::getDefaultStyle方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。