Moodle APIs 4.3
Moodle 4.3.6 (Build: 20240812)
MoodleExcelFormat Class Reference

Define and operate over one Format. More...

Public Member Functions

 __construct ($properties=array())
 Constructs one Moodle Format.
 
 get_format_array ()
 Returns standardised Excel format array.
 
 set_align ($location)
 Set the cell alignment of the format.
 
 set_bg_color ($color)
 Set background color of the cell.
 
 set_bold ($weight=1)
 Set weight of the format.
 
 set_border ($style)
 Set cells borders to the same style.
 
 set_bottom ($style)
 Set the bottom border of the format.
 
 set_color ($color)
 Set color of the format.
 
 set_fg_color ($color)
 Not used.
 
 set_h_align ($location)
 Set the cell horizontal alignment of the format.
 
 set_italic ()
 Set italic of the format.
 
 set_left ($style)
 Set the left border of the format.
 
 set_num_format ($numformat)
 Set the numerical format of the format.
 
 set_outline ()
 Set outlining of the format.
 
 set_pattern ($pattern=1)
 Set the cell fill pattern.
 
 set_right ($style)
 Set the right border of the format.
 
 set_script ($script)
 Set the script of the text.
 
 set_shadow ()
 Set shadow of the format.
 
 set_size ($size)
 Set the size of the text in the format (in pixels).
 
 set_strikeout ()
 Set strikeout of the format.
 
 set_text_wrap ()
 Set text wrap of the format.
 
 set_top ($style)
 Set the top border of the format.
 
 set_underline ($underline)
 Set underline of the format.
 
 set_v_align ($location)
 Set the cell vertical alignment of the format.
 

Protected Member Functions

 parse_color ($color)
 Standardise colour name.
 

Protected Attributes

array $format = array()
 

Detailed Description

Define and operate over one Format.

A big part of this class acts as a wrapper over other libraries maintaining Moodle functions isolated from underlying code.

License
http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later

Constructor & Destructor Documentation

◆ __construct()

MoodleExcelFormat::__construct ( $properties = array())

Constructs one Moodle Format.

Parameters
array$properties

Member Function Documentation

◆ get_format_array()

MoodleExcelFormat::get_format_array ( )

Returns standardised Excel format array.

Return values
array

◆ parse_color()

MoodleExcelFormat::parse_color ( $color)
protected

Standardise colour name.

Parameters
mixed$colorname of the color (i.e.: 'blue', 'red', etc..), or an integer (range is [8...63]).
Return values
stringthe RGB color value

◆ set_align()

MoodleExcelFormat::set_align ( $location)

Set the cell alignment of the format.

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

◆ set_bg_color()

MoodleExcelFormat::set_bg_color ( $color)

Set background color of the cell.

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

◆ set_bold()

MoodleExcelFormat::set_bold ( $weight = 1)

Set weight of the format.

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).

◆ set_border()

MoodleExcelFormat::set_border ( $style)

Set cells borders to the same style.

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

◆ set_bottom()

MoodleExcelFormat::set_bottom ( $style)

Set the bottom border of the format.

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

◆ set_color()

MoodleExcelFormat::set_color ( $color)

Set color of the format.

Used to specify the color of the text to be formatted.

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

◆ set_fg_color()

MoodleExcelFormat::set_fg_color ( $color)

Not used.

Parameters
mixed$color

◆ set_h_align()

MoodleExcelFormat::set_h_align ( $location)

Set the cell horizontal alignment of the format.

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

◆ set_left()

MoodleExcelFormat::set_left ( $style)

Set the left border of the format.

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

◆ set_num_format()

MoodleExcelFormat::set_num_format ( $numformat)

Set the numerical format of the format.

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

Parameters
mixed$numformatThe numeric format

◆ set_pattern()

MoodleExcelFormat::set_pattern ( $pattern = 1)

Set the cell fill pattern.

Deprecated
use set_bg_color() instead.
Parameters
integer

◆ set_right()

MoodleExcelFormat::set_right ( $style)

Set the right border of the format.

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

◆ set_script()

MoodleExcelFormat::set_script ( $script)

Set the script of the text.

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

◆ set_size()

MoodleExcelFormat::set_size ( $size)

Set the size of the text in the format (in pixels).

By default all texts in generated sheets are 10pt.

Parameters
integer$sizeSize of the text (in points)

◆ set_top()

MoodleExcelFormat::set_top ( $style)

Set the top border of the format.

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

◆ set_underline()

MoodleExcelFormat::set_underline ( $underline)

Set underline of the format.

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

◆ set_v_align()

MoodleExcelFormat::set_v_align ( $location)

Set the cell vertical alignment of the format.

Parameters
string$locationalignment for the cell ('top', 'bottom', 'center', 'justify')

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