本文整理汇总了PHP中PHPExcel_Style_Font::getStriketrough方法的典型用法代码示例。如果您正苦于以下问题:PHP PHPExcel_Style_Font::getStriketrough方法的具体用法?PHP PHPExcel_Style_Font::getStriketrough怎么用?PHP PHPExcel_Style_Font::getStriketrough使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PHPExcel_Style_Font
的用法示例。
在下文中一共展示了PHPExcel_Style_Font::getStriketrough方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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;
} else {
if ($this->_font->getSubScript()) {
$sss = 2;
} else {
$sss = 0;
}
}
$bFamily = 0;
// Font family
$bCharSet = 0;
// Character set
$record = 0x31;
// Record identifier
$reserved = 0x0;
// Reserved
$grbit = 0x0;
// Font attributes
if ($this->_font->getItalic()) {
$grbit |= 0x2;
}
if ($this->_font->getStriketrough()) {
$grbit |= 0x8;
}
if ($font_outline) {
$grbit |= 0x10;
}
if ($font_shadow) {
$grbit |= 0x20;
}
if ($this->_BIFFVersion == 0x500) {
$data = pack("vvvvvCCCCC", $this->_font->getSize() * 20, $grbit, $icv, $this->_mapBold($this->_font->getBold()), $sss, $this->_mapUnderline($this->_font->getUnderline()), $bFamily, $bCharSet, $reserved, strlen($this->_font->getName()));
$data .= $this->_font->getName();
} elseif ($this->_BIFFVersion == 0x600) {
$data = pack("vvvvvCCCC", $this->_font->getSize() * 20, $grbit, $icv, $this->_mapBold($this->_font->getBold()), $sss, $this->_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;
}
示例2: _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();
}
示例3: _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;
}
示例4: _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();
}