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


PHP PHPExcel_Style_Font::getName方法代码示例

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


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

示例1: writeFont

 /**
  * Get font record data
  *
  * @return string
  */
 public function writeFont()
 {
     $font_outline = 0;
     $font_shadow = 0;
     $icv = $this->colorIndex;
     // Index to color palette
     if ($this->font->getSuperScript()) {
         $sss = 1;
     } elseif ($this->font->getSubScript()) {
         $sss = 2;
     } else {
         $sss = 0;
     }
     $bFamily = 0;
     // Font family
     $bCharSet = PHPExcel_Shared_Font::getCharsetFromFontName($this->font->getName());
     // Character set
     $record = 0x31;
     // Record identifier
     $reserved = 0x0;
     // Reserved
     $grbit = 0x0;
     // Font attributes
     if ($this->font->getItalic()) {
         $grbit |= 0x2;
     }
     if ($this->font->getStrikethrough()) {
         $grbit |= 0x8;
     }
     if ($font_outline) {
         $grbit |= 0x10;
     }
     if ($font_shadow) {
         $grbit |= 0x20;
     }
     $data = pack("vvvvvCCCC", $this->font->getSize() * 20, $grbit, $icv, self::mapBold($this->font->getBold()), $sss, self::mapUnderline($this->font->getUnderline()), $bFamily, $bCharSet, $reserved);
     $data .= PHPExcel_Shared_String::UTF8toBIFF8UnicodeShort($this->font->getName());
     $length = strlen($data);
     $header = pack("vv", $record, $length);
     return $header . $data;
 }
开发者ID:alyayazilim,项目名称:E-Ticaret-2015,代码行数:46,代码来源:Font.php

示例2: _createCSSStyleFont

 /**
  * Create CSS style (PHPExcel_Style_Font)
  *
  * @param	PHPExcel_Style_Font		$pStyle			PHPExcel_Style_Font
  * @return	array
  */
 private function _createCSSStyleFont(PHPExcel_Style_Font $pStyle)
 {
     // Construct CSS
     $css = array();
     // Create CSS
     if ($pStyle->getBold()) {
         $css['font-weight'] = 'bold';
     }
     if ($pStyle->getUnderline() != PHPExcel_Style_Font::UNDERLINE_NONE && $pStyle->getStrikethrough()) {
         $css['text-decoration'] = 'underline line-through';
     } else {
         if ($pStyle->getUnderline() != PHPExcel_Style_Font::UNDERLINE_NONE) {
             $css['text-decoration'] = 'underline';
         } else {
             if ($pStyle->getStrikethrough()) {
                 $css['text-decoration'] = 'line-through';
             }
         }
     }
     if ($pStyle->getItalic()) {
         $css['font-style'] = 'italic';
     }
     $css['color'] = '#' . $pStyle->getColor()->getRGB();
     $css['font-family'] = '\'' . $pStyle->getName() . '\'';
     $css['font-size'] = $pStyle->getSize() . 'pt';
     // Return
     return $css;
 }
开发者ID:adit-gudhel,项目名称:simpus-dev,代码行数:34,代码来源:HTML.php

示例3: _writeFont

 /**
  * Write Font
  *
  * @param 	PHPExcel_Shared_XMLWriter		$objWriter 		XML Writer
  * @param 	PHPExcel_Style_Font				$pFont			Font style
  * @throws 	Exception
  */
 private function _writeFont(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel_Style_Font $pFont = null)
 {
     // font
     $objWriter->startElement('font');
     // Name
     $objWriter->startElement('name');
     $objWriter->writeAttribute('val', $pFont->getName());
     $objWriter->endElement();
     // Size
     $objWriter->startElement('sz');
     $objWriter->writeAttribute('val', $pFont->getSize());
     $objWriter->endElement();
     // Bold. We explicitly write this element also when false (like MS Office Excel 2007 does
     // for conditional formatting). Otherwise it will apparently not be picked up in conditional
     // formatting style dialog
     $objWriter->startElement('b');
     $objWriter->writeAttribute('val', $pFont->getBold() ? '1' : '0');
     $objWriter->endElement();
     // Italic
     $objWriter->startElement('i');
     $objWriter->writeAttribute('val', $pFont->getItalic() ? '1' : '0');
     $objWriter->endElement();
     // Superscript / subscript
     if ($pFont->getSuperScript() || $pFont->getSubScript()) {
         $objWriter->startElement('vertAlign');
         if ($pFont->getSuperScript()) {
             $objWriter->writeAttribute('val', 'superscript');
         } else {
             if ($pFont->getSubScript()) {
                 $objWriter->writeAttribute('val', 'subscript');
             }
         }
         $objWriter->endElement();
     }
     // Underline
     $objWriter->startElement('u');
     $objWriter->writeAttribute('val', $pFont->getUnderline());
     $objWriter->endElement();
     // Strikethrough
     $objWriter->startElement('strike');
     $objWriter->writeAttribute('val', $pFont->getStrikethrough() ? '1' : '0');
     $objWriter->endElement();
     // Foreground color
     $objWriter->startElement('color');
     $objWriter->writeAttribute('rgb', $pFont->getColor()->getARGB());
     $objWriter->endElement();
     $objWriter->endElement();
 }
