private function PHPExcel_Writer_Excel2007_Style::_writeFont in Loft Data Grids 6.2
Same name and namespace in other branches
- 7.2 vendor/phpoffice/phpexcel/Classes/PHPExcel/Writer/Excel2007/Style.php \PHPExcel_Writer_Excel2007_Style::_writeFont()
* Write Font * *
Parameters
PHPExcel_Shared_XMLWriter $objWriter XML Writer: * @param PHPExcel_Style_Font $pFont Font style * @throws PHPExcel_Writer_Exception
2 calls to PHPExcel_Writer_Excel2007_Style::_writeFont()
- PHPExcel_Writer_Excel2007_Style::writeStyles in vendor/
phpoffice/ phpexcel/ Classes/ PHPExcel/ Writer/ Excel2007/ Style.php - * Write styles to XML format * *
- PHPExcel_Writer_Excel2007_Style::_writeCellStyleDxf in vendor/
phpoffice/ phpexcel/ Classes/ PHPExcel/ Writer/ Excel2007/ Style.php - * Write Cell Style Dxf * *
File
- vendor/
phpoffice/ phpexcel/ Classes/ PHPExcel/ Writer/ Excel2007/ Style.php, line 277
Class
- PHPExcel_Writer_Excel2007_Style
- PHPExcel_Writer_Excel2007_Style
Code
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();
}