ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
PHPExcel Class Reference
+ Collaboration diagram for PHPExcel:

Public Member Functions

 hasMacros ()
 The workbook has macros ? More...
 
 setHasMacros ($hasMacros=false)
 Define if a workbook has macros. More...
 
 setMacrosCode ($MacrosCode)
 Set the macros code. More...
 
 getMacrosCode ()
 Return the macros code. More...
 
 setMacrosCertificate ($Certificate=NULL)
 Set the macros certificate. More...
 
 hasMacrosCertificate ()
 Is the project signed ? More...
 
 getMacrosCertificate ()
 Return the macros certificate. More...
 
 discardMacros ()
 Remove all macros, certificate from spreadsheet. More...
 
 setRibbonXMLData ($Target=NULL, $XMLData=NULL)
 set ribbon XML data More...
 
 getRibbonXMLData ($What='all')
 retrieve ribbon XML Data More...
 
 setRibbonBinObjects ($BinObjectsNames=NULL, $BinObjectsData=NULL)
 store binaries ribbon objects (pictures) More...
 
 getRibbonBinObjects ($What='all')
 retrieve Binaries Ribbon Objects More...
 
 hasRibbon ()
 This workbook have a custom UI ? More...
 
 hasRibbonBinObjects ()
 This workbook have additionnal object for the ribbon ? More...
 
 sheetCodeNameExists ($pSheetCodeName)
 Check if a sheet with a specified code name already exists. More...
 
 getSheetByCodeName ($pName='')
 Get sheet by code name. More...
 
 __construct ()
 Create a new PHPExcel with one Worksheet. More...
 
 __destruct ()
 Code to execute when this worksheet is unset() More...
 
 disconnectWorksheets ()
 Disconnect all worksheets from this PHPExcel workbook object, typically so that the PHPExcel object can be unset. More...
 
 getCalculationEngine ()
 Return the calculation engine for this worksheet. More...
 
 getProperties ()
 Get properties. More...
 
 setProperties (PHPExcel_DocumentProperties $pValue)
 Set properties. More...
 
 getSecurity ()
 Get security. More...
 
 setSecurity (PHPExcel_DocumentSecurity $pValue)
 Set security. More...
 
 getActiveSheet ()
 Get active sheet. More...
 
 createSheet ($iSheetIndex=NULL)
 Create sheet and add it to this workbook. More...
 
 sheetNameExists ($pSheetName)
 Check if a sheet with a specified name already exists. More...
 
 addSheet (PHPExcel_Worksheet $pSheet, $iSheetIndex=NULL)
 Add sheet. More...
 
 removeSheetByIndex ($pIndex=0)
 Remove sheet by index. More...
 
 getSheet ($pIndex=0)
 Get sheet by index. More...
 
 getAllSheets ()
 Get all sheets. More...
 
 getSheetByName ($pName='')
 Get sheet by name. More...
 
 getIndex (PHPExcel_Worksheet $pSheet)
 Get index for sheet. More...
 
 setIndexByName ($sheetName, $newIndex)
 Set index for sheet by sheet name. More...
 
 getSheetCount ()
 Get sheet count. More...
 
 getActiveSheetIndex ()
 Get active sheet index. More...
 
 setActiveSheetIndex ($pIndex=0)
 Set active sheet index. More...
 
 setActiveSheetIndexByName ($pValue='')
 Set active sheet index by name. More...
 
 getSheetNames ()
 Get sheet names. More...
 
 addExternalSheet (PHPExcel_Worksheet $pSheet, $iSheetIndex=null)
 Add external sheet. More...
 
 getNamedRanges ()
 Get named ranges. More...
 
 addNamedRange (PHPExcel_NamedRange $namedRange)
 Add named range. More...
 
 getNamedRange ($namedRange, PHPExcel_Worksheet $pSheet=null)
 Get named range. More...
 
 removeNamedRange ($namedRange, PHPExcel_Worksheet $pSheet=null)
 Remove named range. More...
 
 getWorksheetIterator ()
 Get worksheet iterator. More...
 
 copy ()
 Copy workbook (!= clone!) More...
 
 __clone ()
 Implement PHP __clone to create a deep clone, not just a shallow copy. More...
 
 getCellXfCollection ()
 Get the workbook collection of cellXfs. More...
 
 getCellXfByIndex ($pIndex=0)
 Get cellXf by index. More...
 
 getCellXfByHashCode ($pValue='')
 Get cellXf by hash code. More...
 
 cellXfExists ($pCellStyle=null)
 Check if style exists in style collection. More...
 
 getDefaultStyle ()
 Get default style. More...
 
 addCellXf (PHPExcel_Style $style)
 Add a cellXf to the workbook. More...
 
 removeCellXfByIndex ($pIndex=0)
 Remove cellXf by index. More...
 
 getCellXfSupervisor ()
 Get the cellXf supervisor. More...
 
 getCellStyleXfCollection ()
 Get the workbook collection of cellStyleXfs. More...
 
 getCellStyleXfByIndex ($pIndex=0)
 Get cellStyleXf by index. More...
 
 getCellStyleXfByHashCode ($pValue='')
 Get cellStyleXf by hash code. More...
 
 addCellStyleXf (PHPExcel_Style $pStyle)
 Add a cellStyleXf to the workbook. More...
 
 removeCellStyleXfByIndex ($pIndex=0)
 Remove cellStyleXf by index. More...
 
 garbageCollect ()
 Eliminate all unneeded cellXf and afterwards update the xfIndex for all cells and columns in the workbook. More...
 
 getID ()
 Return the unique ID value assigned to this spreadsheet workbook. More...
 

Private Member Functions

 _getExtensionOnly ($ThePath)
 return the extension of a filename. More...
 

Private Attributes

 $_uniqueID
 
 $_properties
 
 $_security
 
 $_workSheetCollection = array()
 
 $_calculationEngine = NULL
 
 $_activeSheetIndex = 0
 
 $_namedRanges = array()
 
 $_cellXfSupervisor
 
 $_cellXfCollection = array()
 
 $_cellStyleXfCollection = array()
 
 $_hasMacros = FALSE
 
 $_macrosCode =NULL
 
 $_macrosCertificate =NULL
 
 $_ribbonXMLData =NULL
 
 $_ribbonBinObjects =NULL
 

