本文整理汇总了PHP中PHPExcel_Style::getFont方法的典型用法代码示例。如果您正苦于以下问题:PHP PHPExcel_Style::getFont方法的具体用法?PHP PHPExcel_Style::getFont怎么用?PHP PHPExcel_Style::getFont使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PHPExcel_Style
的用法示例。
在下文中一共展示了PHPExcel_Style::getFont方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: propertyBeginBind
/**
* Property Begin Bind
*
* If no PHPExcel_Style_Font has been bound to PHPExcel_Style then bind this one. Return the actual bound one.
*
* @return PHPExcel_Style_Font
*/
private function propertyBeginBind()
{
if (!isset($this->_parent)) {
return $this;
}
// I am already bound
if ($this->_parent->propertyIsBound($this->_parentPropertyName)) {
return $this->_parent->getFont();
}
// Another one is already bound
$this->_parent->propertyCompleteBind($this, $this->_parentPropertyName);
// Bind myself
$this->_parent = null;
return $this;
}
示例2: setDefaultStyle
/**
* Set default style - should only be used by PHPExcel_IReader implementations!
*
* @deprecated
* @param PHPExcel_Style $pValue
* @throws PHPExcel_Exception
* @return PHPExcel_Worksheet
*/
public function setDefaultStyle(PHPExcel_Style $pValue)
{
$this->_parent->getDefaultStyle()->applyFromArray(array('font' => array('name' => $pValue->getFont()->getName(), 'size' => $pValue->getFont()->getSize())));
return $this;
}
示例3: _createCSSStyle
/**
* Create CSS style
*
* @param PHPExcel_Style $pStyle PHPExcel_Style
* @return array
*/
private function _createCSSStyle(PHPExcel_Style $pStyle)
{
// Construct CSS
$css = '';
// Create CSS
$css = array_merge($this->_createCSSStyleAlignment($pStyle->getAlignment()), $this->_createCSSStyleBorders($pStyle->getBorders()), $this->_createCSSStyleFont($pStyle->getFont()), $this->_createCSSStyleFill($pStyle->getFill()));
// Return
return $css;
}
示例4: _writeCellStyleDxf
/**
* Write Cell Style Dxf
*
* @param PHPExcel_Shared_XMLWriter $objWriter XML Writer
* @param PHPExcel_Style $pStyle Style
* @throws Exception
*/
private function _writeCellStyleDxf(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel_Style $pStyle = null)
{
// dxf
$objWriter->startElement('dxf');
// font
$this->_writeFont($objWriter, $pStyle->getFont());
// numFmt
$this->_writeNumFmt($objWriter, $pStyle->getNumberFormat());
// fill
$this->_writeFill($objWriter, $pStyle->getFill());
// 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->endElement();
// border
$this->_writeBorder($objWriter, $pStyle->getBorders());
// 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();
}
示例5: date
error_reporting(E_ALL);
ini_set('display_errors', true);
ini_set('display_startup_errors', true);
date_default_timezone_set('Europe/London');
define('EOL', PHP_SAPI == 'cli' ? PHP_EOL : '<br />');
date_default_timezone_set('Europe/London');
/** Include PHPExcel */
require_once dirname(__FILE__) . '/../Classes/PHPExcel.php';
echo date('H:i:s'), " Create new PHPExcel object", EOL;
$objPHPExcel = new PHPExcel();
$worksheet = $objPHPExcel->getActiveSheet();
echo date('H:i:s'), " Create styles array", EOL;
$styles = array();
for ($i = 0; $i < 10; $i++) {
$style = new PHPExcel_Style();
$style->getFont()->setSize($i + 4);
$styles[] = $style;
}
echo date('H:i:s'), " Add data (begin)", EOL;
$t = microtime(true);
for ($col = 0; $col < 50; $col++) {
for ($row = 0; $row < 100; $row++) {
$str = $row + $col;
$style = $styles[$row % 10];
$coord = PHPExcel_Cell::stringFromColumnIndex($col) . ($row + 1);
$worksheet->setCellValue($coord, $str);
$worksheet->duplicateStyle($style, $coord);
}
}
$d = microtime(true) - $t;
echo date('H:i:s'), " Add data (end), time: " . round($d, 2) . " s", EOL;
示例6: _createCSSStyle
/**
* Create CSS style
*
* @param PHPExcel_Style $pStyle PHPExcel_Style
* @return string
*/
private function _createCSSStyle(PHPExcel_Style $pStyle)
{
// Construct HTML
$html = '';
// Create CSS
$html .= ' .style' . $pStyle->getHashCode() . ' {' . "\r\n";
$html .= $this->_createCSSStyleAlignment($pStyle->getAlignment());
$html .= $this->_createCSSStyleFont($pStyle->getFont());
$html .= $this->_createCSSStyleBorders($pStyle->getBorders());
$html .= $this->_createCSSStyleFill($pStyle->getFill());
$html .= ' }' . "\r\n";
// Return
return $html;
}
示例7: array
/**
* Generates the sheet's workbook...
*
* @param String format extension
*/
function _generateSheets($format){
$sheets= array();
$sheets= $this->book->getSheets();
$i= 0;
if ($format=="ods"){
foreach($sheets as $sheet){
$cells= array();
$cells= $sheet->getCells();
foreach($cells as $cellarray){
foreach($cellarray as $cell){
$col= $cell->getDataColumn();
$row= $cell->getDataRow();
$data= $cell->getFormula();
$fontId= $cell->getFontStyleId();
$fontStyle= new FontStyle();
$fontStyle= $this->book->getFontStyle($fontId);
if (substr($data, 0, 1)== '=')
$this->objPHPOds->addCell($i,$row,$col,substr($data, 1),'float');
//TODO
else /*OJO CON ESTO DISCERNIR ENTRE LOS DIFERENTES TIPOS*/
$this->objPHPOds->addCell($i,$row,$col,$data,'string');
}
$this->objPHPOds->addStyle($fontStyle, $cell);
}
$i++;
}
}
else{
foreach($sheets as $sheet){
if ($i>0)
$this->objPHPExcel->createSheet();
$this->objPHPExcel->setActiveSheetIndex($i);
$j= $i + 1;
$this->objPHPExcel->getActiveSheet()->setTitle("Sheet $j");
$cells= array();
$cells= $sheet->getCells();
foreach($cells as $cellarray){
$cell= new Cell();
foreach ($cellarray as $cell){
$col= $cell->getDataColumn();
$row= $cell->getDataRow();
$row++;
$data= $cell->getFormula();
// $this->objPHPExcel= new PHPExcel();
$fontId= $cell->getFontStyleId();
$fontStyle= new FontStyle();
$fontStyle= $this->book->getFontStyle($fontId);
$fontName= $fontStyle->getFontName();
$fcolor= substr($fontStyle->getFontColor(),1);
if ($fcolor == "000000"){
//echo "$row $col $fcolor<hr>";
$ncolor= new PHPExcel_Style_Color(PHPExcel_Style_Color::COLOR_BLACK);
$ncolor->setRGB($fcolor);
}
else{
//echo "$row $col $fcolor<hr>";
$ncolor= new PHPExcel_Style_Color();
$ncolor->setRGB($fcolor);
}
$style= new PHPExcel_Style();
$style->getFont()->setColor($ncolor);
$style->getFont()->setName($fontName);
$style->getFont()->setBold($fontStyle->getFontBold()== 1);
//.........这里部分代码省略.........