ILIAS  release_4-4 Revision
All Data Structures Namespaces Files Functions Variables Modules Pages
Spreadsheet_Excel_Writer_Format Class Reference
+ Inheritance diagram for Spreadsheet_Excel_Writer_Format:
+ Collaboration diagram for Spreadsheet_Excel_Writer_Format:

Public Member Functions

 Spreadsheet_Excel_Writer_Format ($BIFF_version, $index=0, $properties=array())
 Constructor. More...
 
 getXf ($style)
 Generate an Excel BIFF XF record (style or cell). More...
 
 getFont ()
 Generate an Excel BIFF FONT record. More...
 
 getFontKey ()
 Returns a unique hash key for a font. More...
 
 getXfIndex ()
 Returns the index used by Spreadsheet_Excel_Writer_Worksheet::_XF() More...
 
 _getColor ($name_color='')
 Used in conjunction with the set_xxx_color methods to convert a color string into a number. More...
 
 setAlign ($location)
 Set cell alignment. More...
 
 setHAlign ($location)
 Set cell horizontal alignment. More...
 
 setVAlign ($location)
 Set cell vertical alignment. More...
 
 setMerge ()
 This is an alias for the unintuitive setAlign('merge') More...
 
 setBold ($weight=1)
 Sets the boldness of the text. More...
 
 setBottom ($style)
 Sets the width for the bottom border of the cell. More...
 
 setTop ($style)
 Sets the width for the top border of the cell. More...
 
 setLeft ($style)
 Sets the width for the left border of the cell. More...
 
 setRight ($style)
 Sets the width for the right border of the cell. More...
 
 setBorder ($style)
 Set cells borders to the same style. More...
 
 setBorderColor ($color)
 Sets all the cell's borders to the same color. More...
 
 setBottomColor ($color)
 Sets the cell's bottom border color. More...
 
 setTopColor ($color)
 Sets the cell's top border color. More...
 
 setLeftColor ($color)
 Sets the cell's left border color. More...
 
 setRightColor ($color)
 Sets the cell's right border color. More...
 
 setFgColor ($color)
 Sets the cell's foreground color. More...
 
 setBgColor ($color)
 Sets the cell's background color. More...
 
 setColor ($color)
 Sets the cell's color. More...
 
 setPattern ($arg=1)
 Sets the fill pattern attribute of a cell. More...
 
 setUnderline ($underline)
 Sets the underline of the text. More...
 
 setItalic ()
 Sets the font style as italic. More...
 
 setSize ($size)
 Sets the font size. More...
 
 setTextWrap ()
 Sets text wrapping. More...
 
 setTextRotation ($angle)
 Sets the orientation of the text. More...
 
 setNumFormat ($num_format)
 Sets the numeric format. More...
 
 setStrikeOut ()
 Sets font as strikeout. More...
 
 setOutLine ()
 Sets outlining for a font. More...
 
 setShadow ()
 Sets font as shadow. More...
 
 setScript ($script)
 Sets the script type of the text. More...
 
 setLocked ()
 Locks a cell. More...
 
 setUnLocked ()
 Unlocks a cell. More...
 
 setFontFamily ($font_family)
 Sets the font family name. More...
 
- Public Member Functions inherited from PEAR
 PEAR ($error_class=null)
 Constructor. More...
 
 _PEAR ()
 Destructor (the emulated type of...). More...
 
getStaticProperty ($class, $var)
 If you have a class that's mostly/entirely static, and you need static properties, you can use this method to simulate them. More...
 
 registerShutdownFunc ($func, $args=array())
 Use this function to register a shutdown method for static classes. More...
 
 isError ($data, $code=null)
 Tell whether a value is a PEAR error. More...
 
 setErrorHandling ($mode=null, $options=null)
 Sets how errors generated by this object should be handled. More...
 
 expectError ($code=' *')
 This method is used to tell which errors you expect to get. More...
 
 popExpect ()
 This method pops one element off the expected error codes stack. More...
 
 _checkDelExpect ($error_code)
 This method checks unsets an error code if available. More...
 
 delExpect ($error_code)
 This method deletes all occurences of the specified element from the expected error codes stack. More...
 
raiseError ($message=null, $code=null, $mode=null, $options=null, $userinfo=null, $error_class=null, $skipmsg=false)
 This method is a wrapper that returns an instance of the configured error class with this object's default error handling applied. More...
 
throwError ($message=null, $code=null, $userinfo=null)
 Simpler form of raiseError with fewer options. More...
 
 staticPushErrorHandling ($mode, $options=null)
 
 staticPopErrorHandling ()
 
 pushErrorHandling ($mode, $options=null)
 Push a new error handler on top of the error handler options stack. More...
 
 popErrorHandling ()
 Pop the last error handler used. More...
 
 loadExtension ($ext)
 OS independant PHP extension load. More...
 