Detailed Description

Definition at line 43 of file PHPExcel.php.

Constructor & Destructor Documentation

◆ __construct()

PHPExcel::__construct ( )

Create a new PHPExcel with one Worksheet.

Definition at line 357 of file PHPExcel.php.

358 {
359 $this->_uniqueID = uniqid();
360 $this->_calculationEngine = PHPExcel_Calculation::getInstance($this);
361
362 // Initialise worksheet collection and add one worksheet
363 $this->_workSheetCollection = array();
364 $this->_workSheetCollection[] = new PHPExcel_Worksheet($this);
365 $this->_activeSheetIndex = 0;
366
367 // Create document properties
368 $this->_properties = new PHPExcel_DocumentProperties();
369
370 // Create document security
371 $this->_security = new PHPExcel_DocumentSecurity();
372
373 // Set named ranges
374 $this->_namedRanges = array();
375
376 // Create the cellXf supervisor
377 $this->_cellXfSupervisor = new PHPExcel_Style(true);
378 $this->_cellXfSupervisor->bindParent($this);
379
380 // Create the default style
381 $this->addCellXf(new PHPExcel_Style);
382 $this->addCellStyleXf(new PHPExcel_Style);
383 }
static getInstance(PHPExcel $workbook=NULL)
Get an instance of this class.
addCellXf(PHPExcel_Style $style)
Add a cellXf to the workbook.
Definition: PHPExcel.php:938
addCellStyleXf(PHPExcel_Style $pStyle)
Add a cellStyleXf to the workbook.
Definition: PHPExcel.php:1027

References addCellStyleXf(), addCellXf(), and PHPExcel_Calculation\getInstance().

+ Here is the call graph for this function:

◆ __destruct()

PHPExcel::__destruct ( )

Code to execute when this worksheet is unset()

Definition at line 389 of file PHPExcel.php.

389 {
391 $this->disconnectWorksheets();
392 } // function __destruct()
static unsetInstance(PHPExcel $workbook=NULL)
Unset an instance of this class.
disconnectWorksheets()
Disconnect all worksheets from this PHPExcel workbook object, typically so that the PHPExcel object c...
Definition: PHPExcel.php:399

References disconnectWorksheets(), and PHPExcel_Calculation\unsetInstance().

+ Here is the call graph for this function:

Member Function Documentation

◆ __clone()

PHPExcel::__clone ( )

Implement PHP __clone to create a deep clone, not just a shallow copy.

Definition at line 863 of file PHPExcel.php.

863 {
864 foreach($this as $key => $val) {
865 if (is_object($val) || (is_array($val))) {
866 $this->{$key} = unserialize(serialize($val));
867 }
868 }
869 }
$key
Definition: croninfo.php:18

References $key.

◆ _getExtensionOnly()

PHPExcel::_getExtensionOnly (   $ThePath)
private

return the extension of a filename.

