Prev Font |
ExcelExplorer Manual |
Next Format |
 |
(ExcelExplorer 4.0)
Returns fonts array (array of EEFont objects) for all defined fonts.
array(EEFont) FontsList( )
Parameters
- None
Description
Returns continuous array (array of EEFont objects) for all defined fonts.
Do not think about array keys as font indexes. To obtain font index use EEFont->Index() method.
This method is useful when you need to get all used fonts in Excel file and
then apply to readed cells by their indexes. Typical usage - creating
style sheets (CSS) (see example below).
Array always returned, however it can be empty if no fonts defined in Excel file.
Build CSS for all defined fonts
<?php
$fonts = $eexp->FontsList();
for( $i=0; $i<count($fonts); $i++ ) {
// $fonts[$i]->Index() used to print font index
print ".f".$fonts[$i]->Index()." {";
print 'font-family:'.$fonts[$i]->Name()->UTF8();
print ';font-size:'.($fonts[$i]->Height()/20).'pt';
print ';font-weight:'.$fonts[$i]->Weight();
print ';font-style:'.($fonts[$i]->Italic() ? 'italic' : 'none');
print ';text-decoration:';
if( $fonts[$i]->Underline() ) {
print 'underline';
if( $fonts[$i]->Strike() )
print ' || line-through';
switch( $fonts[$i]->Underline() ) {
case EE_FONT_UNDSINGLEDATA:
case EE_FONT_UNDSINGLECELL:
print ';text-underline-style:single';
break;
case EE_FONT_UNDDBLDATA:
case EE_FONT_UNDDBLCELL:
print ';text-underline-style:double';
break;
}
} else {
if( $fonts[$i]->Strike() ) {
print 'line-through';
} else {
print 'none';
}
}
if( $color = $fonts[$i]->Color() )
print ';color:'.$color->HTML();
print "}\n";
}
?>
|