Data Fields

 $_xf_index
 
 $font_index
 
 $_font_name
 
 $_size
 
 $_bold
 
 $_italic
 
 $_color
 
 $_underline
 
 $_font_strikeout
 
 $_font_outline
 
 $_font_shadow
 
 $_font_script
 
 $_font_family
 
 $_font_charset
 
 $_num_format
 
 $_hidden
 
 $_locked
 
 $_text_h_align
 
 $_text_wrap
 
 $_text_v_align
 
 $_text_justlast
 
 $_rotation
 
 $_fg_color
 
 $_bg_color
 
 $_pattern
 
 $_bottom
 
 $_bottom_color
 
 $_top
 
 $_top_color
 
 $_left
 
 $_left_color
 
 $_right
 
 $_right_color
 
- Data Fields inherited from PEAR
 $_debug = false
 
 $_default_error_mode = null
 
 $_default_error_options = null
 
 $_default_error_handler = ''
 
 $_error_class = 'PEAR_Error'
 
 $_expected_errors = array()
 

Detailed Description

Definition at line 45 of file Format.php.

Member Function Documentation

◆ _getColor()

Spreadsheet_Excel_Writer_Format::_getColor (   $name_color = '')

Used in conjunction with the set_xxx_color methods to convert a color string into a number.

Color range is 0..63 but we will restrict it to 8..63 to comply with Gnumeric. Colors 0..7 are repeated in 8..15.

private

Parameters
string$name_colorname of the color (i.e.: 'blue', 'red', etc..). Optional.
Returns
integer The color index

Definition at line 533 of file Format.php.

Referenced by setBgColor(), setBottomColor(), setColor(), setFgColor(), setLeftColor(), setRightColor(), and setTopColor().

534  {
535  $colors = array(
536  'aqua' => 0x0F,
537  'cyan' => 0x0F,
538  'black' => 0x08,
539  'blue' => 0x0C,
540  'brown' => 0x10,
541  'magenta' => 0x0E,
542  'fuchsia' => 0x0E,
543  'gray' => 0x17,
544  'grey' => 0x17,
545  'green' => 0x11,
546  'lime' => 0x0B,
547  'navy' => 0x12,
548  'orange' => 0x35,
549  'purple' => 0x14,
550  'red' => 0x0A,
551  'silver' => 0x16,
552  'white' => 0x09,
553  'yellow' => 0x0D
554  );
555 
556  // Return the default color, 0x7FFF, if undef,
557  if ($name_color == '') {
558  return(0x7FFF);
559  }
560 
561  // or the color string converted to an integer,
562  if (isset($colors[$name_color])) {
563  return($colors[$name_color]);
564  }
565 
566  // or the default color if string is unrecognised,
567  if (preg_match("/\D/",$name_color)) {
568  return(0x7FFF);
569  }
570 
571  // or an index < 8 mapped into the correct range,
572  if ($name_color < 8) {
573  return($name_color + 8);
574  }
575 
576  // or the default color if arg is outside range,
577  if ($name_color > 63) {
578  return(0x7FFF);
579  }
580 
581  // or an integer in the valid range
582  return($name_color);
583  }
+ Here is the caller graph for this function:

◆ getFont()

Spreadsheet_Excel_Writer_Format::getFont ( )

Generate an Excel BIFF FONT record.

Returns
string The FONT record

Definition at line 447 of file Format.php.

References $_bold, $_color, $_font_charset, $_font_family, $_font_script, $_underline, and $data.

448  {
449  $dyHeight = $this->_size * 20; // Height of font (1/20 of a point)
450  $icv = $this->_color; // Index to color palette
451  $bls = $this->_bold; // Bold style
452  $sss = $this->_font_script; // Superscript/subscript
453  $uls = $this->_underline; // Underline
454  $bFamily = $this->_font_family; // Font family
455  $bCharSet = $this->_font_charset; // Character set
456  $encoding = 0; // TODO: Unicode support
457 
458  $cch = strlen($this->_font_name); // Length of font name
459  $record = 0x31; // Record identifier
460  if ($this->_BIFF_version == 0x0500) {
461  $length = 0x0F + $cch; // Record length
462  } elseif ($this->_BIFF_version == 0x0600) {
463  $length = 0x10 + $cch;
464  }
465  $reserved = 0x00; // Reserved
466  $grbit = 0x00; // Font attributes
467  if ($this->_italic) {
468  $grbit |= 0x02;
469  }
470  if ($this->_font_strikeout) {
471  $grbit |= 0x08;
472  }
473  if ($this->_font_outline) {
474  $grbit |= 0x10;
475  }
476  if ($this->_font_shadow) {
477  $grbit |= 0x20;
478  }
479 
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);
489  }
490  return($header . $data . $this->_font_name);
491  }
while($lm_rec=$ilDB->fetchAssoc($lm_set)) $data

◆ getFontKey()