Internal use for a array_map callback (php<5.3 don't like lambda function)

Definition at line 275 of file PHPExcel.php.

275 {
276 return pathinfo($ThePath, PATHINFO_EXTENSION);
277 }

◆ addCellStyleXf()

PHPExcel::addCellStyleXf ( PHPExcel_Style  $pStyle)

Add a cellStyleXf to the workbook.

Parameters
PHPExcel_Style$pStyle

Definition at line 1027 of file PHPExcel.php.

1028 {
1029 $this->_cellStyleXfCollection[] = $pStyle;
1030 $pStyle->setIndex(count($this->_cellStyleXfCollection) - 1);
1031 }
setIndex($pValue)
Set own index in style collection.
Definition: Style.php:663

References PHPExcel_Style\setIndex().

Referenced by __construct().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ addCellXf()

PHPExcel::addCellXf ( PHPExcel_Style  $style)

Add a cellXf to the workbook.

Parameters
PHPExcel_Style$style

Definition at line 938 of file PHPExcel.php.

939 {
940 $this->_cellXfCollection[] = $style;
941 $style->setIndex(count($this->_cellXfCollection) - 1);
942 }
$style
Definition: example_012.php:70

References $style.

Referenced by __construct(), and addExternalSheet().

+ Here is the caller graph for this function:

◆ addExternalSheet()

PHPExcel::addExternalSheet ( PHPExcel_Worksheet  $pSheet,
  $iSheetIndex = null 
)

Add external sheet.

Parameters
PHPExcel_Worksheet$pSheetExternal sheet to add
int | null$iSheetIndexIndex where sheet should go (0,1,..., or null for last)
Exceptions
PHPExcel_Exception
Returns
PHPExcel_Worksheet

Definition at line 738 of file PHPExcel.php.

738 {
739 if ($this->sheetNameExists($pSheet->getTitle())) {
740 throw new PHPExcel_Exception("Workbook already contains a worksheet named '{$pSheet->getTitle()}'. Rename the external sheet first.");
741 }
742
743 // count how many cellXfs there are in this workbook currently, we will need this below
744 $countCellXfs = count($this->_cellXfCollection);
745
746 // copy all the shared cellXfs from the external workbook and append them to the current
747 foreach ($pSheet->getParent()->getCellXfCollection() as $cellXf) {
748 $this->addCellXf(clone $cellXf);
749 }
750
751 // move sheet to this workbook
752 $pSheet->rebindParent($this);
753
754 // update the cellXfs
755 foreach ($pSheet->getCellCollection(false) as $cellID) {
756 $cell = $pSheet->getCell($cellID);
757 $cell->setXfIndex( $cell->getXfIndex() + $countCellXfs );
758 }
759
760 return $this->addSheet($pSheet, $iSheetIndex);
761 }
getCell($pCoordinate='A1')
Get cell at a specific coordinate.
Definition: Worksheet.php:1153
rebindParent(PHPExcel $parent)
Re-bind parent.
Definition: Worksheet.php:796
getTitle()
Get title.
Definition: Worksheet.php:817
getCellCollection($pSorted=true)
Get collection of cells.
Definition: Worksheet.php:484
getParent()
Get parent.
Definition: Worksheet.php:786
sheetNameExists($pSheetName)
Check if a sheet with a specified name already exists.
Definition: PHPExcel.php:492
addSheet(PHPExcel_Worksheet $pSheet, $iSheetIndex=NULL)
Add sheet.
Definition: PHPExcel.php:505

References addCellXf(), addSheet(), PHPExcel_Worksheet\getCell(), PHPExcel_Worksheet\getCellCollection(), PHPExcel_Worksheet\getParent(), PHPExcel_Worksheet\getTitle(), PHPExcel_Worksheet\rebindParent(), and sheetNameExists().

+ Here is the call graph for this function:

◆ addNamedRange()

PHPExcel::addNamedRange ( PHPExcel_NamedRange  $namedRange)

Add named range.

Parameters
PHPExcel_NamedRange$namedRange
Returns
PHPExcel

Definition at line 778 of file PHPExcel.php.

778 {
779 if ($namedRange->getScope() == null) {
780 // global scope
781 $this->_namedRanges[$namedRange->getName()] = $namedRange;
782 } else {
783 // local scope
784 $this->_namedRanges[$namedRange->getScope()->getTitle().'!'.$namedRange->getName()] = $namedRange;
785 }
786 return true;
787 }
getName()
Get name.
Definition: NamedRange.php:104
getScope()
Get scope.
Definition: NamedRange.php:206

References PHPExcel_NamedRange\getName(), and PHPExcel_NamedRange\getScope().

Referenced by PHPExcel_Worksheet\rebindParent().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ addSheet()

PHPExcel::addSheet ( PHPExcel_Worksheet  $pSheet,
  $iSheetIndex = NULL 
)

Add sheet.

Parameters
PHPExcel_Worksheet$pSheet
int | null$iSheetIndexIndex where sheet should go (0,1,..., or null for last)
Returns
PHPExcel_Worksheet
Exceptions
PHPExcel_Exception

Definition at line 505 of file PHPExcel.php.

506 {
507 if ($this->sheetNameExists($pSheet->getTitle())) {
508 throw new PHPExcel_Exception(
509 "Workbook already contains a worksheet named '{$pSheet->getTitle()}'. Rename this worksheet first."
510 );
511 }
512
513 if($iSheetIndex === NULL) {
514 if ($this->_activeSheetIndex < 0) {
515 $this->_activeSheetIndex = 0;
516 }
517 $this->_workSheetCollection[] = $pSheet;
518 } else {
519 // Insert the sheet at the requested index
520 array_splice(
521 $this->_workSheetCollection,
522 $iSheetIndex,
523 0,
524 array($pSheet)
525 );
526
527 // Adjust active sheet index if necessary
528 if ($this->_activeSheetIndex >= $iSheetIndex) {
530 }
531 }
532
533 if ($pSheet->getParent() === null) {
534 $pSheet->rebindParent($this);
535 }
536
537 return $pSheet;
538 }
$_activeSheetIndex
Definition: PHPExcel.php:85

References $_activeSheetIndex, PHPExcel_Worksheet\getParent(), PHPExcel_Worksheet\getTitle(), PHPExcel_Worksheet\rebindParent(), and sheetNameExists().

Referenced by addExternalSheet(), and createSheet().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ cellXfExists()

PHPExcel::cellXfExists (   $pCellStyle = null)

Check if style exists in style collection.

Parameters
PHPExcel_Style$pCellStyle
Returns
boolean

Definition at line 914 of file PHPExcel.php.

915 {
916 return in_array($pCellStyle, $this->_cellXfCollection, true);
917 }

◆ copy()

PHPExcel::copy ( )

Copy workbook (!= clone!)

Returns
PHPExcel

Definition at line 848 of file PHPExcel.php.

848 {
849 $copied = clone $this;
850
851 $worksheetCount = count($this->_workSheetCollection);
852 for ($i = 0; $i < $worksheetCount; ++$i) {
853 $this->_workSheetCollection[$i] = $this->_workSheetCollection[$i]->copy();
854 $this->_workSheetCollection[$i]->rebindParent($this);
855 }
856
857 return $copied;
858 }
$i
Definition: disco.tpl.php:19

References $i.

◆ createSheet()

PHPExcel::createSheet (   $iSheetIndex = NULL)

Create sheet and add it to this workbook.

Parameters
int | null$iSheetIndexIndex where sheet should go (0,1,..., or null for last)
Returns
PHPExcel_Worksheet
Exceptions
PHPExcel_Exception

Definition at line 479 of file PHPExcel.php.

480 {
481 $newSheet = new PHPExcel_Worksheet($this);
482 $this->addSheet($newSheet, $iSheetIndex);
483 return $newSheet;
484 }

References addSheet().

+ Here is the call graph for this function:

◆ discardMacros()

PHPExcel::discardMacros ( )

Remove all macros, certificate from spreadsheet.

Parameters
none
Returns
void

Definition at line 220 of file PHPExcel.php.

220 {
221 $this->_hasMacros=false;
222 $this->_macrosCode=NULL;
223 $this->_macrosCertificate=NULL;
224 }

◆ disconnectWorksheets()

PHPExcel::disconnectWorksheets ( )

Disconnect all worksheets from this PHPExcel workbook object, typically so that the PHPExcel object can be unset.

Definition at line 399 of file PHPExcel.php.

400 {
401 $worksheet = NULL;
402 foreach($this->_workSheetCollection as $k => &$worksheet) {
403 $worksheet->disconnectCells();
404 $this->_workSheetCollection[$k] = null;
405 }
406 unset($worksheet);
407 $this->_workSheetCollection = array();
408 }
$worksheet

References $worksheet.

Referenced by __destruct().

+ Here is the caller graph for this function:

◆ garbageCollect()

PHPExcel::garbageCollect ( )

Eliminate all unneeded cellXf and afterwards update the xfIndex for all cells and columns in the workbook.

Definition at line 1052 of file PHPExcel.php.

1053 {
1054 // how many references are there to each cellXf ?
1055 $countReferencesCellXf = array();
1056 foreach ($this->_cellXfCollection as $index => $cellXf) {
1057 $countReferencesCellXf[$index] = 0;
1058 }
1059
1060 foreach ($this->getWorksheetIterator() as $sheet) {
1061
1062 // from cells
1063 foreach ($sheet->getCellCollection(false) as $cellID) {
1064 $cell = $sheet->getCell($cellID);
1065 ++$countReferencesCellXf[$cell->getXfIndex()];
1066 }
1067
1068 // from row dimensions
1069 foreach ($sheet->getRowDimensions() as $rowDimension) {
1070 if ($rowDimension->getXfIndex() !== null) {
1071 ++$countReferencesCellXf[$rowDimension->getXfIndex()];
1072 }
1073 }
1074
1075 // from column dimensions
1076 foreach ($sheet->getColumnDimensions() as $columnDimension) {
1077 ++$countReferencesCellXf[$columnDimension->getXfIndex()];
1078 }
1079 }
1080
1081 // remove cellXfs without references and create mapping so we can update xfIndex
1082 // for all cells and columns
1083 $countNeededCellXfs = 0;
1084 foreach ($this->_cellXfCollection as $index => $cellXf) {
1085 if ($countReferencesCellXf[$index] > 0 || $index == 0) { // we must never remove the first cellXf
1086 ++$countNeededCellXfs;
1087 } else {
1088 unset($this->_cellXfCollection[$index]);
1089 }
1090 $map[$index] = $countNeededCellXfs - 1;
1091 }
1092 $this->_cellXfCollection = array_values($this->_cellXfCollection);
1093
1094 // update the index for all cellXfs
1095 foreach ($this->_cellXfCollection as $i => $cellXf) {
1096 $cellXf->setIndex($i);
1097 }
1098
1099 // make sure there is always at least one cellXf (there should be)
1100 if (empty($this->_cellXfCollection)) {
1101 $this->_cellXfCollection[] = new PHPExcel_Style();
1102 }
1103
1104 // update the xfIndex for all cells, row dimensions, column dimensions
1105 foreach ($this->getWorksheetIterator() as $sheet) {
1106
1107 // for all cells
1108 foreach ($sheet->getCellCollection(false) as $cellID) {
1109 $cell = $sheet->getCell($cellID);
1110 $cell->setXfIndex( $map[$cell->getXfIndex()] );
1111 }
1112
1113 // for all row dimensions
1114 foreach ($sheet->getRowDimensions() as $rowDimension) {
1115 if ($rowDimension->getXfIndex() !== null) {
1116 $rowDimension->setXfIndex( $map[$rowDimension->getXfIndex()] );
1117 }
1118 }
1119
1120 // for all column dimensions
1121 foreach ($sheet->getColumnDimensions() as $columnDimension) {
1122 $columnDimension->setXfIndex( $map[$columnDimension->getXfIndex()] );
1123 }
1124
1125 // also do garbage collection for all the sheets
1126 $sheet->garbageCollect();
1127 }
1128 }
getWorksheetIterator()
Get worksheet iterator.
Definition: PHPExcel.php:839
$index
Definition: metadata.php:60

References $i, $index, and getWorksheetIterator().

+ Here is the call graph for this function:

◆ getActiveSheet()

PHPExcel::getActiveSheet ( )

Get active sheet.

Returns
PHPExcel_Worksheet
Exceptions
PHPExcel_Exception

Definition at line 467 of file PHPExcel.php.

468 {
469 return $this->getSheet($this->_activeSheetIndex);
470 }
getSheet($pIndex=0)
Get sheet by index.
Definition: PHPExcel.php:573

References getSheet().

Referenced by setActiveSheetIndex().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getActiveSheetIndex()

PHPExcel::getActiveSheetIndex ( )

Get active sheet index.

Returns
int Active sheet index

Definition at line 671 of file PHPExcel.php.

672 {
674 }

References $_activeSheetIndex.

◆ getAllSheets()

PHPExcel::getAllSheets ( )

Get all sheets.

Returns
PHPExcel_Worksheet[]

Definition at line 590 of file PHPExcel.php.

591 {
593 }
$_workSheetCollection
Definition: PHPExcel.php:71

References $_workSheetCollection.

◆ getCalculationEngine()

PHPExcel::getCalculationEngine ( )

Return the calculation engine for this worksheet.

Returns
PHPExcel_Calculation

Definition at line 415 of file PHPExcel.php.

416 {
418 } // function getCellCacheController()
$_calculationEngine
Definition: PHPExcel.php:78

References $_calculationEngine.

◆ getCellStyleXfByHashCode()

PHPExcel::getCellStyleXfByHashCode (   $pValue = '')

Get cellStyleXf by hash code.

Parameters
string$pValue
Returns
PHPExcel_Style|false

Definition at line 1012 of file PHPExcel.php.

1013 {
1014 foreach ($this->_cellStyleXfCollection as $cellStyleXf) {
1015 if ($cellStyleXf->getHashCode() == $pValue) {
1016 return $cellStyleXf;
1017 }
1018 }
1019 return false;
1020 }

◆ getCellStyleXfByIndex()

PHPExcel::getCellStyleXfByIndex (   $pIndex = 0)

Get cellStyleXf by index.

Parameters
int$pIndex
Returns
PHPExcel_Style

Definition at line 1001 of file PHPExcel.php.

1002 {
1003 return $this->_cellStyleXfCollection[$pIndex];
1004 }

◆ getCellStyleXfCollection()

PHPExcel::getCellStyleXfCollection ( )

Get the workbook collection of cellStyleXfs.

Returns
PHPExcel_Style[]

Definition at line 990 of file PHPExcel.php.

991 {
993 }
$_cellStyleXfCollection
Definition: PHPExcel.php:113

References $_cellStyleXfCollection.

◆ getCellXfByHashCode()

PHPExcel::getCellXfByHashCode (   $pValue = '')

Get cellXf by hash code.

Parameters
string$pValue
Returns
PHPExcel_Style|false

Definition at line 898 of file PHPExcel.php.

899 {
900 foreach ($this->_cellXfCollection as $cellXf) {
901 if ($cellXf->getHashCode() == $pValue) {
902 return $cellXf;
903 }
904 }
905 return false;
906 }

◆ getCellXfByIndex()

PHPExcel::getCellXfByIndex (   $pIndex = 0)

Get cellXf by index.

Parameters
int$pIndex
Returns
PHPExcel_Style

Definition at line 887 of file PHPExcel.php.

888 {
889 return $this->_cellXfCollection[$pIndex];
890 }

◆ getCellXfCollection()

PHPExcel::getCellXfCollection ( )

Get the workbook collection of cellXfs.

Returns
PHPExcel_Style[]

Definition at line 876 of file PHPExcel.php.

877 {
879 }
$_cellXfCollection
Definition: PHPExcel.php:106

References $_cellXfCollection.

◆ getCellXfSupervisor()

PHPExcel::getCellXfSupervisor ( )

Get the cellXf supervisor.

Returns
PHPExcel_Style

Definition at line 980 of file PHPExcel.php.

981 {
983 }
$_cellXfSupervisor
Definition: PHPExcel.php:99

References $_cellXfSupervisor.

◆ getDefaultStyle()

PHPExcel::getDefaultStyle ( )

Get default style.

Returns
PHPExcel_Style
Exceptions
PHPExcel_Exception

Definition at line 925 of file PHPExcel.php.

926 {
927 if (isset($this->_cellXfCollection[0])) {
928 return $this->_cellXfCollection[0];
929 }
930 throw new PHPExcel_Exception('No default style found for this workbook');
931 }

Referenced by PHPExcel_Writer_HTML\__construct().

+ Here is the caller graph for this function:

◆ getID()

PHPExcel::getID ( )

Return the unique ID value assigned to this spreadsheet workbook.

Returns
string

Definition at line 1135 of file PHPExcel.php.

1135 {
1136 return $this->_uniqueID;
1137 }

References $_uniqueID.

◆ getIndex()

PHPExcel::getIndex ( PHPExcel_Worksheet  $pSheet)

Get index for sheet.

Parameters
PHPExcel_Worksheet$pSheet
Returns
Sheet index
Exceptions
PHPExcel_Exception

Definition at line 620 of file PHPExcel.php.

621 {
622 foreach ($this->_workSheetCollection as $key => $value) {
623 if ($value->getHashCode() == $pSheet->getHashCode()) {
624 return $key;
625 }
626 }
627
628 throw new PHPExcel_Exception("Sheet does not exist.");
629 }
getHashCode()
Get hash code.
Definition: Worksheet.php:2632

References $key, and PHPExcel_Worksheet\getHashCode().

Referenced by setActiveSheetIndexByName(), and setIndexByName().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getMacrosCertificate()

PHPExcel::getMacrosCertificate ( )

Return the macros certificate.

Returns
binary|null

Definition at line 210 of file PHPExcel.php.

210 {
212 }
$_macrosCertificate
Definition: PHPExcel.php:133

References $_macrosCertificate.

◆ getMacrosCode()

PHPExcel::getMacrosCode ( )

Return the macros code.

Returns
binary|null

Definition at line 183 of file PHPExcel.php.

183 {
184 return $this->_macrosCode;
185 }

References $_macrosCode.

◆ getNamedRange()

PHPExcel::getNamedRange (   $namedRange,
PHPExcel_Worksheet  $pSheet = null 
)

Get named range.

Parameters
string$namedRange
PHPExcel_Worksheet | null$pSheetScope. Use null for global scope
Returns
PHPExcel_NamedRange|null

Definition at line 796 of file PHPExcel.php.

796 {
797 $returnValue = null;
798
799 if ($namedRange != '' && ($namedRange !== NULL)) {
800 // first look for global defined name
801 if (isset($this->_namedRanges[$namedRange])) {
802 $returnValue = $this->_namedRanges[$namedRange];
803 }
804
805 // then look for local defined name (has priority over global defined name if both names exist)
806 if (($pSheet !== NULL) && isset($this->_namedRanges[$pSheet->getTitle() . '!' . $namedRange])) {
807 $returnValue = $this->_namedRanges[$pSheet->getTitle() . '!' . $namedRange];
808 }
809 }
810
811 return $returnValue;
812 }

◆ getNamedRanges()

PHPExcel::getNamedRanges ( )

Get named ranges.

Returns
PHPExcel_NamedRange[]

Definition at line 768 of file PHPExcel.php.

768 {
769 return $this->_namedRanges;
770 }
$_namedRanges
Definition: PHPExcel.php:92

References $_namedRanges.

Referenced by PHPExcel_Writer_Excel2007_Workbook\_writeNamedRanges().

+ Here is the caller graph for this function:

◆ getProperties()

PHPExcel::getProperties ( )

Get properties.

Returns
PHPExcel_DocumentProperties

Definition at line 425 of file PHPExcel.php.

426 {
427 return $this->_properties;
428 }
$_properties
Definition: PHPExcel.php:57

References $_properties.

◆ getRibbonBinObjects()

PHPExcel::getRibbonBinObjects (   $What = 'all')

retrieve Binaries Ribbon Objects

Definition at line 283 of file PHPExcel.php.

283 {
284 $ReturnData=NULL;
285 $What=strtolower($What);
286 switch($What){
287 case 'all':
289 break;
290 case 'names':
291 case 'data':
292 if(is_array($this->_ribbonBinObjects) && array_key_exists($What, $this->_ribbonBinObjects)){
293 $ReturnData=$this->_ribbonBinObjects[$What];
294 }
295 break;
296 case 'types':
297 if(is_array($this->_ribbonBinObjects) && array_key_exists('data', $this->_ribbonBinObjects) && is_array($this->_ribbonBinObjects['data'])){
298 $tmpTypes=array_keys($this->_ribbonBinObjects['data']);
299 $ReturnData=array_unique(array_map(array($this,'_getExtensionOnly'), $tmpTypes));
300 }else
301 $ReturnData=array();//the caller want an array... not null if empty
302 break;
303 }
304 return $ReturnData;
305 }
$_ribbonBinObjects
Definition: PHPExcel.php:148

References $_ribbonBinObjects.

◆ getRibbonXMLData()

PHPExcel::getRibbonXMLData (   $What = 'all')

retrieve ribbon XML Data

return string|null|array

Definition at line 243 of file PHPExcel.php.

243 {//we need some constants here...
244 $ReturnData=NULL;
245 $What=strtolower($What);
246 switch($What){
247 case 'all':
248 $ReturnData=$this->_ribbonXMLData;
249 break;
250 case 'target':
251 case 'data':
252 if(is_array($this->_ribbonXMLData) && array_key_exists($What,$this->_ribbonXMLData)){
253 $ReturnData=$this->_ribbonXMLData[$What];
254 }//else $ReturnData stay at null
255 break;
256 }//default: $ReturnData at null
257 return $ReturnData;
258 }
$_ribbonXMLData
Definition: PHPExcel.php:140

References $_ribbonXMLData.

◆ getSecurity()

PHPExcel::getSecurity ( )

Get security.

Returns
PHPExcel_DocumentSecurity

Definition at line 445 of file PHPExcel.php.

446 {
447 return $this->_security;
448 }

References $_security.

◆ getSheet()

PHPExcel::getSheet (   $pIndex = 0)

Get sheet by index.

Parameters
int$pIndexSheet index
Returns
PHPExcel_Worksheet
Exceptions
PHPExcel_Exception

Definition at line 573 of file PHPExcel.php.

574 {
575 if (!isset($this->_workSheetCollection[$pIndex])) {
576 $numSheets = $this->getSheetCount();
577 throw new PHPExcel_Exception(
578 "Your requested sheet index: {$pIndex} is out of bounds. The actual number of sheets is {$numSheets}."
579 );
580 }
581
582 return $this->_workSheetCollection[$pIndex];
583 }
getSheetCount()
Get sheet count.
Definition: PHPExcel.php:661

References getSheetCount().

Referenced by getActiveSheet(), and getSheetNames().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getSheetByCodeName()

PHPExcel::getSheetByCodeName (   $pName = '')

Get sheet by code name.

Warning : sheet don't have always a code name !

Parameters
string$pNameSheet name
Returns
PHPExcel_Worksheet

Definition at line 342 of file PHPExcel.php.

343 {
344 $worksheetCount = count($this->_workSheetCollection);
345 for ($i = 0; $i < $worksheetCount; ++$i) {
346 if ($this->_workSheetCollection[$i]->getCodeName() == $pName) {
347 return $this->_workSheetCollection[$i];
348 }
349 }
350
351 return null;
352 }

References $i.

Referenced by sheetCodeNameExists().

+ Here is the caller graph for this function:

◆ getSheetByName()

PHPExcel::getSheetByName (   $pName = '')

Get sheet by name.

Parameters
string$pNameSheet name
Returns
PHPExcel_Worksheet

Definition at line 601 of file PHPExcel.php.

602 {
603 $worksheetCount = count($this->_workSheetCollection);
604 for ($i = 0; $i < $worksheetCount; ++$i) {
605 if ($this->_workSheetCollection[$i]->getTitle() === $pName) {
606 return $this->_workSheetCollection[$i];
607 }
608 }
609
610 return NULL;
611 }

References $i.

Referenced by setActiveSheetIndexByName(), setIndexByName(), and sheetNameExists().

+ Here is the caller graph for this function:

◆ getSheetCount()

PHPExcel::getSheetCount ( )

Get sheet count.

Returns
int

Definition at line 661 of file PHPExcel.php.

662 {
663 return count($this->_workSheetCollection);
664 }

Referenced by getSheet(), getSheetNames(), and PHPExcel_Reader_CSV\loadIntoExisting().

+ Here is the caller graph for this function:

◆ getSheetNames()

PHPExcel::getSheetNames ( )

Get sheet names.

Returns
string[]

Definition at line 719 of file PHPExcel.php.

720 {
721 $returnValue = array();
722 $worksheetCount = $this->getSheetCount();
723 for ($i = 0; $i < $worksheetCount; ++$i) {
724 $returnValue[] = $this->getSheet($i)->getTitle();
725 }
726
727 return $returnValue;
728 }

References $i, getSheet(), and getSheetCount().

+ Here is the call graph for this function:

◆ getWorksheetIterator()

PHPExcel::getWorksheetIterator ( )

Get worksheet iterator.

Returns
PHPExcel_WorksheetIterator

Definition at line 839 of file PHPExcel.php.

Referenced by garbageCollect(), and PHPExcel_ReferenceHelper\updateNamedFormulas().

+ Here is the caller graph for this function:

◆ hasMacros()

PHPExcel::hasMacros ( )

The workbook has macros ?

Returns
true if workbook has macros, false if not

Definition at line 155 of file PHPExcel.php.

155 {
156 return $this->_hasMacros;
157 }

References $_hasMacros.

◆ hasMacrosCertificate()

PHPExcel::hasMacrosCertificate ( )

Is the project signed ?

Returns
true|false

Definition at line 201 of file PHPExcel.php.

201 {
202 return !is_null($this->_macrosCertificate);
203 }

◆ hasRibbon()

PHPExcel::hasRibbon ( )

This workbook have a custom UI ?

Returns
true|false

Definition at line 312 of file PHPExcel.php.

312 {
313 return !is_null($this->_ribbonXMLData);
314 }

◆ hasRibbonBinObjects()

PHPExcel::hasRibbonBinObjects ( )

This workbook have additionnal object for the ribbon ?

Returns
true|false

Definition at line 321 of file PHPExcel.php.

321 {
322 return !is_null($this->_ribbonBinObjects);
323 }

◆ removeCellStyleXfByIndex()

PHPExcel::removeCellStyleXfByIndex (   $pIndex = 0)

Remove cellStyleXf by index.

Parameters
int$pIndex
Exceptions
PHPExcel_Exception

Definition at line 1039 of file PHPExcel.php.

1040 {
1041 if ($pIndex > count($this->_cellStyleXfCollection) - 1) {
1042 throw new PHPExcel_Exception("CellStyleXf index is out of bounds.");
1043 } else {
1044 array_splice($this->_cellStyleXfCollection, $pIndex, 1);
1045 }
1046 }

◆ removeCellXfByIndex()

PHPExcel::removeCellXfByIndex (   $pIndex = 0)

Remove cellXf by index.

It is ensured that all cells get their xf index updated.

Parameters
int$pIndexIndex to cellXf
Exceptions
PHPExcel_Exception

Definition at line 950 of file PHPExcel.php.

951 {
952 if ($pIndex > count($this->_cellXfCollection) - 1) {
953 throw new PHPExcel_Exception("CellXf index is out of bounds.");
954 } else {
955 // first remove the cellXf
956 array_splice($this->_cellXfCollection, $pIndex, 1);
957
958 // then update cellXf indexes for cells
959 foreach ($this->_workSheetCollection as $worksheet) {
960 foreach ($worksheet->getCellCollection(false) as $cellID) {
961 $cell = $worksheet->getCell($cellID);
962 $xfIndex = $cell->getXfIndex();
963 if ($xfIndex > $pIndex ) {
964 // decrease xf index by 1
965 $cell->setXfIndex($xfIndex - 1);
966 } else if ($xfIndex == $pIndex) {
967 // set to default xf index 0
968 $cell->setXfIndex(0);
969 }
970 }
971 }
972 }
973 }

References $worksheet.

◆ removeNamedRange()

PHPExcel::removeNamedRange (   $namedRange,
PHPExcel_Worksheet  $pSheet = null 
)

Remove named range.

Parameters
string$namedRange
PHPExcel_Worksheet | null$pSheetScope: use null for global scope.
Returns
PHPExcel

Definition at line 821 of file PHPExcel.php.

821 {
822 if ($pSheet === NULL) {
823 if (isset($this->_namedRanges[$namedRange])) {
824 unset($this->_namedRanges[$namedRange]);
825 }
826 } else {
827 if (isset($this->_namedRanges[$pSheet->getTitle() . '!' . $namedRange])) {
828 unset($this->_namedRanges[$pSheet->getTitle() . '!' . $namedRange]);
829 }
830 }
831 return $this;
832 }

◆ removeSheetByIndex()

PHPExcel::removeSheetByIndex (   $pIndex = 0)

Remove sheet by index.

Parameters
int$pIndexActive sheet index
Exceptions
PHPExcel_Exception

Definition at line 546 of file PHPExcel.php.

547 {
548
549 $numSheets = count($this->_workSheetCollection);
550
551 if ($pIndex > $numSheets - 1) {
552 throw new PHPExcel_Exception(
553 "You tried to remove a sheet by the out of bounds index: {$pIndex}. The actual number of sheets is {$numSheets}."
554 );
555 } else {
556 array_splice($this->_workSheetCollection, $pIndex, 1);
557 }
558 // Adjust active sheet index if necessary
559 if (($this->_activeSheetIndex >= $pIndex) &&
560 ($pIndex > count($this->_workSheetCollection) - 1)) {
562 }
563
564 }

References $_activeSheetIndex.

◆ setActiveSheetIndex()

PHPExcel::setActiveSheetIndex (   $pIndex = 0)

Set active sheet index.

Parameters
int$pIndexActive sheet index
Exceptions
PHPExcel_Exception
Returns
PHPExcel_Worksheet

Definition at line 683 of file PHPExcel.php.

684 {
685 $numSheets = count($this->_workSheetCollection);
686
687 if ($pIndex > $numSheets - 1) {
688 throw new PHPExcel_Exception(
689 "You tried to set a sheet active by the out of bounds index: {$pIndex}. The actual number of sheets is {$numSheets}."
690 );
691 } else {
692 $this->_activeSheetIndex = $pIndex;
693 }
694 return $this->getActiveSheet();
695 }
getActiveSheet()
Get active sheet.
Definition: PHPExcel.php:467

References getActiveSheet().

Referenced by setActiveSheetIndexByName().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setActiveSheetIndexByName()

PHPExcel::setActiveSheetIndexByName (   $pValue = '')

Set active sheet index by name.

Parameters
string$pValueSheet title
Returns
PHPExcel_Worksheet
Exceptions
PHPExcel_Exception

Definition at line 704 of file PHPExcel.php.

705 {
706 if (($worksheet = $this->getSheetByName($pValue)) instanceof PHPExcel_Worksheet) {
708 return $worksheet;
709 }
710
711 throw new PHPExcel_Exception('Workbook does not contain sheet:' . $pValue);
712 }
setActiveSheetIndex($pIndex=0)
Set active sheet index.
Definition: PHPExcel.php:683
getSheetByName($pName='')
Get sheet by name.
Definition: PHPExcel.php:601
getIndex(PHPExcel_Worksheet $pSheet)
Get index for sheet.
Definition: PHPExcel.php:620

References $worksheet, getIndex(), getSheetByName(), and setActiveSheetIndex().

+ Here is the call graph for this function:

◆ setHasMacros()

PHPExcel::setHasMacros (   $hasMacros = false)

Define if a workbook has macros.

Parameters
true|false

Definition at line 164 of file PHPExcel.php.

164 {
165 $this->_hasMacros=(bool)$hasMacros;
166 }

Referenced by setMacrosCode().

+ Here is the caller graph for this function:

◆ setIndexByName()

PHPExcel::setIndexByName (   $sheetName,
  $newIndex 
)

Set index for sheet by sheet name.

Parameters
string$sheetNameSheet name to modify index for
int$newIndexNew index for the sheet
Returns
New sheet index
Exceptions
PHPExcel_Exception

Definition at line 639 of file PHPExcel.php.

640 {
641 $oldIndex = $this->getIndex($this->getSheetByName($sheetName));
642 $pSheet = array_splice(
643 $this->_workSheetCollection,
644 $oldIndex,
645 1
646 );
647 array_splice(
648 $this->_workSheetCollection,
649 $newIndex,
650 0,
651 $pSheet
652 );
653 return $newIndex;
654 }

References getIndex(), and getSheetByName().

+ Here is the call graph for this function:

◆ setMacrosCertificate()

PHPExcel::setMacrosCertificate (   $Certificate = NULL)

Set the macros certificate.

Parameters
binary|null

Definition at line 192 of file PHPExcel.php.

192 {
193 $this->_macrosCertificate=$Certificate;
194 }

◆ setMacrosCode()

PHPExcel::setMacrosCode (   $MacrosCode)

Set the macros code.

Parameters
binarystring|null

Definition at line 173 of file PHPExcel.php.

173 {
174 $this->_macrosCode=$MacrosCode;
175 $this->setHasMacros(!is_null($MacrosCode));
176 }
setHasMacros($hasMacros=false)
Define if a workbook has macros.
Definition: PHPExcel.php:164

References setHasMacros().

+ Here is the call graph for this function:

◆ setProperties()

PHPExcel::setProperties ( PHPExcel_DocumentProperties  $pValue)

Set properties.

Parameters
PHPExcel_DocumentProperties$pValue

Definition at line 435 of file PHPExcel.php.

436 {
437 $this->_properties = $pValue;
438 }

◆ setRibbonBinObjects()

PHPExcel::setRibbonBinObjects (   $BinObjectsNames = NULL,
  $BinObjectsData = NULL 
)

store binaries ribbon objects (pictures)

Definition at line 264 of file PHPExcel.php.

264 {
265 if(!is_null($BinObjectsNames) && !is_null($BinObjectsData)){
266 $this->_ribbonBinObjects=array('names'=>$BinObjectsNames, 'data'=>$BinObjectsData);
267 }else{
268 $this->_ribbonBinObjects=NULL;
269 }
270 }

◆ setRibbonXMLData()

PHPExcel::setRibbonXMLData (   $Target = NULL,
  $XMLData = NULL 
)

set ribbon XML data

Definition at line 230 of file PHPExcel.php.

230 {
231 if(!is_null($Target) && !is_null($XMLData)){
232 $this->_ribbonXMLData=array('target'=>$Target, 'data'=>$XMLData);
233 }else{
234 $this->_ribbonXMLData=NULL;
235 }
236 }

◆ setSecurity()

PHPExcel::setSecurity ( PHPExcel_DocumentSecurity  $pValue)

Set security.

Parameters
PHPExcel_DocumentSecurity$pValue

Definition at line 455 of file PHPExcel.php.

456 {
457 $this->_security = $pValue;
458 }

◆ sheetCodeNameExists()

PHPExcel::sheetCodeNameExists (   $pSheetCodeName)

Check if a sheet with a specified code name already exists.

Parameters
string$pSheetCodeNameName of the worksheet to check
Returns
boolean

Definition at line 331 of file PHPExcel.php.

332 {
333 return ($this->getSheetByCodeName($pSheetCodeName) !== NULL);
334 }
getSheetByCodeName($pName='')
Get sheet by code name.
Definition: PHPExcel.php:342

References getSheetByCodeName().

+ Here is the call graph for this function:

◆ sheetNameExists()

PHPExcel::sheetNameExists (   $pSheetName)

Check if a sheet with a specified name already exists.

Parameters
string$pSheetNameName of the worksheet to check
Returns
boolean

Definition at line 492 of file PHPExcel.php.

493 {
494 return ($this->getSheetByName($pSheetName) !== NULL);
495 }

References getSheetByName().

Referenced by addExternalSheet(), and addSheet().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Field Documentation

◆ $_activeSheetIndex

PHPExcel::$_activeSheetIndex = 0
private

Definition at line 85 of file PHPExcel.php.

Referenced by addSheet(), getActiveSheetIndex(), and removeSheetByIndex().

◆ $_calculationEngine

PHPExcel::$_calculationEngine = NULL
private

Definition at line 78 of file PHPExcel.php.

Referenced by getCalculationEngine().

◆ $_cellStyleXfCollection

PHPExcel::$_cellStyleXfCollection = array()
private

Definition at line 113 of file PHPExcel.php.

Referenced by getCellStyleXfCollection().

◆ $_cellXfCollection

PHPExcel::$_cellXfCollection = array()
private

Definition at line 106 of file PHPExcel.php.

Referenced by getCellXfCollection().

◆ $_cellXfSupervisor

PHPExcel::$_cellXfSupervisor
private

Definition at line 99 of file PHPExcel.php.

Referenced by getCellXfSupervisor().

◆ $_hasMacros

PHPExcel::$_hasMacros = FALSE
private

Definition at line 120 of file PHPExcel.php.

Referenced by hasMacros().

◆ $_macrosCertificate

PHPExcel::$_macrosCertificate =NULL
private

Definition at line 133 of file PHPExcel.php.

Referenced by getMacrosCertificate().

◆ $_macrosCode

PHPExcel::$_macrosCode =NULL
private

Definition at line 127 of file PHPExcel.php.

Referenced by getMacrosCode().

◆ $_namedRanges

PHPExcel::$_namedRanges = array()
private

Definition at line 92 of file PHPExcel.php.

Referenced by getNamedRanges().

◆ $_properties

PHPExcel::$_properties
private

Definition at line 57 of file PHPExcel.php.

Referenced by getProperties().

◆ $_ribbonBinObjects

PHPExcel::$_ribbonBinObjects =NULL
private

Definition at line 148 of file PHPExcel.php.

Referenced by getRibbonBinObjects().

◆ $_ribbonXMLData

PHPExcel::$_ribbonXMLData =NULL
private

Definition at line 140 of file PHPExcel.php.

Referenced by getRibbonXMLData().

◆ $_security

PHPExcel::$_security
private

Definition at line 64 of file PHPExcel.php.

Referenced by getSecurity().

◆ $_uniqueID

PHPExcel::$_uniqueID
private

Definition at line 50 of file PHPExcel.php.

Referenced by getID().

◆ $_workSheetCollection

PHPExcel::$_workSheetCollection = array()
private

Definition at line 71 of file PHPExcel.php.

Referenced by getAllSheets().


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