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


PHP PHPExcel_Style_Font::setStriketrough方法代码示例

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


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

示例1: _readFont

 /**
  * Read a FONT record
  */
 private function _readFont()
 {
     $length = $this->_GetInt2d($this->_data, $this->_pos + 2);
     $recordData = substr($this->_data, $this->_pos + 4, $length);
     // move stream pointer to next record
     $this->_pos += 4 + $length;
     if (!$this->_readDataOnly) {
         $objFont = new PHPExcel_Style_Font();
         // offset: 0; size: 2; height of the font (in twips = 1/20 of a point)
         $size = $this->_GetInt2d($recordData, 0);
         $objFont->setSize($size / 20);
         // offset: 2; size: 2; option flags
         // bit: 0; mask 0x0001; bold (redundant in BIFF5-BIFF8)
         // bit: 1; mask 0x0002; italic
         $isItalic = (0x2 & $this->_GetInt2d($recordData, 2)) >> 1;
         if ($isItalic) {
             $objFont->setItalic(true);
         }
         // bit: 2; mask 0x0004; underlined (redundant in BIFF5-BIFF8)
         // bit: 3; mask 0x0008; strike
         $isStrike = (0x8 & $this->_GetInt2d($recordData, 2)) >> 3;
         if ($isStrike) {
             $objFont->setStriketrough(true);
         }
         // offset: 4; size: 2; colour index
         $colorIndex = $this->_GetInt2d($recordData, 4);
         $objFont->colorIndex = $colorIndex;
         // offset: 6; size: 2; font weight
         $weight = $this->_GetInt2d($recordData, 6);
         switch ($weight) {
             case 0x2bc:
                 $objFont->setBold(true);
                 break;
         }
         // offset: 8; size: 2; escapement type
         $escapement = $this->_GetInt2d($recordData, 8);
         switch ($escapement) {
             case 0x1:
                 $objFont->setSuperScript(true);
                 break;
             case 0x2:
                 $objFont->setSubScript(true);
                 break;
         }
         // offset: 10; size: 1; underline type
         $underlineType = ord($recordData[10]);
         switch ($underlineType) {
             case 0x0:
                 break;
                 // no underline
             // no underline
             case 0x1:
                 $objFont->setUnderline(PHPExcel_Style_Font::UNDERLINE_SINGLE);
                 break;
             case 0x2:
                 $objFont->setUnderline(PHPExcel_Style_Font::UNDERLINE_DOUBLE);
                 break;
             case 0x21:
                 $objFont->setUnderline(PHPExcel_Style_Font::UNDERLINE_SINGLEACCOUNTING);
                 break;
             case 0x22:
                 $objFont->setUnderline(PHPExcel_Style_Font::UNDERLINE_DOUBLEACCOUNTING);
                 break;
         }
         // offset: 11; size: 1; font family
         // offset: 12; size: 1; character set
         // offset: 13; size: 1; not used
         // offset: 14; size: var; font name
         if ($this->_version == self::XLS_BIFF8) {
             $string = $this->_readUnicodeStringShort(substr($recordData, 14));
         } else {
             $string = $this->_readByteStringShort(substr($recordData, 14));
         }
         $objFont->setName($string['value']);
         $this->_objFonts[] = $objFont;
     }
 }
开发者ID:linhanwei,项目名称:TP,代码行数:80,代码来源:Excel5.php


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