Spreadsheet_Excel_Writer_Format::getFontKey ( )

Returns a unique hash key for a font.

Used by Spreadsheet_Excel_Writer_Workbook::_storeAllFonts()

The elements that form the key are arranged to increase the probability of generating a unique key. Elements that hold a large range of numbers (eg. _color) are placed between two binary elements such as _italic

Returns
string A key for this font

Definition at line 503 of file Format.php.

504  {
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);
511  return ($key);
512  }

◆ getXf()

Spreadsheet_Excel_Writer_Format::getXf (   $style)

Generate an Excel BIFF XF record (style or cell).

Parameters
string$styleThe type of the XF record ('style' or 'cell').
Returns
string The XF record

Definition at line 315 of file Format.php.

References $_fg_color, $_hidden, $_left, $_left_color, $_locked, $_num_format, $_pattern, $_right, $_rotation, $_text_h_align, $_text_wrap, $_top, $_top_color, $data, and $font_index.

316  {
317  // Set the type of the XF record and some of the attributes.
318  if ($style == 'style') {
319  $style = 0xFFF5;
320  } else {
321  $style = $this->_locked;
322  $style |= $this->_hidden << 1;
323  }
324 
325  // Flags to indicate if attributes have been set.
326  $atr_num = ($this->_num_format != 0)?1:0;
327  $atr_fnt = ($this->font_index != 0)?1:0;
328  $atr_alc = ($this->_text_wrap)?1:0;
329  $atr_bdr = ($this->_bottom ||
330  $this->_top ||
331  $this->_left ||
332  $this->_right)?1:0;
333  $atr_pat = (($this->_fg_color != 0x40) ||
334  ($this->_bg_color != 0x41) ||
335  $this->_pattern)?1:0;
336  $atr_prot = $this->_locked | $this->_hidden;
337 
338  // Zero the default border colour if the border has not been set.
339  if ($this->_bottom == 0) {
340  $this->_bottom_color = 0;
341  }
342  if ($this->_top == 0) {
343  $this->_top_color = 0;
344  }
345  if ($this->_right == 0) {
346  $this->_right_color = 0;
347  }
348  if ($this->_left == 0) {
349  $this->_left_color = 0;
350  }
351  if ($this->_diag == 0) {
352  $this->_diag_color = 0;
353  }
354 
355  $record = 0x00E0; // Record identifier
356  if ($this->_BIFF_version == 0x0500) {
357  $length = 0x0010; // Number of bytes to follow
358  }
359  if ($this->_BIFF_version == 0x0600) {
360  $length = 0x0014;
361  }
362 
363  $ifnt = $this->font_index; // Index to FONT record
364  $ifmt = $this->_num_format; // Index to FORMAT record
365  if ($this->_BIFF_version == 0x0500) {
366  $align = $this->_text_h_align; // Alignment
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;
377 
378  $icv = $this->_fg_color; // fg and bg pattern colors
379  $icv |= $this->_bg_color << 7;
380 
381  $fill = $this->_pattern; // Fill and border line style
382  $fill |= $this->_bottom << 6;
383  $fill |= $this->_bottom_color << 9;
384 
385  $border1 = $this->_top; // Border line style and color
386  $border1 |= $this->_left << 3;
387  $border1 |= $this->_right << 6;
388  $border1 |= $this->_top_color << 9;
389 
390  $border2 = $this->_left_color; // Border color
391  $border2 |= $this->_right_color << 7;
392 
393  $header = pack("vv", $record, $length);
394  $data = pack("vvvvvvvv", $ifnt, $ifmt, $style, $align,
395  $icv, $fill,
396  $border1, $border2);
397  } elseif ($this->_BIFF_version == 0x0600) {
398  $align = $this->_text_h_align; // Alignment
399  $align |= $this->_text_wrap << 3;
400  $align |= $this->_text_v_align << 4;
401  $align |= $this->_text_justlast << 7;
402 
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;
409 
410  $icv = $this->_fg_color; // fg and bg pattern colors
411  $icv |= $this->_bg_color << 7;
412 
413  $border1 = $this->_left; // Border line style and color
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;
419  $diag_tl_to_rb = 0; // FIXME: add method
420  $diag_tr_to_lb = 0; // FIXME: add method
421  $border1 |= $diag_tl_to_rb << 30;
422  $border1 |= $diag_tr_to_lb << 31;
423 
424  $border2 = $this->_top_color; // Border color
425  $border2 |= $this->_bottom_color << 7;
426  $border2 |= $this->_diag_color << 14;
427  $border2 |= $this->_diag << 21;
428  $border2 |= $this->_pattern << 26;
429 
430  $header = pack("vv", $record, $length);
431 
432  $rotation = $this->_rotation;
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);
437  }
438 
439  return($header . $data);
440  }
while($lm_rec=$ilDB->fetchAssoc($lm_set)) $data

◆ getXfIndex()