开发者ID:echoOly,项目名称:php_base,代码行数:55,代码来源:Style.php

示例4: cellDimensionToPixels

 /**
  * Convert column width from (intrinsic) Excel units to pixels
  *
  * @param 	float	$pValue		Value in cell dimension
  * @param 	PHPExcel_Style_Font $pDefaultFont	Default font of the workbook
  * @return 	int		Value in pixels
  */
 public static function cellDimensionToPixels($pValue = 0, PHPExcel_Style_Font $pDefaultFont)
 {
     // Font name and size
     $name = $pDefaultFont->getName();
     $size = $pDefaultFont->getSize();
     if (isset(PHPExcel_Shared_Font::$defaultColumnWidths[$name][$size])) {
         // Exact width can be determined
         $colWidth = $pValue * PHPExcel_Shared_Font::$defaultColumnWidths[$name][$size]['px'] / PHPExcel_Shared_Font::$defaultColumnWidths[$name][$size]['width'];
     } else {
         // We don't have data for this particular font and size, use approximation by
         // extrapolating from Calibri 11
         $colWidth = $pValue * $size * PHPExcel_Shared_Font::$defaultColumnWidths['Calibri'][11]['px'] / PHPExcel_Shared_Font::$defaultColumnWidths['Calibri'][11]['width'] / 11;
     }
     // Round pixels to closest integer
     $colWidth = (int) round($colWidth);
     return $colWidth;
 }
开发者ID:JaeHoYun,项目名称:generatedata,代码行数:24,代码来源:Drawing.php

示例5: _writeFont

 /**
  * Write Font
  *
  * @param 	PHPExcel_Shared_XMLWriter		$objWriter 		XML Writer
  * @param 	PHPExcel_Style_Font				$pFont			Font style
  * @throws 	Exception
  */
 private function _writeFont(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel_Style_Font $pFont = null)
 {
     // font
     $objWriter->startElement('font');
     // Name
     $objWriter->startElement('name');
     $objWriter->writeAttribute('val', $pFont->getName());
     $objWriter->endElement();
     // Size
     $objWriter->startElement('sz');
     $objWriter->writeAttribute('val', $pFont->getSize());
     $objWriter->endElement();
     // Bold
     if ($pFont->getBold()) {
         $objWriter->startElement('b');
         $objWriter->writeAttribute('val', 'true');
         $objWriter->endElement();
     }
     // Italic
     if ($pFont->getItalic()) {
         $objWriter->startElement('i');
         $objWriter->writeAttribute('val', 'true');
         $objWriter->endElement();
     }
     // Superscript / subscript
     if ($pFont->getSuperScript() || $pFont->getSubScript()) {
         $objWriter->startElement('vertAlign');
         if ($pFont->getSuperScript()) {
             $objWriter->writeAttribute('val', 'superscript');
         } else {
             if ($pFont->getSubScript()) {
                 $objWriter->writeAttribute('val', 'subscript');
             }
         }
         $objWriter->endElement();
     }
     // Underline
     $objWriter->startElement('u');
     $objWriter->writeAttribute('val', $pFont->getUnderline());
     $objWriter->endElement();
     // Striketrough
     if ($pFont->getStriketrough()) {
         $objWriter->startElement('strike');
         $objWriter->writeAttribute('val', 'true');
         $objWriter->endElement();
     }
     // Foreground color
     $objWriter->startElement('color');
     $objWriter->writeAttribute('rgb', $pFont->getColor()->getARGB());
     $objWriter->endElement();
     $objWriter->endElement();
 }
开发者ID:TiMoChao,项目名称:xingfu,代码行数:59,代码来源:Style.php

