35 require_once 
'PEAR.php';
 
  254         $this->_xf_index       = $index;
 
  255         $this->_BIFF_version   = $BIFF_version;
 
  256         $this->font_index      = 0;
 
  257         $this->_font_name      = 
'Arial';
 
  259         $this->_bold           = 0x0190;
 
  261         $this->_color          = 0x7FFF;
 
  262         $this->_underline      = 0;
 
  263         $this->_font_strikeout = 0;
 
  264         $this->_font_outline   = 0;
 
  265         $this->_font_shadow    = 0;
 
  266         $this->_font_script    = 0;
 
  267         $this->_font_family    = 0;
 
  268         $this->_font_charset   = 0;
 
  270         $this->_num_format     = 0;
 
  275         $this->_text_h_align   = 0;
 
  276         $this->_text_wrap      = 0;
 
  277         $this->_text_v_align   = 2;
 
  278         $this->_text_justlast  = 0;
 
  279         $this->_rotation       = 0;
 
  281         $this->_fg_color       = 0x40;
 
  282         $this->_bg_color       = 0x41;
 
  292         $this->_bottom_color   = 0x40;
 
  293         $this->_top_color      = 0x40;
 
  294         $this->_left_color     = 0x40;
 
  295         $this->_right_color    = 0x40;
 
  296         $this->_diag_color     = 0x40;
 
  299         foreach ($properties as $property => $value)
 
  301             if (method_exists($this, 
'set'.ucwords($property))) {
 
  302                 $method_name = 
'set'.ucwords($property);
 
  303                 $this->$method_name($value);
 
  318         if ($style == 
'style') {
 
  322             $style  |= $this->_hidden << 1;
 
  326         $atr_num     = ($this->_num_format != 0)?1:0;
 
  327         $atr_fnt     = ($this->font_index != 0)?1:0;
 
  329         $atr_bdr     = ($this->_bottom   ||
 
  333         $atr_pat     = (($this->_fg_color != 0x40) ||
 
  334                         ($this->_bg_color != 0x41) ||
 
  339         if ($this->_bottom == 0) {
 
  340             $this->_bottom_color = 0;
 
  342         if ($this->_top  == 0) {
 
  343             $this->_top_color = 0;
 
  345         if ($this->_right == 0) {
 
  346             $this->_right_color = 0;
 
  348         if ($this->_left == 0) {
 
  349             $this->_left_color = 0;
 
  351         if ($this->_diag == 0) {
 
  352             $this->_diag_color = 0;
 
  356         if ($this->_BIFF_version == 0x0500) {
 
  359         if ($this->_BIFF_version == 0x0600) {
 
  365         if ($this->_BIFF_version == 0x0500) {
 
  367             $align         |= $this->_text_wrap     << 3;
 
  368             $align         |= $this->_text_v_align  << 4;
 
  369             $align         |= $this->_text_justlast << 7;
 
  370             $align         |= $this->_rotation      << 8;
 
  371             $align         |= $atr_num                << 10;
 
  372             $align         |= $atr_fnt                << 11;
 
  373             $align         |= $atr_alc                << 12;
 
  374             $align         |= $atr_bdr                << 13;
 
  375             $align         |= $atr_pat                << 14;
 
  376             $align         |= $atr_prot               << 15;
 
  379             $icv           |= $this->_bg_color      << 7;
 
  382             $fill          |= $this->_bottom        << 6;
 
  383             $fill          |= $this->_bottom_color  << 9;
 
  386             $border1       |= $this->_left          << 3;
 
  387             $border1       |= $this->_right         << 6;
 
  388             $border1       |= $this->_top_color     << 9;
 
  391             $border2       |= $this->_right_color   << 7;
 
  393             $header      = pack(
"vv",       $record, $length);
 
  394             $data        = pack(
"vvvvvvvv", $ifnt, $ifmt, $style, $align,
 
  397         } elseif ($this->_BIFF_version == 0x0600) {
 
  399             $align         |= $this->_text_wrap     << 3;
 
  400             $align         |= $this->_text_v_align  << 4;
 
  401             $align         |= $this->_text_justlast << 7;
 
  403             $used_attrib    = $atr_num              << 2;
 
  404             $used_attrib   |= $atr_fnt              << 3;
 
  405             $used_attrib   |= $atr_alc              << 4;
 
  406             $used_attrib   |= $atr_bdr              << 5;
 
  407             $used_attrib   |= $atr_pat              << 6;
 
  408             $used_attrib   |= $atr_prot             << 7;
 
  411             $icv           |= $this->_bg_color      << 7;
 
  414             $border1       |= $this->_right         << 4;
 
  415             $border1       |= $this->_top           << 8;
 
  416             $border1       |= $this->_bottom        << 12;
 
  417             $border1       |= $this->_left_color    << 16;
 
  418             $border1       |= $this->_right_color   << 23;
 
  421             $border1       |= $diag_tl_to_rb        << 30;
 
  422             $border1       |= $diag_tr_to_lb        << 31;
 
  425             $border2       |= $this->_bottom_color   << 7;
 
  426             $border2       |= $this->_diag_color     << 14;
 
  427             $border2       |= $this->_diag           << 21;
 
  428             $border2       |= $this->_pattern        << 26;
 
  430             $header      = pack(
"vv",       $record, $length);
 
  433             $biff8_options = 0x00;
 
  434             $data  = pack(
"vvvC", $ifnt, $ifmt, $style, $align);
 
  435             $data .= pack(
"CCC", $rotation, $biff8_options, $used_attrib);
 
  436             $data .= pack(
"VVv", $border1, $border2, $icv);
 
  439         return($header . 
$data);
 
  449         $dyHeight   = $this->_size * 20;    
 
  458         $cch        = strlen($this->_font_name); 
 
  460         if ($this->_BIFF_version == 0x0500) {
 
  461             $length     = 0x0F + $cch;            
 
  462         } elseif ($this->_BIFF_version == 0x0600) {
 
  463             $length     = 0x10 + $cch;
 
  467         if ($this->_italic) {
 
  470         if ($this->_font_strikeout) {
 
  473         if ($this->_font_outline) {
 
  476         if ($this->_font_shadow) {
 
  480         $header  = pack(
"vv",         $record, $length);
 
  481         if ($this->_BIFF_version == 0x0500) {
 
  482             $data    = pack(
"vvvvvCCCCC", $dyHeight, $grbit, $icv, $bls,
 
  483                                           $sss, $uls, $bFamily,
 
  484                                           $bCharSet, $reserved, $cch);
 
  485         } elseif ($this->_BIFF_version == 0x0600) {
 
  486             $data    = pack(
"vvvvvCCCCCC", $dyHeight, $grbit, $icv, $bls,
 
  487                                            $sss, $uls, $bFamily,
 
  488                                            $bCharSet, $reserved, $cch, $encoding);
 
  490         return($header . 
$data . $this->_font_name);
 
  505         $key  = 
"$this->_font_name$this->_size";
 
  506         $key .= 
"$this->_font_script$this->_underline";
 
  507         $key .= 
"$this->_font_strikeout$this->_bold$this->_font_outline";
 
  508         $key .= 
"$this->_font_family$this->_font_charset";
 
  509         $key .= 
"$this->_font_shadow$this->_color$this->_italic";
 
  510         $key  = str_replace(
' ', 
'_', $key);
 
  521         return($this->_xf_index);
 
  557         if ($name_color == 
'') {
 
  562         if (isset($colors[$name_color])) {
 
  563             return($colors[$name_color]);
 
  567         if (preg_match(
"/\D/",$name_color)) {
 
  572         if ($name_color < 8) {
 
  573             return($name_color + 8);
 
  577         if ($name_color > 63) {
 
  600             $this->_text_h_align = 1;
 
  603             $this->_text_h_align = 2;
 
  606             $this->_text_h_align = 2;
 
  609             $this->_text_h_align = 3;
 
  612             $this->_text_h_align = 4;
 
  615             $this->_text_h_align = 5;
 
  618             $this->_text_h_align = 6;
 
  621             $this->_text_h_align = 7;
 
  624             $this->_text_v_align = 0;
 
  627             $this->_text_v_align = 1;
 
  630             $this->_text_v_align = 1;
 
  633             $this->_text_v_align = 2;
 
  636             $this->_text_v_align = 3;
 
  639             $this->_text_v_align = 4;
 
  658             $this->_text_h_align = 1;
 
  661             $this->_text_h_align = 2;
 
  664             $this->_text_h_align = 2;
 
  667             $this->_text_h_align = 3;
 
  670             $this->_text_h_align = 4;
 
  673             $this->_text_h_align = 5;
 
  676             $this->_text_h_align = 6;
 
  679             $this->_text_h_align = 7;
 
  698             $this->_text_v_align = 0;
 
  701             $this->_text_v_align = 1;
 
  704             $this->_text_v_align = 1;
 
  707             $this->_text_v_align = 2;
 
  710             $this->_text_v_align = 3;
 
  713             $this->_text_v_align = 4;
 
  745         if ($weight <  0x064) {
 
  748         if ($weight >  0x3E8) {
 
  751         $this->_bold = $weight;
 
  767         $this->_bottom = $style;
 
  778         $this->_top = $style;
 
  789         $this->_left = $style;
 
  800         $this->_right = $style;
 
  847         $this->_bottom_color = $value;
 
  859         $this->_top_color = $value;
 
  871         $this->_left_color = $value;
 
  883         $this->_right_color = $value;
 
  896         $this->_fg_color = $value;
 
  897         if ($this->_pattern == 0) { 
 
  911         $this->_bg_color = $value;
 
  912         if ($this->_pattern == 0) { 
 
  926         $this->_color = $value;
 
  938         $this->_pattern = $arg;
 
  950         $this->_underline = $underline;
 
  971         $this->_size = 
$size;
 
  981         $this->_text_wrap = 1;
 
  996                 $this->_rotation = 0;
 
  999                 if ($this->_BIFF_version == 0x0500) {
 
 1000                 $this->_rotation = 3;
 
 1001                 } elseif ($this->_BIFF_version == 0x0600) {
 
 1002                     $this->_rotation = 180;
 
 1006                 if ($this->_BIFF_version == 0x0500) {
 
 1007                 $this->_rotation = 2;
 
 1008                 } elseif ($this->_BIFF_version == 0x0600) {
 
 1009                     $this->_rotation = 90;
 
 1013                 if ($this->_BIFF_version == 0x0500) {
 
 1014                 $this->_rotation = 1;
 
 1015                 } elseif ($this->_BIFF_version == 0x0600) {
 
 1016                     $this->_rotation = 255;
 
 1020                 return $this->
raiseError(
"Invalid value for angle.".
 
 1021                                   " Possible values are: 0, 90, 270 and -1 ".
 
 1022                                   "for stacking top-to-bottom.");
 
 1023                 $this->_rotation = 0;
 
 1037         $this->_num_format = $num_format;
 
 1047         $this->_font_strikeout = 1;
 
 1057         $this->_font_outline = 1;
 
 1067         $this->_font_shadow = 1;
 
 1079         $this->_font_script = $script;
 
 1111         $this->_font_name = $font_family;