Spreadsheet_Excel_Writer_Format::getXfIndex ( )

Returns the index used by Spreadsheet_Excel_Writer_Worksheet::_XF()

Returns
integer The index for the XF record

Definition at line 519 of file Format.php.

520  {
521  return($this->_xf_index);
522  }

◆ setAlign()

Spreadsheet_Excel_Writer_Format::setAlign (   $location)

Set cell alignment.

public

Parameters
string$locationalignment for the cell ('left', 'right', etc...).

Definition at line 591 of file Format.php.

References $location.

Referenced by setMerge().

592  {
593  if (preg_match("/\d/",$location)) {
594  return; // Ignore numbers
595  }
596 
597  $location = strtolower($location);
598 
599  if ($location == 'left') {
600  $this->_text_h_align = 1;
601  }
602  if ($location == 'centre') {
603  $this->_text_h_align = 2;
604  }
605  if ($location == 'center') {
606  $this->_text_h_align = 2;
607  }
608  if ($location == 'right') {
609  $this->_text_h_align = 3;
610  }
611  if ($location == 'fill') {
612  $this->_text_h_align = 4;
613  }
614  if ($location == 'justify') {
615  $this->_text_h_align = 5;
616  }
617  if ($location == 'merge') {
618  $this->_text_h_align = 6;
619  }
620  if ($location == 'equal_space') { // For T.K.
621  $this->_text_h_align = 7;
622  }
623  if ($location == 'top') {
624  $this->_text_v_align = 0;
625  }
626  if ($location == 'vcentre') {
627  $this->_text_v_align = 1;
628  }
629  if ($location == 'vcenter') {
630  $this->_text_v_align = 1;
631  }
632  if ($location == 'bottom') {
633  $this->_text_v_align = 2;
634  }
635  if ($location == 'vjustify') {
636  $this->_text_v_align = 3;
637  }
638  if ($location == 'vequal_space') { // For T.K.
639  $this->_text_v_align = 4;
640  }
641  }
$location
Definition: buildRTE.php:44
+ Here is the caller graph for this function:

◆ setBgColor()

Spreadsheet_Excel_Writer_Format::setBgColor (   $color)

Sets the cell's background color.

public

Parameters
mixed$coloreither a string (like 'blue'), or an integer (range is [8...63]).

Definition at line 908 of file Format.php.

References _getColor().

909  {
910  $value = $this->_getColor($color);
911  $this->_bg_color = $value;
912  if ($this->_pattern == 0) { // force color to be seen
913  $this->_pattern = 1;
914  }
915  }
_getColor($name_color='')
Used in conjunction with the set_xxx_color methods to convert a color string into a number...
Definition: Format.php:533
+ Here is the call graph for this function:

◆ setBold()

Spreadsheet_Excel_Writer_Format::setBold (   $weight = 1)

Sets the boldness of the text.

Bold has a range 100..1000. 0 (400) is normal. 1 (700) is bold.

public

Parameters
integer$weightWeight for the text, 0 maps to 400 (normal text), 1 maps to 700 (bold text). Valid range is: 100-1000. It's Optional, default is 1 (bold).

Definition at line 737 of file Format.php.

738  {
739  if ($weight == 1) {
740  $weight = 0x2BC; // Bold text
741  }
742  if ($weight == 0) {
743  $weight = 0x190; // Normal text
744  }
745  if ($weight < 0x064) {
746  $weight = 0x190; // Lower bound
747  }
748  if ($weight > 0x3E8) {
749  $weight = 0x190; // Upper bound
750  }
751  $this->_bold = $weight;
752  }

◆ setBorder()

Spreadsheet_Excel_Writer_Format::setBorder (   $style)

Set cells borders to the same style.

public

Parameters
integer$stylestyle to apply for all cell borders. 1 => thin, 2 => thick.

Definition at line 810 of file Format.php.

References setBottom(), setLeft(), setRight(), and setTop().

811  {
812  $this->setBottom($style);
813  $this->setTop($style);
814  $this->setLeft($style);
815  $this->setRight($style);
816  }
setLeft($style)
Sets the width for the left border of the cell.
Definition: Format.php:787
setBottom($style)
Sets the width for the bottom border of the cell.
Definition: Format.php:765
setTop($style)
Sets the width for the top border of the cell.
Definition: Format.php:776
setRight($style)
Sets the width for the right border of the cell.
Definition: Format.php:798
+ Here is the call graph for this function:

◆ setBorderColor()

Spreadsheet_Excel_Writer_Format::setBorderColor (   $color)

Sets all the cell's borders to the same color.

public

Parameters
mixed$colorThe color we are setting. Either a string (like 'blue'), or an integer (range is [8...63]).

Definition at line 830 of file Format.php.

References setBottomColor(), setLeftColor(), setRightColor(), and setTopColor().

