344 $this->_parent = $pParent;
389 if ( $this->_cellCollection !== NULL){
390 $this->_cellCollection->unsetWorksheetCells();
391 $this->_cellCollection = NULL;
394 $this->_parent = null;
403 ->clearCalculationCacheForWorksheet($this->_title);
425 return self::$_invalidCharacters;
438 if ($CharCount == 0) {
442 if ((str_replace(self::$_invalidCharacters,
'', $pValue) !== $pValue) ||
449 if ($CharCount > 31) {
466 if (str_replace(self::$_invalidCharacters,
'', $pValue) !== $pValue) {
490 if ($this->_cellCollection !== NULL) {
491 return $this->_cellCollection->getCellList();
503 if ($this->_cellCollection !== NULL) {
504 return $this->_cellCollection->getSortedCellList();
578 $pChart->setWorksheet($this);
579 if (is_null($iChartIndex)) {
580 $this->_chartCollection[] = $pChart;
583 array_splice($this->_chartCollection, $iChartIndex, 0,
array($pChart));
596 return count($this->_chartCollection);
608 $chartCount = count($this->_chartCollection);
609 if ($chartCount == 0) {
615 if (!isset($this->_chartCollection[
$index])) {
619 return $this->_chartCollection[
$index];
630 $chartNames =
array();
631 foreach($this->_chartCollection as
$chart) {
632 $chartNames[] = $chart->getName();
646 $chartCount = count($this->_chartCollection);
647 if ($chartCount == 0) {
651 if (
$chart->getName() == $chartName) {
652 return $this->_chartCollection[
$index];
666 $newColumnDimensions =
array();
668 foreach ($currentColumnDimensions as $objColumnDimension) {
669 $newColumnDimensions[$objColumnDimension->getColumnIndex()] = $objColumnDimension;
672 $this->_columnDimensions = $newColumnDimensions;
685 $newRowDimensions =
array();
687 foreach ($currentRowDimensions as $objRowDimension) {
688 $newRowDimensions[$objRowDimension->getRowIndex()] = $objRowDimension;
691 $this->_rowDimensions = $newRowDimensions;
727 $autoSizes =
array();
729 if ($colDimension->getAutoSize()) {
730 $autoSizes[$colDimension->getColumnIndex()] = -1;
735 if (!empty($autoSizes)) {
738 $isMergeCell =
array();
741 $isMergeCell[$cellReference] =
true;
747 $cell = $this->
getCell($cellID);
748 if (isset($autoSizes[$this->_cellCollection->getCurrentColumn()])) {
750 if (!isset($isMergeCell[$this->_cellCollection->getCurrentAddress()])) {
754 $cell->getCalculatedValue(),
755 $this->
getParent()->getCellXfByIndex($cell->getXfIndex())->getNumberFormat()->getFormatCode()
758 $autoSizes[$this->_cellCollection->getCurrentColumn()] = max(
759 (
float) $autoSizes[$this->_cellCollection->getCurrentColumn()],
761 $this->
getParent()->getCellXfByIndex($cell->getXfIndex())->getFont(),
763 $this->
getParent()->getCellXfByIndex($cell->getXfIndex())->getAlignment()->getTextRotation(),
772 foreach ($autoSizes as $columnIndex => $width) {
797 if ($this->_parent !== null) {
798 $namedRanges = $this->_parent->getNamedRanges();
799 foreach ($namedRanges as $namedRange) {
803 $this->_parent->removeSheetByIndex(
804 $this->_parent->getIndex($this)
807 $this->_parent = $parent;
833 public function setTitle($pValue =
'Worksheet', $updateFormulaCellReferences =
true)
841 self::_checkSheetTitle($pValue);
846 if ($this->_parent) {
848 if ($this->_parent->sheetNameExists($pValue)) {
855 while ($this->_parent->sheetNameExists($pValue .
' ' .
$i)) {
861 } elseif (
$i == 100) {
868 $altTitle = $pValue .
' ' .
$i;
869 return $this->
setTitle($altTitle,$updateFormulaCellReferences);
874 $this->_title = $pValue;
875 $this->_dirty =
true;
877 if ($this->_parent) {
881 ->renameCalculationCacheForWorksheet($oldTitle, $newTitle);
882 if ($updateFormulaCellReferences)
905 $this->_sheetState = $value;
927 $this->_pageSetup = $pValue;
949 $this->_pageMargins = $pValue;
971 $this->_headerFooter = $pValue;
993 $this->_sheetView = $pValue;
1015 $this->_protection = $pValue;
1016 $this->_dirty =
true;
1045 return $this->_cellCollection->getHighestColumn(
$row);
1072 return $this->_cellCollection->getHighestRow(
$column);
1082 return $this->_cellCollection->getHighestRowAndColumn();
1093 public function setCellValue($pCoordinate =
'A1', $pValue = null, $returnCell =
false)
1095 $cell = $this->
getCell(strtoupper($pCoordinate))->setValue($pValue);
1096 return ($returnCell) ? $cell : $this;
1111 return ($returnCell) ? $cell : $this;
1126 $cell = $this->
getCell(strtoupper($pCoordinate))->setValueExplicit($pValue, $pDataType);
1127 return ($returnCell) ? $cell : $this;
1143 return ($returnCell) ? $cell : $this;
1155 $pCoordinate = strtoupper($pCoordinate);
1157 if ($this->_cellCollection->isDataSet($pCoordinate)) {
1158 return $this->_cellCollection->getCacheData($pCoordinate);
1162 if (strpos($pCoordinate,
'!') !==
false) {
1164 return $this->_parent->getSheetByName($worksheetReference[0])->getCell($worksheetReference[1]);
1171 if ($namedRange !== NULL) {
1172 $pCoordinate = $namedRange->getRange();
1173 return $namedRange->getWorksheet()->getCell($pCoordinate);
1178 $pCoordinate = strtoupper($pCoordinate);
1180 if (strpos($pCoordinate,
':') !==
false || strpos($pCoordinate,
',') !==
false) {
1182 } elseif (strpos($pCoordinate,
'$') !==
false) {
1200 $coordinate = $columnLetter . $pRow;
1202 if ($this->_cellCollection->isDataSet($coordinate)) {
1203 return $this->_cellCollection->getCacheData($coordinate);
1217 $cell = $this->_cellCollection->addCacheData(
1225 $this->_cellCollectionIsSorted =
false;
1230 $this->_cachedHighestColumn = $aCoordinates[0];
1231 $this->_cachedHighestRow = max($this->_cachedHighestRow, $aCoordinates[1]);
1238 if ($rowDimension !== NULL && $rowDimension->getXfIndex() > 0) {
1240 $cell->setXfIndex($rowDimension->getXfIndex());
1241 } elseif ($columnDimension !== NULL && $columnDimension->getXfIndex() > 0) {
1243 $cell->setXfIndex($columnDimension->getXfIndex());
1259 if (strpos($pCoordinate,
'!') !==
false) {
1261 return $this->_parent->getSheetByName($worksheetReference[0])->cellExists(strtoupper($worksheetReference[1]));
1268 if ($namedRange !== NULL) {
1269 $pCoordinate = $namedRange->getRange();
1270 if ($this->
getHashCode() != $namedRange->getWorksheet()->getHashCode()) {
1271 if (!$namedRange->getLocalOnly()) {
1272 return $namedRange->getWorksheet()->cellExists($pCoordinate);
1274 throw new PHPExcel_Exception(
'Named range ' . $namedRange->getName() .
' is not accessible from within sheet ' . $this->
getTitle());
1278 else {
return false; }
1282 $pCoordinate = strtoupper($pCoordinate);
1284 if (strpos($pCoordinate,
':') !==
false || strpos($pCoordinate,
',') !==
false) {
1286 } elseif (strpos($pCoordinate,
'$') !==
false) {
1293 return $this->_cellCollection->isDataSet($pCoordinate);
1321 if (!isset($this->_rowDimensions[$pRow])) {
1326 $this->_cachedHighestRow = max($this->_cachedHighestRow,$pRow);
1328 return $this->_rowDimensions[$pRow];
1340 $pColumn = strtoupper($pColumn);
1343 if (!isset($this->_columnDimensions[$pColumn])) {
1349 $this->_cachedHighestColumn = $pColumn;
1351 return $this->_columnDimensions[$pColumn];
1384 return $this->_parent->getDefaultStyle();
1397 $this->_parent->getDefaultStyle()->applyFromArray(
array(
1399 'name' => $pValue->
getFont()->getName(),
1400 'size' => $pValue->
getFont()->getSize(),
1416 $this->_parent->setActiveSheetIndex($this->_parent->getIndex($this));
1421 return $this->_parent->getCellXfSupervisor();
1432 $pCoordinate = strtoupper($pCoordinate);
1433 if (!isset($this->_conditionalStylesCollection[$pCoordinate])) {
1434 $this->_conditionalStylesCollection[$pCoordinate] =
array();
1436 return $this->_conditionalStylesCollection[$pCoordinate];
1447 if (isset($this->_conditionalStylesCollection[strtoupper($pCoordinate)])) {
1461 unset($this->_conditionalStylesCollection[strtoupper($pCoordinate)]);
1484 $this->_conditionalStylesCollection[strtoupper($pCoordinate)] = $pValue;
1499 if (!is_null($pColumn2) && !is_null($pRow2)) {
1502 return $this->
getStyle($cellRange);
1538 $style = $pCellStyle->getIsSupervisor() ? $pCellStyle->getSharedComponent() : $pCellStyle;
1542 if ($existingStyle = $this->_parent->getCellXfByHashCode($pCellStyle->getHashCode())) {
1544 $xfIndex = $existingStyle->getIndex();
1547 $workbook->addCellXf($pCellStyle);
1548 $xfIndex = $pCellStyle->getIndex();
1555 if ($rangeStart[0] > $rangeEnd[0] && $rangeStart[1] > $rangeEnd[1]) {
1557 $rangeStart = $rangeEnd;
1562 for ($col = $rangeStart[0]; $col <= $rangeEnd[0]; ++$col) {
1563 for (
$row = $rangeStart[1];
$row <= $rangeEnd[1]; ++
$row) {
1583 foreach($pCellStyle as $cellStyle) {
1593 if ($rangeStart[0] > $rangeEnd[0] && $rangeStart[1] > $rangeEnd[1]) {
1595 $rangeStart = $rangeEnd;
1600 for ($col = $rangeStart[0]; $col <= $rangeEnd[0]; ++$col) {
1601 for (
$row = $rangeStart[1];
$row <= $rangeEnd[1]; ++
$row) {
1625 $this->
getStyle($pRange)->applyFromArray($pStyles, $pAdvanced);
1640 $pCell = strtoupper($pCell);
1644 if (isset($this->_breaks[$pCell])) {
1645 unset($this->_breaks[$pCell]);
1648 $this->_breaks[$pCell] = $pBreak;
1690 $pRange = strtoupper($pRange);
1692 if (strpos($pRange,
':') !==
false) {
1693 $this->_mergeCells[$pRange] = $pRange;
1701 $upperLeft = $aReferences[0];
1707 $count = count($aReferences);
1708 for (
$i = 1;
$i < $count;
$i++) {
1745 $pRange = strtoupper($pRange);
1747 if (strpos($pRange,
':') !==
false) {
1748 if (isset($this->_mergeCells[$pRange])) {
1749 unset($this->_mergeCells[$pRange]);
1794 $this->_mergeCells = $pValue;
1808 public function protectCells($pRange =
'A1', $pPassword =
'', $pAlreadyHashed =
false)
1811 $pRange = strtoupper($pRange);
1813 if (!$pAlreadyHashed) {
1816 $this->_protectedCells[$pRange] = $pPassword;
1836 return $this->
protectCells($cellRange, $pPassword, $pAlreadyHashed);
1849 $pRange = strtoupper($pRange);
1851 if (isset($this->_protectedCells[$pRange])) {
1852 unset($this->_protectedCells[$pRange]);
1874 return $this->
unprotectCells($cellRange, $pPassword, $pAlreadyHashed);
1907 $pRange = strtoupper($pValue);
1909 if (is_string($pValue)) {
1910 $this->_autoFilter->setRange($pValue);
1912 $this->_autoFilter = $pValue;
1943 $this->_autoFilter->setRange(NULL);
1972 $pCell = strtoupper($pCell);
1974 if (strpos($pCell,
':') ===
false && strpos($pCell,
',') ===
false) {
1975 $this->_freezePane = $pCell;
2014 if ($pBefore >= 1) {
2016 $objReferenceHelper->insertNewBefore(
'A' . $pBefore, 0, $pNumRows, $this);
2032 if (!is_numeric($pBefore)) {
2034 $objReferenceHelper->insertNewBefore($pBefore .
'1', $pNumCols, 0, $this);
2050 if ($pBefore >= 0) {
2053 throw new PHPExcel_Exception(
"Columns can only be inserted before at least column A (0).");
2069 $objReferenceHelper->insertNewBefore(
'A' . ($pRow + $pNumRows), 0, -$pNumRows, $this);
2070 for(
$r = 0;
$r < $pNumRows; ++
$r) {
2075 throw new PHPExcel_Exception(
"Rows to be deleted should at least start from row 1.");
2089 if (!is_numeric($pColumn)) {
2093 $objReferenceHelper->insertNewBefore($pColumn .
'1', -$pNumCols, 0, $this);
2094 for($c = 0; $c < $pNumCols; ++$c) {
2113 if ($pColumn >= 0) {
2116 throw new PHPExcel_Exception(
"Columns to be deleted should at least start from column 0");
2136 $this->_showGridlines = $pValue;
2156 $this->_printGridlines = $pValue;
2176 $this->_showRowColHeaders = $pValue;
2196 $this->_showSummaryBelow = $pValue;
2216 $this->_showSummaryRight = $pValue;
2238 $this->_comments = $pValue;
2253 $pCellCoordinate = strtoupper($pCellCoordinate);
2255 if (strpos($pCellCoordinate,
':') !==
false || strpos($pCellCoordinate,
',') !==
false) {
2257 }
else if (strpos($pCellCoordinate,
'$') !==
false) {
2259 }
else if ($pCellCoordinate ==
'') {
2264 if (isset($this->_comments[$pCellCoordinate])) {
2265 return $this->_comments[$pCellCoordinate];
2268 $this->_comments[$pCellCoordinate] = $newComment;
2338 $pCoordinate = strtoupper($pCoordinate);
2341 $pCoordinate = preg_replace(
'/^([A-Z]+)$/',
'${1}:${1}', $pCoordinate);
2344 $pCoordinate = preg_replace(
'/^([0-9]+)$/',
'${1}:${1}', $pCoordinate);
2347 $pCoordinate = preg_replace(
'/^([A-Z]+):([A-Z]+)$/',
'${1}1:${2}1048576', $pCoordinate);
2350 $pCoordinate = preg_replace(
'/^([0-9]+):([0-9]+)$/',
'A${1}:XFD${2}', $pCoordinate);
2352 if (strpos($pCoordinate,
':') !==
false || strpos($pCoordinate,
',') !==
false) {
2354 $this->_activeCell = $first[0];
2356 $this->_activeCell = $pCoordinate;
2358 $this->_selectedCells = $pCoordinate;
2391 $this->_rightToLeft = $value;
2405 public function fromArray(
$source = null, $nullValue = null, $startCell =
'A1', $strictNullComparison =
false) {
2408 if (!is_array(end(
$source))) {
2416 foreach (
$source as $rowData) {
2417 $currentColumn = $startColumn;
2418 foreach($rowData as $cellValue) {
2419 if ($strictNullComparison) {
2420 if ($cellValue !== $nullValue) {
2422 $this->
getCell($currentColumn . $startRow)->setValue($cellValue);
2425 if ($cellValue != $nullValue) {
2427 $this->
getCell($currentColumn . $startRow)->setValue($cellValue);
2451 public function rangeToArray($pRange =
'A1', $nullValue = null, $calculateFormulas =
true, $formatData =
true, $returnCellRef =
false) {
2453 $returnValue =
array();
2457 $minRow = $rangeStart[1];
2459 $maxRow = $rangeEnd[1];
2465 $rRef = ($returnCellRef) ?
$row : ++
$r;
2468 for ($col = $minCol; $col != $maxCol; ++$col) {
2469 $cRef = ($returnCellRef) ? $col : ++$c;
2472 if ($this->_cellCollection->isDataSet($col.$row)) {
2474 $cell = $this->_cellCollection->getCacheData($col.$row);
2475 if ($cell->getValue() !== null) {
2477 $returnValue[$rRef][$cRef] = $cell->getValue()->getPlainText();
2479 if ($calculateFormulas) {
2480 $returnValue[$rRef][$cRef] = $cell->getCalculatedValue();
2482 $returnValue[$rRef][$cRef] = $cell->getValue();
2487 $style = $this->_parent->getCellXfByIndex($cell->getXfIndex());
2489 $returnValue[$rRef][$cRef],
2491 $style->getNumberFormat()->getFormatCode() :
2497 $returnValue[$rRef][$cRef] = $nullValue;
2501 $returnValue[$rRef][$cRef] = $nullValue;
2507 return $returnValue;
2523 public function namedRangeToArray($pNamedRange =
'', $nullValue = null, $calculateFormulas =
true, $formatData =
true, $returnCellRef =
false) {
2525 if ($namedRange !== NULL) {
2526 $pWorkSheet = $namedRange->getWorksheet();
2527 $pCellRange = $namedRange->getRange();
2529 return $pWorkSheet->rangeToArray( $pCellRange,
2530 $nullValue, $calculateFormulas, $formatData, $returnCellRef);
2547 public function toArray($nullValue = null, $calculateFormulas =
true, $formatData =
true, $returnCellRef =
false) {
2556 $nullValue, $calculateFormulas, $formatData, $returnCellRef);
2590 $this->_cellCollection->getCacheData(
'A1');
2601 $colRow = $this->_cellCollection->getHighestRowAndColumn();
2602 $highestRow = $colRow[
'row'];
2606 foreach ($this->_columnDimensions as $dimension) {
2611 foreach ($this->_rowDimensions as $dimension) {
2612 $highestRow = max($highestRow,$dimension->getRowIndex());
2616 if ($highestColumn < 0) {
2617 $this->_cachedHighestColumn =
'A';
2621 $this->_cachedHighestRow = $highestRow;
2633 if ($this->_dirty) {
2634 $this->_hash = md5( $this->_title .
2635 $this->_autoFilter .
2636 ($this->_protection->isProtectionEnabled() ?
't' :
'f') .
2639 $this->_dirty =
false;
2656 if (($sep = strpos($pRange,
'!')) ===
false) {
2661 return array( trim(substr($pRange, 0, $sep),
"'"),
2662 substr($pRange, $sep + 1)
2666 return substr($pRange, $sep + 1);
2677 if (isset($this->_hyperlinkCollection[$pCellCoordinate])) {
2678 return $this->_hyperlinkCollection[$pCellCoordinate];
2683 return $this->_hyperlinkCollection[$pCellCoordinate];
2695 if ($pHyperlink === null) {
2696 unset($this->_hyperlinkCollection[$pCellCoordinate]);
2698 $this->_hyperlinkCollection[$pCellCoordinate] = $pHyperlink;
2711 return isset($this->_hyperlinkCollection[$pCoordinate]);
2732 if (isset($this->_dataValidationCollection[$pCellCoordinate])) {
2733 return $this->_dataValidationCollection[$pCellCoordinate];
2738 return $this->_dataValidationCollection[$pCellCoordinate];
2750 if ($pDataValidation === null) {
2751 unset($this->_dataValidationCollection[$pCellCoordinate]);
2753 $this->_dataValidationCollection[$pCellCoordinate] = $pDataValidation;
2766 return isset($this->_dataValidationCollection[$pCoordinate]);
2790 $rangeBlocks = explode(
' ',$range);
2791 foreach ($rangeBlocks as &$rangeSet) {
2795 if ($rangeBoundaries[0][1] > $maxRow) { $rangeBoundaries[0][1] = $maxRow; }
2797 if ($rangeBoundaries[1][1] > $maxRow) { $rangeBoundaries[1][1] = $maxRow; }
2798 $rangeSet = $rangeBoundaries[0][0].$rangeBoundaries[0][1].
':'.$rangeBoundaries[1][0].$rangeBoundaries[1][1];
2801 $stRange = implode(
' ',$rangeBlocks);
2813 if ($this->_tabColor === NULL)
2826 $this->_tabColor = null;
2827 unset($this->_tabColor);
2839 return ($this->_tabColor !== NULL);
2848 $copied = clone $this;
2857 foreach ($this as
$key => $val) {
2858 if (
$key ==
'_parent') {
2862 if (is_object($val) || (is_array($val))) {
2863 if (
$key ==
'_cellCollection') {
2865 $newCollection->copyCellCollection($this);
2866 $this->_cellCollection = $newCollection;
2867 } elseif (
$key ==
'_drawingCollection') {
2869 $this->_drawingCollection = $newCollection;
2872 $this->_autoFilter = $newAutoFilter;
2873 $this->_autoFilter->setParent($this);
2875 $this->{
$key} = unserialize(serialize($val));
2892 $pValue = str_replace(
' ',
'_', $pValue);
2895 self::_checkSheetCodeName($pValue);
2901 if ($this->
getParent()->sheetCodeNameExists($pValue)) {
2908 while ($this->
getParent()->sheetCodeNameExists($pValue .
'_' .
$i)) {
2914 } elseif ($i == 100) {
2921 $pValue = $pValue .
'_' .
$i;
2927 $this->_codeName=$pValue;
2943 return !(is_null($this->_codeName));
getConditionalStylesCollection()
Get collection of conditional styles.
setHyperlink($pCellCoordinate='A1', PHPExcel_Cell_Hyperlink $pHyperlink=null)
Set hyperlnk.
static splitRange($pRange='A1:A1')
Split range into coordinate strings.
__construct(PHPExcel $pParent=null, $pTitle='Worksheet')
Create a new worksheet.
unprotectCells($pRange='A1')
Remove protection on a cell range.
static calculateColumnWidth(PHPExcel_Style_Font $font, $cellText='', $rotation=0, PHPExcel_Style_Font $defaultFont=null)
Calculate an (approximate) OpenXML column width, based on font size and text contained.
protectCellsByColumnAndRow($pColumn1=0, $pRow1=1, $pColumn2=0, $pRow2=1, $pPassword='', $pAlreadyHashed=false)
Set protection on a cell range by using numeric cell coordinates.
getDrawingCollection()
Get collection of drawings.
getDefaultColumnDimension()
Get default column dimension.
static coordinateFromString($pCoordinateString='A1')
Coordinate from string.
getMergeCells()
Get merge cells array.
getDataValidation($pCellCoordinate='A1')
Get data validation.
getHashCode()
Get hash code.
getDefaultRowDimension()
Get default row dimension.
setSharedStyle(PHPExcel_Style $pSharedCellStyle=null, $pRange='')
Set shared cell style to a range of cells.
refreshColumnDimensions()
Refresh column dimensions.
mergeCells($pRange='A1:A1')
Set merge on a cell range.
setRightToLeft($value=false)
Set right-to-left.
getHeaderFooter()
Get page header/footer.
fromArray($source=null, $nullValue=null, $startCell='A1', $strictNullComparison=false)
Fill worksheet from values in array.
setShowSummaryBelow($pValue=true)
Set show summary below.
calculateWorksheetDataDimension()
Calculate worksheet data dimension.
dataValidationExists($pCoordinate='A1')
Data validation at a specific coordinate exists?
setCellValueExplicit($pCoordinate='A1', $pValue=null, $pDataType=PHPExcel_Cell_DataType::TYPE_STRING, $returnCell=false)
Set a cell value.
unfreezePane()
Unfreeze Pane.
rangeToArray($pRange='A1', $nullValue=null, $calculateFormulas=true, $formatData=true, $returnCellRef=false)
Create array from a range of cells.
getColumnDimensions()
Get collection of column dimensions.
getStyle($pCellCoordinate='A1')
Get style for cell.
static getInstance()
Get an instance of this class.
setAutoFilterByColumnAndRow($pColumn1=0, $pRow1=1, $pColumn2=0, $pRow2=1)
Set Autofilter Range by using numeric cell coordinates.
hyperlinkExists($pCoordinate='A1')
Hyperlink at a specific coordinate exists?
calculateWorksheetDimension()
Calculate worksheet dimension.
setShowSummaryRight($pValue=true)
Set show summary right.
setCellValueExplicitByColumnAndRow($pColumn=0, $pRow=1, $pValue=null, $pDataType=PHPExcel_Cell_DataType::TYPE_STRING, $returnCell=false)
Set a cell value by using numeric cell coordinates.
namedRangeToArray($pNamedRange='', $nullValue=null, $calculateFormulas=true, $formatData=true, $returnCellRef=false)
Create array from a range of cells.
static rangeBoundaries($pRange='A1:A1')
Calculate range boundaries.
static getInstance(PHPExcel_Worksheet $parent)
Initialise the cache storage.
setShowRowColHeaders($pValue=false)
Set show row and column headers.
const SHEETSTATE_VERYHIDDEN
cellExistsByColumnAndRow($pColumn=0, $pRow=1)
Cell at a specific coordinate by using numeric cell coordinates exists?
setCodeName($pValue=null)
Define the code name of the sheet.
getCellByColumnAndRow($pColumn=0, $pRow=1)
Get cell at a specific coordinate by using numeric cell coordinates.
setDefaultStyle(PHPExcel_Style $pValue)
Set default style - should only be used by PHPExcel_IReader implementations!
__destruct()
Code to execute when this worksheet is unset()
getChartCount()
Return the count of charts on this worksheet.
getSheetState()
Get sheet state.
setSelectedCell($pCoordinate='A1')
Selected cell.
setCellValueByColumnAndRow($pColumn=0, $pRow=1, $pValue=null, $returnCell=false)
Set a cell value by using numeric cell coordinates.
unmergeCells($pRange='A1:A1')
Remove merge on a cell range.
hasCodeName()
Sheet has a code name ?
setShowGridlines($pValue=false)
Set show gridlines.
getFreezePane()
Get Freeze Pane.
refreshRowDimensions()
Refresh row dimensions.
getColumnDimension($pColumn='A', $create=TRUE)
Get column dimension at a specific column.
getSheetView()
Get sheet view.
removeRow($pRow=1, $pNumRows=1)
Delete a row, updating all possible related data.
getHighestRow($column=null)
Get highest worksheet row.
copy()
Copy worksheet (!= clone!)
getRowDimensions()
Get collection of row dimensions.
setProtection(PHPExcel_Worksheet_Protection $pValue)
Set Protection.
calculateColumnWidths($calculateMergeCells=false)
Calculate widths for auto-size columns.
getCell($pCoordinate='A1')
Get cell at a specific coordinate.
getShowSummaryBelow()
Show summary below? (Row/Column outlining)
static resolveRange($pNamedRange='', PHPExcel_Worksheet $pSheet)
Resolve a named range to a regular cell range.
static $_invalidCharacters
static _checkSheetCodeName($pValue)
Check sheet code name for valid Excel syntax.
getHyperlinkCollection()
Get collection of hyperlinks.
setSheetState($value=PHPExcel_Worksheet::SHEETSTATE_VISIBLE)
Set sheet state.
getPrintGridlines()
Print gridlines?
toArray($nullValue=null, $calculateFormulas=true, $formatData=true, $returnCellRef=false)
Create array from worksheet.
getSelectedCell()
Get selected cell.
getDataValidationCollection()
Get collection of data validations.
getCodeName()
Return the code name of the sheet.
duplicateStyle(PHPExcel_Style $pCellStyle=null, $pRange='')
Duplicate cell style to a range of cells.
getRowIterator($startRow=1, $endRow=null)
Get row iterator.
__clone()
Implement PHP __clone to create a deep clone, not just a shallow copy.
getProtectedCells()
Get protected cells.
getComments()
Get comments.
setMergeCells($pValue=array())
Set merge cells array for the entire sheet.
getDefaultStyle()
Get default style of workbook.
getHyperlink($pCellCoordinate='A1')
Get hyperlink.
getHighestDataColumn($row=null)
Get highest worksheet column that contains data.
protectCells($pRange='A1', $pPassword='', $pAlreadyHashed=false)
Set protection on a cell range.
getActiveCell()
Get active cell.
shrinkRangeToFit($range)
Accepts a range, returning it as a range that falls within the current highest row and column of the ...
getSelectedCells()
Get selected cells.
setPageMargins(PHPExcel_Worksheet_PageMargins $pValue)
Set page margins.
getHighestDataRow($column=null)
Get highest worksheet row that contains data.
insertNewColumnBeforeByIndex($pBefore=0, $pNumCols=1)
Insert a new column, updating all possible related data.
getStyleByColumnAndRow($pColumn=0, $pRow=1, $pColumn2=null, $pRow2=null)
Get style for cell by using numeric cell coordinates.
mergeCellsByColumnAndRow($pColumn1=0, $pRow1=1, $pColumn2=0, $pRow2=1)
Set merge on a cell range by using numeric cell coordinates.
setBreakByColumnAndRow($pColumn=0, $pRow=1, $pBreak=PHPExcel_Worksheet::BREAK_NONE)
Set break on a cell by using numeric cell coordinates.
getChartNames()
Return an array of the names of charts on this worksheet.
resetTabColor()
Reset tab color.
setHeaderFooter(PHPExcel_Worksheet_HeaderFooter $pValue)
Set page header/footer.
getShowSummaryRight()
Show summary right? (Row/Column outlining)
getShowRowColHeaders()
Show row and column headers?
static _checkSheetTitle($pValue)
Check sheet title for valid Excel syntax.
getCellCollection($pSorted=true)
Get collection of cells.
addChart(PHPExcel_Chart $pChart=null, $iChartIndex=null)
Add chart.
getTabColor()
Get tab color.
unmergeCellsByColumnAndRow($pColumn1=0, $pRow1=1, $pColumn2=0, $pRow2=1)
Remove merge on a cell range by using numeric cell coordinates.
setCellValue($pCoordinate='A1', $pValue=null, $returnCell=false)
Set a cell value.
sortCellCollection()
Sort collection of cells.
freezePaneByColumnAndRow($pColumn=0, $pRow=1)
Freeze Pane by using numeric cell coordinates.
static hashPassword($pPassword='')
Create a password hash from a given string.
Create styles array
The data for the language used.
getHighestColumn($row=null)
Get highest worksheet column.
setConditionalStyles($pCoordinate='A1', $pValue)
Set conditional styles.
freezePane($pCell='')
Freeze Pane.
getColumnIterator($startColumn='A', $endColumn=null)
Get column iterator.
static getInvalidCharacters()
Get array of invalid characters for sheet title.
duplicateStyleArray($pStyles=null, $pRange='', $pAdvanced=true)
Duplicate cell style array to a range of cells.
getColumnDimensionByColumn($pColumn=0)
Get column dimension at a specific column by using numeric cell coordinates.
_createNewCell($pCoordinate)
Create a new cell at the specified coordinate.
getPageSetup()
Get page setup.
static Substring($pValue='', $pStart=0, $pLength=0)
Get a substring of a UTF-8 encoded string.
removeConditionalStyles($pCoordinate='A1')
Removes conditional styles for a cell.
disconnectCells()
Disconnect all cells from this PHPExcel_Worksheet object, typically so that the worksheet object can ...
$_conditionalStylesCollection
static extractAllCellReferencesInRange($pRange='A1')
Extract all cell references in range.
static columnIndexFromString($pString='A')
Column index from string.
static getRangeBoundaries($pRange='A1:A1')
Calculate range boundaries.
static getInstance(PHPExcel $workbook=NULL)
Get an instance of this class.
getChartByIndex($index=null)
Get a chart by its index position.
conditionalStylesExists($pCoordinate='A1')
Do conditional styles exist for this cell?
const CALCULATION_REGEXP_CELLREF
static stringFromColumnIndex($pColumnIndex=0)
String from columnindex.
garbageCollect()
Run PHPExcel garabage collector.
getComment($pCellCoordinate='A1')
Get comment for cell.
getChartByName($chartName='')
Get a chart by name.
getCellCacheController()
Return the cache controller for the cell collection.
setAutoFilter($pValue)
Set AutoFilter.
setTitle($pValue='Worksheet', $updateFormulaCellReferences=true)
Set title.
setSelectedCells($pCoordinate='A1')
Select a range of cells.
$_dataValidationCollection
rebindParent(PHPExcel $parent)
Re-bind parent.
setPrintGridlines($pValue=false)
Set print gridlines.
isTabColorSet()
Tab color set?
removeAutoFilter()
Remove autofilter.
static extractSheetTitle($pRange, $returnRange=false)
Extract worksheet title from range.
removeColumnByIndex($pColumn=0, $pNumCols=1)
Remove a column, updating all possible related data.
getChartCollection()
Get collection of charts.
getRowDimension($pRow=1, $create=TRUE)
Get row dimension at a specific row.
addNamedRange(PHPExcel_NamedRange $namedRange)
Add named range.
getCommentByColumnAndRow($pColumn=0, $pRow=1)
Get comment for cell by using numeric cell coordinates.
unprotectCellsByColumnAndRow($pColumn1=0, $pRow1=1, $pColumn2=0, $pRow2=1, $pPassword='', $pAlreadyHashed=false)
Remove protection on a cell range by using numeric cell coordinates.
getAutoFilter()
Get Autofilter.
getShowGridlines()
Show gridlines?
setDataValidation($pCellCoordinate='A1', PHPExcel_Cell_DataValidation $pDataValidation=null)
Set data validation.
setSheetView(PHPExcel_Worksheet_SheetView $pValue)
Set sheet view.
insertNewColumnBefore($pBefore='A', $pNumCols=1)
Insert a new column, updating all possible related data.
setPageSetup(PHPExcel_Worksheet_PageSetup $pValue)
Set page setup.
getConditionalStyles($pCoordinate='A1')
Get conditional styles for a cell.
duplicateConditionalStyle(array $pCellStyle=null, $pRange='')
Duplicate conditional style to a range of cells.
cellExists($pCoordinate='A1')
Does the cell at a specific coordinate exist?
getRightToLeft()
Get right-to-left.
static CountCharacters($value, $enc='UTF-8')
Get character count.
const CALCULATION_REGEXP_NAMEDRANGE
getHighestRowAndColumn()
Get highest worksheet column and highest row that have cell records.
removeColumn($pColumn='A', $pNumCols=1)
Remove a column, updating all possible related data.
insertNewRowBefore($pBefore=1, $pNumRows=1)
Insert a new row, updating all possible related data.
setSelectedCellByColumnAndRow($pColumn=0, $pRow=1)
Selected cell by using numeric cell coordinates.
getPageMargins()
Get page margins.
getProtection()
Get Protection.
setComments($pValue=array())
Set comments array for the entire sheet.
setBreak($pCell='A1', $pBreak=PHPExcel_Worksheet::BREAK_NONE)
Set break on a cell.