ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
ilAssExcelFormatHelper Class Reference

Class ilAssExcelFormatHelper. More...

+ Inheritance diagram for ilAssExcelFormatHelper:
+ Collaboration diagram for ilAssExcelFormatHelper:

Public Member Functions

 __construct ()
 ilAssExcelFormatHelper constructor. More...
 
 setFormattedExcelTitle ($coordinates, $value)
 
 setCellByCoordinates ($a_coords, $a_value)
 
 setCell ($a_row, $a_col, $a_value, $datatype=null)
 
 getStringEscaping ()
 
 setStringEscaping ($stringEscaping)
 
- Public Member Functions inherited from ilExcel
 __construct ()
 Constructor. More...
 
 loadFromFile ($filename)
 Loads a spreadsheet from file. More...
 
 getValidFormats ()
 Get valid file formats. More...
 
 setFormat ($a_format)
 Set file format. More...
 
 addSheet ($a_name, $a_activate=true)
 Add sheet. More...
 
 setActiveSheet ($a_index)
 Set active sheet. More...
 
 getSheetCount ()
 Returns number of sheets. More...
 
 getSheetTitle ()
 Return the current sheet title. More...
 
 setCellByCoordinates ($a_coords, $a_value)
 Set cell value by coordinates. More...
 
 setCell ($a_row, $a_col, $a_value, $a_datatype=null)
 Set cell value. More...
 
 setCellArray (array $a_values, $a_top_left="A1", $a_null_value=null)
 Set cell values from array. More...
 
 getCell ($a_row, $a_col)
 Returns the value of a cell. More...
 
 getSheetAsArray ()
 Returns the active sheet as an array. More...
 
 getColumnCount ()
 Returns the number of columns the sheet contains. More...
 
 getColumnCoord ($a_col)
 Get column "name" from number. More...
 
 sendToClient ($a_file_name)
 Send workbook to client. More...
 
 writeToFile ($a_file)
 Save workbook to file. More...
 
 writeToTmpFile ()
 
 setBold ($a_coords)
 Set cell(s) to bold. More...
 
 setColors ($a_coords, $a_background, $a_font=null)
 Set cell(s) colors. More...
 
 setBorders ($a_coords, $a_top, $a_right=false, $a_bottom=false, $a_left=false)
 Toggle cell(s) borders. More...
 
 getCoordByColumnAndRow ($pColumn=1, $pRow=1)
 Get cell coordinate (e.g. More...
 
 addLink ($a_row, $a_column, $a_path)
 
 columnIndexAdjustment (int $column)
 Adjustment needed because of migration PHPExcel to PhpSpreadsheet. More...
 

Data Fields

const escapeString = true
 
- Data Fields inherited from ilExcel
const FORMAT_XML = "Xlsx"
 
const FORMAT_BIFF = "Xls"
 

Protected Member Functions

 prepareString ($a_value)
 
- Protected Member Functions inherited from ilExcel
 prepareValue ($a_value)
 Prepare value for cell. More...
 
 prepareDateValue (ilDateTime $a_value)
 
 prepareBooleanValue ($a_value)
 
 prepareString ($a_value)
 
 setDateFormat (Cell $a_cell, $a_value)
 Set date format. More...
 
 setGlobalAutoSize ()
 Set all existing columns on all sheets to autosize. More...
 
 prepareStorage ($a_file_name)
 Prepare workbook for storage/delivery. More...
 

Protected Attributes

 $stringEscaping = self::escapeString
 
- Protected Attributes inherited from ilExcel
 $lng
 
 $workbook
 
 $type
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

ilAssExcelFormatHelper::__construct ( )

ilAssExcelFormatHelper constructor.

Definition at line 19 of file class.ilAssExcelFormatHelper.php.

20  {
21  parent::__construct();
22  }

Member Function Documentation

◆ getStringEscaping()

ilAssExcelFormatHelper::getStringEscaping ( )
Returns
int

Definition at line 86 of file class.ilAssExcelFormatHelper.php.

References $stringEscaping.

◆ prepareString()

ilAssExcelFormatHelper::prepareString (   $a_value)
protected
Parameters
string$a_value
Returns
string

Definition at line 74 of file class.ilAssExcelFormatHelper.php.

75  {
76  if ($this->stringEscaping == false) {
77  return $a_value;
78  } else {
79  return strip_tags($a_value);
80  }
81  }

◆ setCell()

ilAssExcelFormatHelper::setCell (   $a_row,
  $a_col,
  $a_value,
  $datatype = null 
)

Definition at line 55 of file class.ilAssExcelFormatHelper.php.

References ilExcel\prepareValue().

56  {
57  if (is_string($a_value) && !is_numeric($a_value)) {
58  $this->workbook->getActiveSheet()->setCellValueExplicitByColumnAndRow(
59  $a_col + 1,
60  $a_row,
61  $this->prepareValue($a_value),
62  \PhpOffice\PhpSpreadsheet\Cell\DataType::TYPE_STRING,
63  true
64  );
65  } else {
66  parent::setCell($a_row, $a_col, $a_value);
67  }
68  }
prepareValue($a_value)
Prepare value for cell.
+ Here is the call graph for this function:

◆ setCellByCoordinates()

ilAssExcelFormatHelper::setCellByCoordinates (   $a_coords,
  $a_value 
)

Definition at line 38 of file class.ilAssExcelFormatHelper.php.

References ilExcel\prepareValue().

Referenced by setFormattedExcelTitle().

39  {
40  if (is_string($a_value) && !is_numeric($a_value)) {
41  $this->workbook->getActiveSheet()->setCellValueExplicit(
42  $a_coords,
43  $this->prepareValue($a_value),
44  \PhpOffice\PhpSpreadsheet\Cell\DataType::TYPE_STRING,
45  true
46  );
47  } else {
48  parent::setCellByCoordinates($a_coords, $a_value);
49  }
50  }
prepareValue($a_value)
Prepare value for cell.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setFormattedExcelTitle()

ilAssExcelFormatHelper::setFormattedExcelTitle (   $coordinates,
  $value 
)
Parameters
string$coordinates
string$value

Definition at line 28 of file class.ilAssExcelFormatHelper.php.

References EXCEL_BACKGROUND_COLOR, ilExcel\setBold(), setCellByCoordinates(), and ilExcel\setColors().

29  {
30  $this->setCellByCoordinates($coordinates, $value);
31  $this->setColors($coordinates, EXCEL_BACKGROUND_COLOR);
32  $this->setBold($coordinates);
33  }
const EXCEL_BACKGROUND_COLOR
setBold($a_coords)
Set cell(s) to bold.
setCellByCoordinates($a_coords, $a_value)
setColors($a_coords, $a_background, $a_font=null)
Set cell(s) colors.
+ Here is the call graph for this function:

◆ setStringEscaping()

ilAssExcelFormatHelper::setStringEscaping (   $stringEscaping)
Parameters
int$stringEscaping

Definition at line 94 of file class.ilAssExcelFormatHelper.php.

References $stringEscaping.

95  {
96  $this->stringEscaping = $stringEscaping;
97  }

Field Documentation

◆ $stringEscaping

ilAssExcelFormatHelper::$stringEscaping = self::escapeString
protected

Definition at line 14 of file class.ilAssExcelFormatHelper.php.

Referenced by getStringEscaping(), and setStringEscaping().

◆ escapeString

const ilAssExcelFormatHelper::escapeString = true

Definition at line 12 of file class.ilAssExcelFormatHelper.php.


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