ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
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)
 
 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)
 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=0, $pRow=1)
 Get cell coordinate (e.g. More...
 

Data Fields

const escapeString = true
 
- Data Fields inherited from ilExcel
const FORMAT_XML = "Excel2007"
 
const FORMAT_BIFF = "Excel5"
 

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 (PHPExcel_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
 $workbook
 
 $type
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

ilAssExcelFormatHelper::__construct ( )

ilAssExcelFormatHelper constructor.

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

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

Member Function Documentation

◆ getStringEscaping()

ilAssExcelFormatHelper::getStringEscaping ( )
Returns
int

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

References $stringEscaping.

◆ prepareString()

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

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

82  {
83  if($this->stringEscaping == false)
84  {
85  return $a_value;
86  }
87  else
88  {
89  return strip_tags($a_value);
90  }
91  }

◆ setCell()

ilAssExcelFormatHelper::setCell (   $a_row,
  $a_col,
  $a_value 
)

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

References ilExcel\prepareValue(), PHPExcel_Cell_DataType\TYPE_STRING, and workbook.

60  {
61  if(is_string($a_value) && !is_numeric($a_value))
62  {
63  $this->workbook->getActiveSheet()->setCellValueExplicitByColumnAndRow(
64  $a_col,
65  $a_row,
66  $this->prepareValue($a_value),
68  true
69  );
70  }
71  else
72  {
73  parent::setCell($a_row, $a_col, $a_value);
74  }
75  }
Add a hyperlink to another cell on a different worksheet within the workbook
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 39 of file class.ilAssExcelFormatHelper.php.

References ilExcel\prepareValue(), PHPExcel_Cell_DataType\TYPE_STRING, and workbook.

Referenced by setFormattedExcelTitle().

40  {
41  if(is_string($a_value) && !is_numeric($a_value))
42  {
43  $this->workbook->getActiveSheet()->setCellValueExplicit(
44  $a_coords,
45  $this->prepareValue($a_value),
47  true
48  );
49  }
50  else
51  {
52  parent::setCellByCoordinates($a_coords, $a_value);
53  }
54  }
Add a hyperlink to another cell on a different worksheet within the workbook
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 29 of file class.ilAssExcelFormatHelper.php.

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

30  {
31  $this->setCellByCoordinates($coordinates, $value);
32  $this->setColors($coordinates, EXCEL_BACKGROUND_COLOR);
33  $this->setBold($coordinates);
34  }
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 104 of file class.ilAssExcelFormatHelper.php.

References $stringEscaping.

105  {
106  $this->stringEscaping = $stringEscaping;
107  }

Field Documentation

◆ $stringEscaping

ilAssExcelFormatHelper::$stringEscaping = self::escapeString
protected

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

Referenced by getStringEscaping(), and setStringEscaping().

◆ escapeString

const ilAssExcelFormatHelper::escapeString = true

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


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