831  {
832  $this->setBottomColor($color);
833  $this->setTopColor($color);
834  $this->setLeftColor($color);
835  $this->setRightColor($color);
836  }
setTopColor($color)
Sets the cell&#39;s top border color.
Definition: Format.php:856
setLeftColor($color)
Sets the cell&#39;s left border color.
Definition: Format.php:868
setRightColor($color)
Sets the cell&#39;s right border color.
Definition: Format.php:880
setBottomColor($color)
Sets the cell&#39;s bottom border color.
Definition: Format.php:844
+ Here is the call graph for this function:

◆ setBottom()

Spreadsheet_Excel_Writer_Format::setBottom (   $style)

Sets the width for the bottom border of the cell.

public

Parameters
integer$stylestyle of the cell border. 1 => thin, 2 => thick.

Definition at line 765 of file Format.php.

Referenced by setBorder().

766  {
767  $this->_bottom = $style;
768  }
+ Here is the caller graph for this function:

◆ setBottomColor()

Spreadsheet_Excel_Writer_Format::setBottomColor (   $color)

Sets the cell's bottom border color.

public

Parameters
mixed$coloreither a string (like 'blue'), or an integer (range is [8...63]).

Definition at line 844 of file Format.php.

References _getColor().

Referenced by setBorderColor().

845  {
846  $value = $this->_getColor($color);
847  $this->_bottom_color = $value;
848  }
_getColor($name_color='')
Used in conjunction with the set_xxx_color methods to convert a color string into a number...
Definition: Format.php:533
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setColor()

Spreadsheet_Excel_Writer_Format::setColor (   $color)

Sets the cell's color.

public

Parameters
mixed$coloreither a string (like 'blue'), or an integer (range is [8...63]).

Definition at line 923 of file Format.php.

References _getColor().

924  {
925  $value = $this->_getColor($color);
926  $this->_color = $value;
927  }
_getColor($name_color='')
Used in conjunction with the set_xxx_color methods to convert a color string into a number...
Definition: Format.php:533
+ Here is the call graph for this function:

◆ setFgColor()

Spreadsheet_Excel_Writer_Format::setFgColor (   $color)

Sets the cell's foreground color.

public

Parameters
mixed$coloreither a string (like 'blue'), or an integer (range is [8...63]).

Definition at line 893 of file Format.php.

References _getColor().

894  {
895  $value = $this->_getColor($color);
896  $this->_fg_color = $value;
897  if ($this->_pattern == 0) { // force color to be seen
898  $this->_pattern = 1;
899  }
900  }
_getColor($name_color='')
Used in conjunction with the set_xxx_color methods to convert a color string into a number...
Definition: Format.php:533
+ Here is the call graph for this function:

◆ setFontFamily()

Spreadsheet_Excel_Writer_Format::setFontFamily (   $font_family)

Sets the font family name.

public

Parameters
string$fontfamilyThe font family name. Possible values are: 'Times New Roman', 'Arial', 'Courier'.

Definition at line 1109 of file Format.php.

1110  {
1111  $this->_font_name = $font_family;
1112  }

◆ setHAlign()

Spreadsheet_Excel_Writer_Format::setHAlign (   $location)

Set cell horizontal alignment.

public

Parameters
string$locationalignment for the cell ('left', 'right', etc...).

Definition at line 649 of file Format.php.

References $location.

650  {
651  if (preg_match("/\d/",$location)) {
652  return; // Ignore numbers
653  }
654 
655  $location = strtolower($location);
656 
657  if ($location == 'left') {
658  $this->_text_h_align = 1;
659  }
660  if ($location == 'centre') {
661  $this->_text_h_align = 2;
662  }
663  if ($location == 'center') {
664  $this->_text_h_align = 2;
665  }
666  if ($location == 'right') {
667  $this->_text_h_align = 3;
668  }
669  if ($location == 'fill') {
670  $this->_text_h_align = 4;
671  }
672  if ($location == 'justify') {
673  $this->_text_h_align = 5;
674  }
675  if ($location == 'merge') {
676  $this->_text_h_align = 6;
677  }
678  if ($location == 'equal_space') { // For T.K.
679  $this->_text_h_align = 7;
680  }
681  }
$location
Definition: buildRTE.php:44

◆ setItalic()

Spreadsheet_Excel_Writer_Format::setItalic ( )

Sets the font style as italic.

public

Definition at line 958 of file Format.php.

959  {
960  $this->_italic = 1;
961  }

◆ setLeft()

Spreadsheet_Excel_Writer_Format::setLeft (   $style)

Sets the width for the left border of the cell.

public

Parameters
integer$stylestyle of the cell left border. 1 => thin, 2 => thick.

Definition at line 787 of file Format.php.

Referenced by setBorder().

788  {
789  $this->_left = $style;
790  }
+ Here is the caller graph for this function:

◆ setLeftColor()

Spreadsheet_Excel_Writer_Format::setLeftColor (   $color)

