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

Define and operate over one Worksheet. More...

Public Member Functions

 __construct ($name, Spreadsheet $workbook)
 Constructs one Moodle Worksheet.
 
 hide_gridlines ()
 Set the option to hide grid lines on the printed page.
 
 hide_screen_gridlines ()
 Set the option to hide gridlines on the worksheet (as seen on the screen).
 
 insert_bitmap ($row, $col, $bitmap, $x=0, $y=0, $scalex=1, $scaley=1)
 Insert an image in a worksheet.
 
 merge_cells ($firstrow, $firstcol, $lastrow, $lastcol)
 Merges the area given by its arguments.
 
 set_column ($firstcol, $lastcol, $width, $format=null, $hidden=false, $level=0)
 Sets the width (and other settings) of one column.
 
 set_row ($row, $height, $format=null, $hidden=false, $level=0)
 Sets the height (and other settings) of one row.
 
 write ($row, $col, $token, $format=null)
 Write anything somewhere in the worksheet, type will be automatically detected.
 
 write_blank ($row, $col, $format=null)
 Write one blank somewhere in the worksheet.
 
 write_date ($row, $col, $date, $format=null)
 Write one date somewhere in the worksheet.
 
 write_formula ($row, $col, $formula, $format=null)
 Write one formula somewhere in the worksheet.
 
 write_number ($row, $col, $num, $format=null)
 Write one number somewhere in the worksheet.
 
 write_string ($row, $col, $str, $format=null)
 Write one string somewhere in the worksheet.
 
 write_url ($row, $col, $url, $format=null)
 Write one url somewhere in the worksheet.
 

Protected Member Functions

 apply_column_format ($col, $format=null)
 
 apply_format ($row, $col, $format=null)
 
 apply_row_format ($row, $format=null)
 

Protected Attributes

Worksheet $worksheet
 

Detailed Description

Define and operate over one Worksheet.

This class acts as a wrapper around another library maintaining Moodle functions isolated from underlying code.

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

Constructor & Destructor Documentation

◆ __construct()

MoodleExcelWorksheet::__construct ( $name,
Spreadsheet $workbook )

Constructs one Moodle Worksheet.

Parameters
string$nameThe name of the file
Spreadsheet$workbookThe internal Workbook object we are creating.

Member Function Documentation

◆ insert_bitmap()

MoodleExcelWorksheet::insert_bitmap ( $row,
$col,
$bitmap,
$x = 0,
$y = 0,
$scalex = 1,
$scaley = 1 )

Insert an image in a worksheet.

Parameters
integer$rowThe row we are going to insert the bitmap into
integer$colThe column we are going to insert the bitmap into
string$bitmapThe bitmap filename
integer$xThe horizontal position (offset) of the image inside the cell.
integer$yThe vertical position (offset) of the image inside the cell.
integer$scalexThe horizontal scale
integer$scaleyThe vertical scale

◆ merge_cells()

MoodleExcelWorksheet::merge_cells ( $firstrow,
$firstcol,
$lastrow,
$lastcol )

Merges the area given by its arguments.

Parameters
integer$firstrowFirst row of the area to merge
integer$firstcolFirst column of the area to merge
integer$lastrowLast row of the area to merge
integer$lastcolLast column of the area to merge

◆ set_column()

MoodleExcelWorksheet::set_column ( $firstcol,
$lastcol,
$width,
$format = null,
$hidden = false,
$level = 0 )

Sets the width (and other settings) of one column.

Parameters
integer$firstcolfirst column on the range
integer$lastcollast column on the range
integer$widthwidth to set (null to set just format without setting the width)
mixed$formatThe optional format to apply to the columns
bool$hiddenThe optional hidden attribute
integer$levelThe optional outline level (0-7)

◆ set_row()

MoodleExcelWorksheet::set_row ( $row,
$height,
$format = null,
$hidden = false,
$level = 0 )

Sets the height (and other settings) of one row.

Parameters
integer$rowThe row to set
integer$heightHeight we are giving to the row (null to set just format without setting the height)
mixed$formatThe optional format we are giving to the row
bool$hiddenThe optional hidden attribute
integer$levelThe optional outline level (0-7)

◆ write()

MoodleExcelWorksheet::write ( $row,
$col,
$token,
$format = null )

Write anything somewhere in the worksheet, type will be automatically detected.

Parameters
integer$rowZero indexed row
integer$colZero indexed column
mixed$tokenWhat we are writing
mixed$formatThe XF format for the cell

◆ write_blank()

MoodleExcelWorksheet::write_blank ( $row,
$col,
$format = null )

Write one blank somewhere in the worksheet.

Parameters
integer$rowZero indexed row
integer$colZero indexed column
mixed$formatThe XF format for the cell

◆ write_date()

MoodleExcelWorksheet::write_date ( $row,
$col,
$date,
$format = null )

Write one date somewhere in the worksheet.

Parameters
integer$rowZero indexed row
integer$colZero indexed column
int$dateThe date to write in UNIX timestamp format
mixed$formatThe XF format for the cell

◆ write_formula()

MoodleExcelWorksheet::write_formula ( $row,
$col,
$formula,
$format = null )

Write one formula somewhere in the worksheet.

Parameters
integer$rowZero indexed row
integer$colZero indexed column
string$formulaThe formula to write
mixed$formatThe XF format for the cell

◆ write_number()

MoodleExcelWorksheet::write_number ( $row,
$col,
$num,
$format = null )

Write one number somewhere in the worksheet.

Parameters
integer$rowZero indexed row
integer$colZero indexed column
float$numThe number to write
mixed$formatThe XF format for the cell

◆ write_string()

MoodleExcelWorksheet::write_string ( $row,
$col,
$str,
$format = null )

Write one string somewhere in the worksheet.

Parameters
integer$rowZero indexed row
integer$colZero indexed column
string$strThe string to write
mixed$formatThe XF format for the cell

◆ write_url()

MoodleExcelWorksheet::write_url ( $row,
$col,
$url,
$format = null )

Write one url somewhere in the worksheet.

Parameters
integer$rowZero indexed row
integer$colZero indexed column
string$urlThe url to write
mixed$formatThe XF format for the cell

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