示例6: _writeFont

 /**
  * Write Font
  *
  * @param 	PHPExcel_Shared_XMLWriter		$objWriter 		XML Writer
  * @param 	PHPExcel_Style_Font				$pFont			Font style
  * @throws 	PHPExcel_Writer_Exception
  */
 private function _writeFont(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel_Style_Font $pFont = null)
 {
     // font
     $objWriter->startElement('font');
     //	Weird! The order of these elements actually makes a difference when opening Excel2007
     //		files in Excel2003 with the compatibility pack. It's not documented behaviour,
     //		and makes for a real WTF!
     // Bold. We explicitly write this element also when false (like MS Office Excel 2007 does
     // for conditional formatting). Otherwise it will apparently not be picked up in conditional
     // formatting style dialog
     if ($pFont->getBold() !== NULL) {
         $objWriter->startElement('b');
         $objWriter->writeAttribute('val', $pFont->getBold() ? '1' : '0');
         $objWriter->endElement();
     }
     // Italic
     if ($pFont->getItalic() !== NULL) {
         $objWriter->startElement('i');
         $objWriter->writeAttribute('val', $pFont->getItalic() ? '1' : '0');
         $objWriter->endElement();
     }
     // Strikethrough
     if ($pFont->getStrikethrough() !== NULL) {
         $objWriter->startElement('strike');
         $objWriter->writeAttribute('val', $pFont->getStrikethrough() ? '1' : '0');
         $objWriter->endElement();
     }
     // Underline
     if ($pFont->getUnderline() !== NULL) {
         $objWriter->startElement('u');
         $objWriter->writeAttribute('val', $pFont->getUnderline());
         $objWriter->endElement();
     }
     // Superscript / subscript
     if ($pFont->getSuperScript() === TRUE || $pFont->getSubScript() === TRUE) {
         $objWriter->startElement('vertAlign');
         if ($pFont->getSuperScript() === TRUE) {
             $objWriter->writeAttribute('val', 'superscript');
         } else {
             if ($pFont->getSubScript() === TRUE) {
                 $objWriter->writeAttribute('val', 'subscript');
             }
         }
         $objWriter->endElement();
     }
     // Size
     if ($pFont->getSize() !== NULL) {
         $objWriter->startElement('sz');
         $objWriter->writeAttribute('val', $pFont->getSize());
         $objWriter->endElement();
     }
     // Foreground color
     if ($pFont->getColor()->getARGB() !== NULL) {
         $objWriter->startElement('color');
         $objWriter->writeAttribute('rgb', $pFont->getColor()->getARGB());
         $objWriter->endElement();
     }
     // Name
     if ($pFont->getName() !== NULL) {
         $objWriter->startElement('name');
         $objWriter->writeAttribute('val', $pFont->getName());
         $objWriter->endElement();
     }
     $objWriter->endElement();
 }
开发者ID:adit-gudhel,项目名称:simpus-dev,代码行数:72,代码来源:Style.php