Sets the cell's left border color.

public

Parameters
mixed$coloreither a string (like 'blue'), or an integer (range is [8...63]).

Definition at line 868 of file Format.php.

References _getColor().

Referenced by setBorderColor().

869  {
870  $value = $this->_getColor($color);
871  $this->_left_color = $value;
872  }
_getColor($name_color='')
Used in conjunction with the set_xxx_color methods to convert a color string into a number...
Definition: Format.php:533
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setLocked()

Spreadsheet_Excel_Writer_Format::setLocked ( )

Locks a cell.

public

Definition at line 1087 of file Format.php.

1088  {
1089  $this->_locked = 1;
1090  }

◆ setMerge()

Spreadsheet_Excel_Writer_Format::setMerge ( )

This is an alias for the unintuitive setAlign('merge')

public

Definition at line 722 of file Format.php.

References setAlign().

723  {
724  $this->setAlign('merge');
725  }
setAlign($location)
Set cell alignment.
Definition: Format.php:591
+ Here is the call graph for this function:

◆ setNumFormat()

Spreadsheet_Excel_Writer_Format::setNumFormat (   $num_format)

Sets the numeric format.

It can be date, time, currency, etc...

public

Parameters
integer$num_formatThe numeric format.

Definition at line 1035 of file Format.php.

1036  {
1037  $this->_num_format = $num_format;
1038  }

◆ setOutLine()

Spreadsheet_Excel_Writer_Format::setOutLine ( )

Sets outlining for a font.

public

Definition at line 1055 of file Format.php.

1056  {
1057  $this->_font_outline = 1;
1058  }

◆ setPattern()

Spreadsheet_Excel_Writer_Format::setPattern (   $arg = 1)

Sets the fill pattern attribute of a cell.

public

Parameters
integer$argOptional. Defaults to 1. Meaningful values are: 0-18, 0 meaning no background.

Definition at line 936 of file Format.php.

937  {
938  $this->_pattern = $arg;
939  }

◆ setRight()

Spreadsheet_Excel_Writer_Format::setRight (   $style)

Sets the width for the right border of the cell.

public

Parameters
integer$stylestyle of the cell right border. 1 => thin, 2 => thick.

Definition at line 798 of file Format.php.

Referenced by setBorder().

799  {
800  $this->_right = $style;
801  }
+ Here is the caller graph for this function:

◆ setRightColor()

Spreadsheet_Excel_Writer_Format::setRightColor (   $color)

Sets the cell's right border color.

public

Parameters
mixed$coloreither a string (like 'blue'), or an integer (range is [8...63]).

Definition at line 880 of file Format.php.

References _getColor().

Referenced by setBorderColor().

881  {
882  $value = $this->_getColor($color);
883  $this->_right_color = $value;
884  }
_getColor($name_color='')
Used in conjunction with the set_xxx_color methods to convert a color string into a number...
Definition: Format.php:533
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setScript()

Spreadsheet_Excel_Writer_Format::setScript (   $script)

Sets the script type of the text.

public

Parameters
integer$scriptThe value for script type. Possible values are: 1 => superscript, 2 => subscript.

Definition at line 1077 of file Format.php.

1078  {
1079  $this->_font_script = $script;
1080  }

◆ setShadow()

Spreadsheet_Excel_Writer_Format::setShadow ( )

Sets font as shadow.

public

Definition at line 1065 of file Format.php.

1066  {
1067  $this->_font_shadow = 1;
1068  }

◆ setSize()

Spreadsheet_Excel_Writer_Format::setSize (   $size)

Sets the font size.

public

Parameters
integer$sizeThe font size (in pixels I think).

Definition at line 969 of file Format.php.

References $size.

970  {
971  $this->_size = $size;
972  }
$size
Definition: RandomTest.php:79

◆ setStrikeOut()

Spreadsheet_Excel_Writer_Format::setStrikeOut ( )

Sets font as strikeout.

public

Definition at line 1045 of file Format.php.

1046  {
1047  $this->_font_strikeout = 1;
1048  }

◆ setTextRotation()

Spreadsheet_Excel_Writer_Format::setTextRotation (   $angle)

Sets the orientation of the text.

public

Parameters
integer$angleThe rotation angle for the text (clockwise). Possible values are: 0, 90, 270 and -1 for stacking top-to-bottom.

Definition at line 991 of file Format.php.

References PEAR\raiseError().

992  {
993  switch ($angle)
994  {
995  case 0:
996  $this->_rotation = 0;
997  break;
998  case 90:
999  if ($this->_BIFF_version == 0x0500) {
1000  $this->_rotation = 3;
1001  } elseif ($this->_BIFF_version == 0x0600) {
1002  $this->_rotation = 180;
1003  }
1004  break;
1005  case 270:
1006  if ($this->_BIFF_version == 0x0500) {
1007  $this->_rotation = 2;
1008  } elseif ($this->_BIFF_version == 0x0600) {
1009  $this->_rotation = 90;
1010  }
1011  break;
1012  case -1:
1013  if ($this->_BIFF_version == 0x0500) {
1014  $this->_rotation = 1;
1015  } elseif ($this->_BIFF_version == 0x0600) {
1016  $this->_rotation = 255;
1017  }
1018  break;
1019  default :
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;
1024  break;
1025  }
1026  }
& raiseError($message=null, $code=null, $mode=null, $options=null, $userinfo=null, $error_class=null, $skipmsg=false)
This method is a wrapper that returns an instance of the configured error class with this object&#39;s de...
Definition: PEAR.php:524
+ Here is the call graph for this function:

◆ setTextWrap()

Spreadsheet_Excel_Writer_Format::setTextWrap ( )

Sets text wrapping.

public

Definition at line 979 of file Format.php.

980  {
981  $this->_text_wrap = 1;
982  }

◆ setTop()

Spreadsheet_Excel_Writer_Format::setTop (   $style)

Sets the width for the top border of the cell.

public

Parameters
integer$stylestyle of the cell top border. 1 => thin, 2 => thick.

Definition at line 776 of file Format.php.

Referenced by setBorder().

777  {
778  $this->_top = $style;
779  }
+ Here is the caller graph for this function:

◆ setTopColor()

Spreadsheet_Excel_Writer_Format::setTopColor (   $color)

Sets the cell's top border color.

public

Parameters
mixed$coloreither a string (like 'blue'), or an integer (range is [8...63]).

Definition at line 856 of file Format.php.

References _getColor().

Referenced by setBorderColor().

857  {
858  $value = $this->_getColor($color);
859  $this->_top_color = $value;
860  }
_getColor($name_color='')
Used in conjunction with the set_xxx_color methods to convert a color string into a number...
Definition: Format.php:533
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setUnderline()

Spreadsheet_Excel_Writer_Format::setUnderline (   $underline)

Sets the underline of the text.

public

Parameters
integer$underlineThe value for underline. Possible values are: 1 => underline, 2 => double underline.

Definition at line 948 of file Format.php.

949  {
950  $this->_underline = $underline;
951  }

◆ setUnLocked()

Spreadsheet_Excel_Writer_Format::setUnLocked ( )

Unlocks a cell.

Useful for unprotecting particular cells of a protected sheet.

public

Definition at line 1097 of file Format.php.

1098  {
1099  $this->_locked = 0;
1100  }

◆ setVAlign()

Spreadsheet_Excel_Writer_Format::setVAlign (   $location)

Set cell vertical alignment.

public

Parameters
string$locationalignment for the cell ('top', 'vleft', 'vright', etc...).

Definition at line 689 of file Format.php.

References $location.

690  {
691  if (preg_match("/\d/",$location)) {
692  return; // Ignore numbers
693  }
694 
695  $location = strtolower($location);
696 
697  if ($location == 'top') {
698  $this->_text_v_align = 0;
699  }
700  if ($location == 'vcentre') {
701  $this->_text_v_align = 1;
702  }
703  if ($location == 'vcenter') {
704  $this->_text_v_align = 1;
705  }
706  if ($location == 'bottom') {
707  $this->_text_v_align = 2;
708  }
709  if ($location == 'vjustify') {
710  $this->_text_v_align = 3;
711  }
712  if ($location == 'vequal_space') { // For T.K.
713  $this->_text_v_align = 4;
714  }
715  }
$location
Definition: buildRTE.php:44

◆ Spreadsheet_Excel_Writer_Format()

Spreadsheet_Excel_Writer_Format::Spreadsheet_Excel_Writer_Format (   $BIFF_version,
  $index = 0,
  $properties = array() 
)

Constructor.

private

Parameters
integer$indexthe XF index for the format.
array$propertiesarray with properties to be set on initialization.

Definition at line 252 of file Format.php.

253  {
254  $this->_xf_index = $index;
255  $this->_BIFF_version = $BIFF_version;
256  $this->font_index = 0;
257  $this->_font_name = 'Arial';
258  $this->_size = 10;
259  $this->_bold = 0x0190;
260  $this->_italic = 0;
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;
269 
270  $this->_num_format = 0;
271 
272  $this->_hidden = 0;
273  $this->_locked = 0;
274 
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;
280 
281  $this->_fg_color = 0x40;
282  $this->_bg_color = 0x41;
283 
284  $this->_pattern = 0;
285 
286  $this->_bottom = 0;
287  $this->_top = 0;
288  $this->_left = 0;
289  $this->_right = 0;
290  $this->_diag = 0;
291 
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;
297 
298  // Set properties passed to Spreadsheet_Excel_Writer_Workbook::addFormat()
299  foreach ($properties as $property => $value)
300  {
301  if (method_exists($this, 'set'.ucwords($property))) {
302  $method_name = 'set'.ucwords($property);
303  $this->$method_name($value);
304  }
305  }
306  }