示例7: getDefaultRowHeightByFont

 /**
  * Get the effective row height for rows without a row dimension or rows with height -1
  * For example, for Calibri 11 this is 15 points
  *
  * @param PHPExcel_Style_Font $font The workbooks default font
  * @return float Row height in points
  */
 public static function getDefaultRowHeightByFont(PHPExcel_Style_Font $font)
 {
     switch ($font->getName()) {
         case 'Arial':
             switch ($font->getSize()) {
                 case 10:
                     // inspection of Arial 10 workbook says 12.75pt ~17px
                     $rowHeight = 12.75;
                     break;
                 case 9:
                     // inspection of Arial 9 workbook says 12.00pt ~16px
                     $rowHeight = 12;
                     break;
                 case 8:
                     // inspection of Arial 8 workbook says 11.25pt ~15px
                     $rowHeight = 11.25;
                     break;
                 case 7:
                     // inspection of Arial 7 workbook says 9.00pt ~12px
                     $rowHeight = 9;
                     break;
                 case 6:
                 case 5:
                     // inspection of Arial 5,6 workbook says 8.25pt ~11px
                     $rowHeight = 8.25;
                     break;
                 case 4:
                     // inspection of Arial 4 workbook says 6.75pt ~9px
                     $rowHeight = 6.75;
                     break;
                 case 3:
                     // inspection of Arial 3 workbook says 6.00pt ~8px
                     $rowHeight = 6;
                     break;
                 case 2:
                 case 1:
                     // inspection of Arial 1,2 workbook says 5.25pt ~7px
                     $rowHeight = 5.25;
                     break;
                 default:
                     // use Arial 10 workbook as an approximation, extrapolation
                     $rowHeight = 12.75 * $font->getSize() / 10;
                     break;
             }
             break;
         case 'Calibri':
             switch ($font->getSize()) {
                 case 11:
                     // inspection of Calibri 11 workbook says 15.00pt ~20px
                     $rowHeight = 15;
                     break;
                 case 10:
                     // inspection of Calibri 10 workbook says 12.75pt ~17px
                     $rowHeight = 12.75;
                     break;
                 case 9:
                     // inspection of Calibri 9 workbook says 12.00pt ~16px
                     $rowHeight = 12;
                     break;
                 case 8:
                     // inspection of Calibri 8 workbook says 11.25pt ~15px
                     $rowHeight = 11.25;
                     break;
                 case 7:
                     // inspection of Calibri 7 workbook says 9.00pt ~12px
                     $rowHeight = 9;
                     break;
                 case 6:
                 case 5:
                     // inspection of Calibri 5,6 workbook says 8.25pt ~11px
                     $rowHeight = 8.25;
                     break;
                 case 4:
                     // inspection of Calibri 4 workbook says 6.75pt ~9px
                     $rowHeight = 6.75;
                     break;
                 case 3:
                     // inspection of Calibri 3 workbook says 6.00pt ~8px
                     $rowHeight = 6.0;
                     break;
                 case 2:
                 case 1:
                     // inspection of Calibri 1,2 workbook says 5.25pt ~7px
                     $rowHeight = 5.25;
                     break;
                 default:
                     // use Calibri 11 workbook as an approximation, extrapolation
                     $rowHeight = 15 * $font->getSize() / 11;
                     break;
             }
             break;
         case 'Verdana':
             switch ($font->getSize()) {
//.........这里部分代码省略.........
开发者ID:phpsmith,项目名称:IS4C,代码行数:101,代码来源:Font.php

示例8: _createCSSStyleFont

 /**
  * Create CSS style (PHPExcel_Style_Font)
  * 
  * @param	PHPExcel_Style_Font 		$pStyle			PHPExcel_Style_Font
  * @return	string
  */
 private function _createCSSStyleFont(PHPExcel_Style_Font $pStyle)
 {
     // Construct HTML
     $html = '';
     // Create CSS
     if ($pStyle->getBold()) {
         $html .= '        font-weight: bold;' . "\r\n";
     }
     if ($pStyle->getUnderline() != PHPExcel_Style_Font::UNDERLINE_NONE && $pStyle->getStriketrough()) {
         $html .= '        text-decoration: underline line-through;' . "\r\n";
     } else {
         if ($pStyle->getUnderline() != PHPExcel_Style_Font::UNDERLINE_NONE) {
             $html .= '        text-decoration: underline;' . "\r\n";
         } else {
             if ($pStyle->getStriketrough()) {
                 $html .= '        text-decoration: line-through;' . "\r\n";
             }
         }
     }
     if ($pStyle->getItalic()) {
         $html .= '        font-style: italic;' . "\r\n";
     }
     $html .= '        color: ' . '#' . $pStyle->getColor()->getRGB() . ';' . "\r\n";
     $html .= '        font-family: ' . $pStyle->getName() . ';' . "\r\n";
     $html .= '        font-size: ' . $pStyle->getSize() . 'pt;' . "\r\n";
     // Return
     return $html;
 }
开发者ID:laiello,项目名称:myopensources,代码行数:34,代码来源:HTML.php

示例9: _writeFont

 /**
  * Write Font
  *
  * @param 	PHPExcel_Shared_XMLWriter		$objWriter 		XML Writer
  * @param 	PHPExcel_Style_Font				$pFont			Font style
  * @throws 	Exception
  */
 private function _writeFont(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel_Style_Font $pFont = null)
 {
     // font
     $objWriter->startElement('font');
     // Name
     $objWriter->startElement('name');
     $objWriter->writeAttribute('val', $pFont->getName());
     $objWriter->endElement();
     // Size
     $objWriter->startElement('sz');
     $objWriter->writeAttribute('val', $pFont->getSize());
     $objWriter->endElement();
     // Bold
     $objWriter->startElement('b');
     $objWriter->writeAttribute('val', $pFont->getBold() ? 'true' : 'false');
     $objWriter->endElement();
     // Italic
     $objWriter->startElement('i');
     $objWriter->writeAttribute('val', $pFont->getItalic() ? 'true' : 'false');
     $objWriter->endElement();
     // Underline
     $objWriter->startElement('u');
     $objWriter->writeAttribute('val', $pFont->getUnderline());
     $objWriter->endElement();
     // Striketrough
     $objWriter->startElement('strike');
     $objWriter->writeAttribute('val', $pFont->getStriketrough() ? 'true' : 'false');
     $objWriter->endElement();
     // Foreground color
     $objWriter->startElement('color');
     $objWriter->writeAttribute('rgb', $pFont->getColor()->getARGB());
     $objWriter->endElement();
     $objWriter->endElement();
 }
开发者ID:hostellerie,项目名称:nexpro,代码行数:41,代码来源:Style.php


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