Field Documentation

◆ $_bg_color

Spreadsheet_Excel_Writer_Format::$_bg_color

Definition at line 189 of file Format.php.

◆ $_bold

Spreadsheet_Excel_Writer_Format::$_bold

Definition at line 75 of file Format.php.

Referenced by getFont().

◆ $_bottom

Spreadsheet_Excel_Writer_Format::$_bottom

Definition at line 201 of file Format.php.

◆ $_bottom_color

Spreadsheet_Excel_Writer_Format::$_bottom_color

Definition at line 207 of file Format.php.

◆ $_color

Spreadsheet_Excel_Writer_Format::$_color

Definition at line 87 of file Format.php.

Referenced by getFont().

◆ $_fg_color

Spreadsheet_Excel_Writer_Format::$_fg_color

Definition at line 183 of file Format.php.

Referenced by getXf().

◆ $_font_charset

Spreadsheet_Excel_Writer_Format::$_font_charset

Definition at line 129 of file Format.php.

Referenced by getFont().

◆ $_font_family

Spreadsheet_Excel_Writer_Format::$_font_family

Definition at line 123 of file Format.php.

Referenced by getFont().

◆ $_font_name

Spreadsheet_Excel_Writer_Format::$_font_name

Definition at line 63 of file Format.php.

◆ $_font_outline

Spreadsheet_Excel_Writer_Format::$_font_outline

Definition at line 105 of file Format.php.

◆ $_font_script

Spreadsheet_Excel_Writer_Format::$_font_script

Definition at line 117 of file Format.php.

Referenced by getFont().

◆ $_font_shadow

Spreadsheet_Excel_Writer_Format::$_font_shadow

Definition at line 111 of file Format.php.

◆ $_font_strikeout

Spreadsheet_Excel_Writer_Format::$_font_strikeout

Definition at line 99 of file Format.php.

◆ $_hidden

Spreadsheet_Excel_Writer_Format::$_hidden

Definition at line 141 of file Format.php.

Referenced by getXf().

◆ $_italic

Spreadsheet_Excel_Writer_Format::$_italic

Definition at line 81 of file Format.php.

◆ $_left

Spreadsheet_Excel_Writer_Format::$_left

Definition at line 225 of file Format.php.

Referenced by getXf().

◆ $_left_color

Spreadsheet_Excel_Writer_Format::$_left_color

Definition at line 231 of file Format.php.

Referenced by getXf().

◆ $_locked

Spreadsheet_Excel_Writer_Format::$_locked

Definition at line 147 of file Format.php.

Referenced by getXf().

◆ $_num_format

Spreadsheet_Excel_Writer_Format::$_num_format

Definition at line 135 of file Format.php.

Referenced by getXf().

◆ $_pattern

Spreadsheet_Excel_Writer_Format::$_pattern

Definition at line 195 of file Format.php.

Referenced by getXf().

◆ $_right

Spreadsheet_Excel_Writer_Format::$_right

Definition at line 237 of file Format.php.

Referenced by getXf().

◆ $_right_color

Spreadsheet_Excel_Writer_Format::$_right_color

Definition at line 243 of file Format.php.

◆ $_rotation

Spreadsheet_Excel_Writer_Format::$_rotation

Definition at line 177 of file Format.php.

Referenced by getXf().

◆ $_size

Spreadsheet_Excel_Writer_Format::$_size

Definition at line 69 of file Format.php.

◆ $_text_h_align

Spreadsheet_Excel_Writer_Format::$_text_h_align

Definition at line 153 of file Format.php.

Referenced by getXf().

◆ $_text_justlast

Spreadsheet_Excel_Writer_Format::$_text_justlast

Definition at line 171 of file Format.php.

◆ $_text_v_align

Spreadsheet_Excel_Writer_Format::$_text_v_align

Definition at line 165 of file Format.php.

◆ $_text_wrap

Spreadsheet_Excel_Writer_Format::$_text_wrap

Definition at line 159 of file Format.php.

Referenced by getXf().

◆ $_top

Spreadsheet_Excel_Writer_Format::$_top

Definition at line 213 of file Format.php.

Referenced by getXf().

◆ $_top_color

Spreadsheet_Excel_Writer_Format::$_top_color

Definition at line 219 of file Format.php.

Referenced by getXf().

◆ $_underline

Spreadsheet_Excel_Writer_Format::$_underline

Definition at line 93 of file Format.php.

Referenced by getFont().

◆ $_xf_index

Spreadsheet_Excel_Writer_Format::$_xf_index

Definition at line 51 of file Format.php.

◆ $font_index

Spreadsheet_Excel_Writer_Format::$font_index

Definition at line 57 of file Format.php.

Referenced by getXf().


The documentation for this class was generated from the following file: