Bugfix: The freezePaneByColumnAndRow() method row argument should default to 1 rather than 0. Default row argument for all __ByColumnAndRow() methods should be 1

General: Enhanced SheetViews element structures in the Excel2007 Writer for frozen panes.

git-svn-id: https://phpexcel.svn.codeplex.com/svn/trunk@68124 2327b42d-5241-43d6-9e2a-de5ac946f064
This commit is contained in:
Mark Baker 2011-02-07 11:19:07 +00:00
parent 3757a0e6ff
commit 919df79991
3 changed files with 96 additions and 74 deletions

View File

@ -871,11 +871,11 @@ class PHPExcel_Worksheet implements PHPExcel_IComparable
* *
* @param string $pColumn Numeric column coordinate of the cell * @param string $pColumn Numeric column coordinate of the cell
* @param string $pRow Numeric row coordinate of the cell * @param string $pRow Numeric row coordinate of the cell
* @param mixed $pValue Value of the cell * @param mixed $pValue Value of the cell
* @param bool $returnCell Return the worksheet (false, default) or the cell (true) * @param bool $returnCell Return the worksheet (false, default) or the cell (true)
* @return PHPExcel_Worksheet|PHPExcel_Cell Depending on the last parameter being specified * @return PHPExcel_Worksheet|PHPExcel_Cell Depending on the last parameter being specified
*/ */
public function setCellValueByColumnAndRow($pColumn = 0, $pRow = 0, $pValue = null, $returnCell = false) public function setCellValueByColumnAndRow($pColumn = 0, $pRow = 1, $pValue = null, $returnCell = false)
{ {
$cell = $this->getCell(PHPExcel_Cell::stringFromColumnIndex($pColumn) . $pRow); $cell = $this->getCell(PHPExcel_Cell::stringFromColumnIndex($pColumn) . $pRow);
$cell->setValue($pValue); $cell->setValue($pValue);
@ -906,11 +906,11 @@ class PHPExcel_Worksheet implements PHPExcel_IComparable
* *
* @param string $pColumn Numeric column coordinate of the cell * @param string $pColumn Numeric column coordinate of the cell
* @param string $pRow Numeric row coordinate of the cell * @param string $pRow Numeric row coordinate of the cell
* @param mixed $pValue Value of the cell * @param mixed $pValue Value of the cell
* @param string $pDataType Explicit data type * @param string $pDataType Explicit data type
* @return PHPExcel_Worksheet * @return PHPExcel_Worksheet
*/ */
public function setCellValueExplicitByColumnAndRow($pColumn = 0, $pRow = 0, $pValue = null, $pDataType = PHPExcel_Cell_DataType::TYPE_STRING) public function setCellValueExplicitByColumnAndRow($pColumn = 0, $pRow = 1, $pValue = null, $pDataType = PHPExcel_Cell_DataType::TYPE_STRING)
{ {
return $this->getCell(PHPExcel_Cell::stringFromColumnIndex($pColumn) . $pRow)->setValueExplicit($pValue, $pDataType); return $this->getCell(PHPExcel_Cell::stringFromColumnIndex($pColumn) . $pRow)->setValueExplicit($pValue, $pDataType);
} }
@ -992,7 +992,7 @@ class PHPExcel_Worksheet implements PHPExcel_IComparable
* @param string $pRow Numeric row coordinate of the cell * @param string $pRow Numeric row coordinate of the cell
* @return PHPExcel_Cell Cell that was found * @return PHPExcel_Cell Cell that was found
*/ */
public function getCellByColumnAndRow($pColumn = 0, $pRow = 0) public function getCellByColumnAndRow($pColumn = 0, $pRow = 1)
{ {
$columnLetter = PHPExcel_Cell::stringFromColumnIndex($pColumn); $columnLetter = PHPExcel_Cell::stringFromColumnIndex($pColumn);
$coordinate = $columnLetter . $pRow; $coordinate = $columnLetter . $pRow;
@ -1066,7 +1066,7 @@ class PHPExcel_Worksheet implements PHPExcel_IComparable
* @param string $pRow Numeric row coordinate of the cell * @param string $pRow Numeric row coordinate of the cell
* @return boolean * @return boolean
*/ */
public function cellExistsByColumnAndRow($pColumn = 0, $pRow = 0) public function cellExistsByColumnAndRow($pColumn = 0, $pRow = 1)
{ {
return $this->cellExists(PHPExcel_Cell::stringFromColumnIndex($pColumn) . $pRow); return $this->cellExists(PHPExcel_Cell::stringFromColumnIndex($pColumn) . $pRow);
} }
@ -1077,7 +1077,7 @@ class PHPExcel_Worksheet implements PHPExcel_IComparable
* @param int $pRow Numeric index of the row * @param int $pRow Numeric index of the row
* @return PHPExcel_Worksheet_RowDimension * @return PHPExcel_Worksheet_RowDimension
*/ */
public function getRowDimension($pRow = 0) public function getRowDimension($pRow = 1)
{ {
// Found // Found
$found = null; $found = null;
@ -1253,7 +1253,7 @@ class PHPExcel_Worksheet implements PHPExcel_IComparable
* @param int $pRow Numeric row coordinate of the cell * @param int $pRow Numeric row coordinate of the cell
* @return PHPExcel_Style * @return PHPExcel_Style
*/ */
public function getStyleByColumnAndRow($pColumn = 0, $pRow = 0) public function getStyleByColumnAndRow($pColumn = 0, $pRow = 1)
{ {
return $this->getStyle(PHPExcel_Cell::stringFromColumnIndex($pColumn) . $pRow); return $this->getStyle(PHPExcel_Cell::stringFromColumnIndex($pColumn) . $pRow);
} }
@ -1384,13 +1384,13 @@ class PHPExcel_Worksheet implements PHPExcel_IComparable
/** /**
* Set break on a cell by using numeric cell coordinates * Set break on a cell by using numeric cell coordinates
* *
* @param int $pColumn Numeric column coordinate of the cell * @param integer $pColumn Numeric column coordinate of the cell
* @param int $pRow Numeric row coordinate of the cell * @param integer $pRow Numeric row coordinate of the cell
* @param int $pBreak Break type (type of PHPExcel_Worksheet::BREAK_*) * @param integer $pBreak Break type (type of PHPExcel_Worksheet::BREAK_*)
* @throws Exception * @throws Exception
* @return PHPExcel_Worksheet * @return PHPExcel_Worksheet
*/ */
public function setBreakByColumnAndRow($pColumn = 0, $pRow = 0, $pBreak = PHPExcel_Worksheet::BREAK_NONE) public function setBreakByColumnAndRow($pColumn = 0, $pRow = 1, $pBreak = PHPExcel_Worksheet::BREAK_NONE)
{ {
return $this->setBreak(PHPExcel_Cell::stringFromColumnIndex($pColumn) . $pRow, $pBreak); return $this->setBreak(PHPExcel_Cell::stringFromColumnIndex($pColumn) . $pRow, $pBreak);
} }
@ -1454,7 +1454,7 @@ class PHPExcel_Worksheet implements PHPExcel_IComparable
* @throws Exception * @throws Exception
* @return PHPExcel_Worksheet * @return PHPExcel_Worksheet
*/ */
public function mergeCellsByColumnAndRow($pColumn1 = 0, $pRow1 = 0, $pColumn2 = 0, $pRow2 = 0) public function mergeCellsByColumnAndRow($pColumn1 = 0, $pRow1 = 1, $pColumn2 = 0, $pRow2 = 1)
{ {
$cellRange = PHPExcel_Cell::stringFromColumnIndex($pColumn1) . $pRow1 . ':' . PHPExcel_Cell::stringFromColumnIndex($pColumn2) . $pRow2; $cellRange = PHPExcel_Cell::stringFromColumnIndex($pColumn1) . $pRow1 . ':' . PHPExcel_Cell::stringFromColumnIndex($pColumn2) . $pRow2;
return $this->mergeCells($cellRange); return $this->mergeCells($cellRange);
@ -1495,7 +1495,7 @@ class PHPExcel_Worksheet implements PHPExcel_IComparable
* @throws Exception * @throws Exception
* @return PHPExcel_Worksheet * @return PHPExcel_Worksheet
*/ */
public function unmergeCellsByColumnAndRow($pColumn1 = 0, $pRow1 = 0, $pColumn2 = 0, $pRow2 = 0) public function unmergeCellsByColumnAndRow($pColumn1 = 0, $pRow1 = 1, $pColumn2 = 0, $pRow2 = 1)
{ {
$cellRange = PHPExcel_Cell::stringFromColumnIndex($pColumn1) . $pRow1 . ':' . PHPExcel_Cell::stringFromColumnIndex($pColumn2) . $pRow2; $cellRange = PHPExcel_Cell::stringFromColumnIndex($pColumn1) . $pRow1 . ':' . PHPExcel_Cell::stringFromColumnIndex($pColumn2) . $pRow2;
return $this->unmergeCells($cellRange); return $this->unmergeCells($cellRange);
@ -1558,7 +1558,7 @@ class PHPExcel_Worksheet implements PHPExcel_IComparable
* @throws Exception * @throws Exception
* @return PHPExcel_Worksheet * @return PHPExcel_Worksheet
*/ */
public function protectCellsByColumnAndRow($pColumn1 = 0, $pRow1 = 0, $pColumn2 = 0, $pRow2 = 0, $pPassword = '', $pAlreadyHashed = false) public function protectCellsByColumnAndRow($pColumn1 = 0, $pRow1 = 1, $pColumn2 = 0, $pRow2 = 1, $pPassword = '', $pAlreadyHashed = false)
{ {
$cellRange = PHPExcel_Cell::stringFromColumnIndex($pColumn1) . $pRow1 . ':' . PHPExcel_Cell::stringFromColumnIndex($pColumn2) . $pRow2; $cellRange = PHPExcel_Cell::stringFromColumnIndex($pColumn1) . $pRow1 . ':' . PHPExcel_Cell::stringFromColumnIndex($pColumn2) . $pRow2;
return $this->protectCells($cellRange, $pPassword, $pAlreadyHashed); return $this->protectCells($cellRange, $pPassword, $pAlreadyHashed);
@ -1596,7 +1596,7 @@ class PHPExcel_Worksheet implements PHPExcel_IComparable
* @throws Exception * @throws Exception
* @return PHPExcel_Worksheet * @return PHPExcel_Worksheet
*/ */
public function unprotectCellsByColumnAndRow($pColumn1 = 0, $pRow1 = 0, $pColumn2 = 0, $pRow2 = 0, $pPassword = '', $pAlreadyHashed = false) public function unprotectCellsByColumnAndRow($pColumn1 = 0, $pRow1 = 1, $pColumn2 = 0, $pRow2 = 1, $pPassword = '', $pAlreadyHashed = false)
{ {
$cellRange = PHPExcel_Cell::stringFromColumnIndex($pColumn1) . $pRow1 . ':' . PHPExcel_Cell::stringFromColumnIndex($pColumn2) . $pRow2; $cellRange = PHPExcel_Cell::stringFromColumnIndex($pColumn1) . $pRow1 . ':' . PHPExcel_Cell::stringFromColumnIndex($pColumn2) . $pRow2;
return $this->unprotectCells($cellRange, $pPassword, $pAlreadyHashed); return $this->unprotectCells($cellRange, $pPassword, $pAlreadyHashed);
@ -1653,7 +1653,7 @@ class PHPExcel_Worksheet implements PHPExcel_IComparable
* @throws Exception * @throws Exception
* @return PHPExcel_Worksheet * @return PHPExcel_Worksheet
*/ */
public function setAutoFilterByColumnAndRow($pColumn1 = 0, $pRow1 = 0, $pColumn2 = 0, $pRow2 = 0) public function setAutoFilterByColumnAndRow($pColumn1 = 0, $pRow1 = 1, $pColumn2 = 0, $pRow2 = 1)
{ {
return $this->setAutoFilter( return $this->setAutoFilter(
PHPExcel_Cell::stringFromColumnIndex($pColumn1) . $pRow1 PHPExcel_Cell::stringFromColumnIndex($pColumn1) . $pRow1
@ -1711,7 +1711,7 @@ class PHPExcel_Worksheet implements PHPExcel_IComparable
* @throws Exception * @throws Exception
* @return PHPExcel_Worksheet * @return PHPExcel_Worksheet
*/ */
public function freezePaneByColumnAndRow($pColumn = 0, $pRow = 0) public function freezePaneByColumnAndRow($pColumn = 0, $pRow = 1)
{ {
return $this->freezePane(PHPExcel_Cell::stringFromColumnIndex($pColumn) . $pRow); return $this->freezePane(PHPExcel_Cell::stringFromColumnIndex($pColumn) . $pRow);
} }
@ -1979,7 +1979,7 @@ class PHPExcel_Worksheet implements PHPExcel_IComparable
* @param int $pRow Numeric row coordinate of the cell * @param int $pRow Numeric row coordinate of the cell
* @return PHPExcel_Comment * @return PHPExcel_Comment
*/ */
public function getCommentByColumnAndRow($pColumn = 0, $pRow = 0) public function getCommentByColumnAndRow($pColumn = 0, $pRow = 1)
{ {
return $this->getComment(PHPExcel_Cell::stringFromColumnIndex($pColumn) . $pRow); return $this->getComment(PHPExcel_Cell::stringFromColumnIndex($pColumn) . $pRow);
} }
@ -2068,7 +2068,7 @@ class PHPExcel_Worksheet implements PHPExcel_IComparable
* @throws Exception * @throws Exception
* @return PHPExcel_Worksheet * @return PHPExcel_Worksheet
*/ */
public function setSelectedCellByColumnAndRow($pColumn = 0, $pRow = 0) public function setSelectedCellByColumnAndRow($pColumn = 0, $pRow = 1)
{ {
return $this->setSelectedCells(PHPExcel_Cell::stringFromColumnIndex($pColumn) . $pRow); return $this->setSelectedCells(PHPExcel_Cell::stringFromColumnIndex($pColumn) . $pRow);
} }

View File

@ -198,10 +198,10 @@ class PHPExcel_Writer_Excel2007_Worksheet extends PHPExcel_Writer_Excel2007_Writ
// sheetViews // sheetViews
$objWriter->startElement('sheetViews'); $objWriter->startElement('sheetViews');
// Sheet selected? // Sheet selected?
$sheetSelected = false; $sheetSelected = false;
if ($this->getParentWriter()->getPHPExcel()->getIndex($pSheet) == $this->getParentWriter()->getPHPExcel()->getActiveSheetIndex()) if ($this->getParentWriter()->getPHPExcel()->getIndex($pSheet) == $this->getParentWriter()->getPHPExcel()->getActiveSheetIndex())
$sheetSelected = true; $sheetSelected = true;
// sheetView // sheetView
@ -209,13 +209,13 @@ class PHPExcel_Writer_Excel2007_Worksheet extends PHPExcel_Writer_Excel2007_Writ
$objWriter->writeAttribute('tabSelected', $sheetSelected ? '1' : '0'); $objWriter->writeAttribute('tabSelected', $sheetSelected ? '1' : '0');
$objWriter->writeAttribute('workbookViewId', '0'); $objWriter->writeAttribute('workbookViewId', '0');
// Zoom scales // Zoom scales
if ($pSheet->getSheetView()->getZoomScale() != 100) { if ($pSheet->getSheetView()->getZoomScale() != 100) {
$objWriter->writeAttribute('zoomScale', $pSheet->getSheetView()->getZoomScale()); $objWriter->writeAttribute('zoomScale', $pSheet->getSheetView()->getZoomScale());
} }
if ($pSheet->getSheetView()->getZoomScaleNormal() != 100) { if ($pSheet->getSheetView()->getZoomScaleNormal() != 100) {
$objWriter->writeAttribute('zoomScaleNormal', $pSheet->getSheetView()->getZoomScaleNormal()); $objWriter->writeAttribute('zoomScaleNormal', $pSheet->getSheetView()->getZoomScaleNormal());
} }
// Gridlines // Gridlines
if ($pSheet->getShowGridlines()) { if ($pSheet->getShowGridlines()) {
@ -236,31 +236,50 @@ class PHPExcel_Writer_Excel2007_Worksheet extends PHPExcel_Writer_Excel2007_Writ
$objWriter->writeAttribute('rightToLeft', 'true'); $objWriter->writeAttribute('rightToLeft', 'true');
} }
// Pane $activeCell = $pSheet->getActiveCell();
if ($pSheet->getFreezePane() != '') {
// Calculate freeze coordinates
$xSplit = 0;
$ySplit = 0;
$topLeftCell = $pSheet->getFreezePane();
list($xSplit, $ySplit) = PHPExcel_Cell::coordinateFromString($pSheet->getFreezePane()); // Pane
$pane = '';
$topLeftCell = $pSheet->getFreezePane();
if (($topLeftCell != '') && ($topLeftCell != 'A1')) {
$activeCell = $topLeftCell;
// Calculate freeze coordinates
$xSplit = $ySplit = 0;
list($xSplit, $ySplit) = PHPExcel_Cell::coordinateFromString($topLeftCell);
$xSplit = PHPExcel_Cell::columnIndexFromString($xSplit); $xSplit = PHPExcel_Cell::columnIndexFromString($xSplit);
// pane // pane
$pane = 'topRight';
$objWriter->startElement('pane'); $objWriter->startElement('pane');
$objWriter->writeAttribute('xSplit', $xSplit - 1); if ($xSplit > 1)
$objWriter->writeAttribute('ySplit', $ySplit - 1); $objWriter->writeAttribute('xSplit', $xSplit - 1);
if ($ySplit > 1) {
$objWriter->writeAttribute('ySplit', $ySplit - 1);
$pane = ($xSplit > 1) ? 'bottomRight' : 'bottomLeft';
}
$objWriter->writeAttribute('topLeftCell', $topLeftCell); $objWriter->writeAttribute('topLeftCell', $topLeftCell);
$objWriter->writeAttribute('activePane', 'bottomRight'); $objWriter->writeAttribute('activePane', $pane);
$objWriter->writeAttribute('state', 'frozen'); $objWriter->writeAttribute('state', 'frozen');
$objWriter->endElement(); $objWriter->endElement();
if (($xSplit > 1) && ($ySplit > 1)) {
// Write additional selections if more than two panes (ie both an X and a Y split)
$objWriter->startElement('selection'); $objWriter->writeAttribute('pane', 'topRight'); $objWriter->endElement();
$objWriter->startElement('selection'); $objWriter->writeAttribute('pane', 'bottomLeft'); $objWriter->endElement();
}
} }
// Selection // Selection
$objWriter->startElement('selection'); if ($pane != '') {
$objWriter->writeAttribute('activeCell', $pSheet->getActiveCell()); // Only need to write selection element if we have a split pane
$objWriter->writeAttribute('sqref', $pSheet->getSelectedCells()); // We cheat a little by over-riding the active cell selection, setting it to the split cell
$objWriter->endElement(); $objWriter->startElement('selection');
$objWriter->writeAttribute('pane', $pane);
$objWriter->writeAttribute('activeCell', $activeCell);
$objWriter->writeAttribute('sqref', $activeCell);
$objWriter->endElement();
}
$objWriter->endElement(); $objWriter->endElement();
@ -282,14 +301,14 @@ class PHPExcel_Writer_Excel2007_Worksheet extends PHPExcel_Writer_Excel2007_Writ
// Default row height // Default row height
if ($pSheet->getDefaultRowDimension()->getRowHeight() >= 0) { if ($pSheet->getDefaultRowDimension()->getRowHeight() >= 0) {
$objWriter->writeAttribute('customHeight', 'true'); $objWriter->writeAttribute('customHeight', 'true');
$objWriter->writeAttribute('defaultRowHeight', PHPExcel_Shared_String::FormatNumber($pSheet->getDefaultRowDimension()->getRowHeight())); $objWriter->writeAttribute('defaultRowHeight', PHPExcel_Shared_String::FormatNumber($pSheet->getDefaultRowDimension()->getRowHeight()));
} else { } else {
$objWriter->writeAttribute('defaultRowHeight', '12.75'); $objWriter->writeAttribute('defaultRowHeight', '12.75');
} }
// Default column width // Default column width
if ($pSheet->getDefaultColumnDimension()->getWidth() >= 0) { if ($pSheet->getDefaultColumnDimension()->getWidth() >= 0) {
$objWriter->writeAttribute('defaultColWidth', PHPExcel_Shared_String::FormatNumber($pSheet->getDefaultColumnDimension()->getWidth())); $objWriter->writeAttribute('defaultColWidth', PHPExcel_Shared_String::FormatNumber($pSheet->getDefaultColumnDimension()->getWidth()));
} }
// Outline level - row // Outline level - row
@ -299,7 +318,7 @@ class PHPExcel_Writer_Excel2007_Worksheet extends PHPExcel_Writer_Excel2007_Writ
$outlineLevelRow = $dimension->getOutlineLevel(); $outlineLevelRow = $dimension->getOutlineLevel();
} }
} }
$objWriter->writeAttribute('outlineLevelRow', (int)$outlineLevelRow); $objWriter->writeAttribute('outlineLevelRow', (int)$outlineLevelRow);
// Outline level - column // Outline level - column
$outlineLevelCol = 0; $outlineLevelCol = 0;
@ -308,7 +327,7 @@ class PHPExcel_Writer_Excel2007_Worksheet extends PHPExcel_Writer_Excel2007_Writ
$outlineLevelCol = $dimension->getOutlineLevel(); $outlineLevelCol = $dimension->getOutlineLevel();
} }
} }
$objWriter->writeAttribute('outlineLevelCol', (int)$outlineLevelCol); $objWriter->writeAttribute('outlineLevelCol', (int)$outlineLevelCol);
$objWriter->endElement(); $objWriter->endElement();
} }
@ -456,23 +475,23 @@ class PHPExcel_Writer_Excel2007_Worksheet extends PHPExcel_Writer_Excel2007_Writ
$objWriter->writeAttribute('text', $conditional->getText()); $objWriter->writeAttribute('text', $conditional->getText());
} }
if ($conditional->getConditionType() == PHPExcel_Style_Conditional::CONDITION_CONTAINSTEXT if ($conditional->getConditionType() == PHPExcel_Style_Conditional::CONDITION_CONTAINSTEXT
&& $conditional->getOperatorType() == PHPExcel_Style_Conditional::OPERATOR_CONTAINSTEXT && $conditional->getOperatorType() == PHPExcel_Style_Conditional::OPERATOR_CONTAINSTEXT
&& !is_null($conditional->getText())) { && !is_null($conditional->getText())) {
$objWriter->writeElement('formula', 'NOT(ISERROR(SEARCH("' . $conditional->getText() . '",' . $cellCoordinate . ')))'); $objWriter->writeElement('formula', 'NOT(ISERROR(SEARCH("' . $conditional->getText() . '",' . $cellCoordinate . ')))');
} else if ($conditional->getConditionType() == PHPExcel_Style_Conditional::CONDITION_CONTAINSTEXT } else if ($conditional->getConditionType() == PHPExcel_Style_Conditional::CONDITION_CONTAINSTEXT
&& $conditional->getOperatorType() == PHPExcel_Style_Conditional::OPERATOR_BEGINSWITH && $conditional->getOperatorType() == PHPExcel_Style_Conditional::OPERATOR_BEGINSWITH
&& !is_null($conditional->getText())) { && !is_null($conditional->getText())) {
$objWriter->writeElement('formula', 'LEFT(' . $cellCoordinate . ',' . strlen($conditional->getText()) . ')="' . $conditional->getText() . '"'); $objWriter->writeElement('formula', 'LEFT(' . $cellCoordinate . ',' . strlen($conditional->getText()) . ')="' . $conditional->getText() . '"');
} else if ($conditional->getConditionType() == PHPExcel_Style_Conditional::CONDITION_CONTAINSTEXT } else if ($conditional->getConditionType() == PHPExcel_Style_Conditional::CONDITION_CONTAINSTEXT
&& $conditional->getOperatorType() == PHPExcel_Style_Conditional::OPERATOR_ENDSWITH && $conditional->getOperatorType() == PHPExcel_Style_Conditional::OPERATOR_ENDSWITH
&& !is_null($conditional->getText())) { && !is_null($conditional->getText())) {
$objWriter->writeElement('formula', 'RIGHT(' . $cellCoordinate . ',' . strlen($conditional->getText()) . ')="' . $conditional->getText() . '"'); $objWriter->writeElement('formula', 'RIGHT(' . $cellCoordinate . ',' . strlen($conditional->getText()) . ')="' . $conditional->getText() . '"');
} else if ($conditional->getConditionType() == PHPExcel_Style_Conditional::CONDITION_CONTAINSTEXT } else if ($conditional->getConditionType() == PHPExcel_Style_Conditional::CONDITION_CONTAINSTEXT
&& $conditional->getOperatorType() == PHPExcel_Style_Conditional::OPERATOR_NOTCONTAINS && $conditional->getOperatorType() == PHPExcel_Style_Conditional::OPERATOR_NOTCONTAINS
&& !is_null($conditional->getText())) { && !is_null($conditional->getText())) {
$objWriter->writeElement('formula', 'ISERROR(SEARCH("' . $conditional->getText() . '",' . $cellCoordinate . '))'); $objWriter->writeElement('formula', 'ISERROR(SEARCH("' . $conditional->getText() . '",' . $cellCoordinate . '))');
} else if ($conditional->getConditionType() == PHPExcel_Style_Conditional::CONDITION_CELLIS } else if ($conditional->getConditionType() == PHPExcel_Style_Conditional::CONDITION_CELLIS
|| $conditional->getConditionType() == PHPExcel_Style_Conditional::CONDITION_CONTAINSTEXT || $conditional->getConditionType() == PHPExcel_Style_Conditional::CONDITION_CONTAINSTEXT
|| $conditional->getConditionType() == PHPExcel_Style_Conditional::CONDITION_EXPRESSION) { || $conditional->getConditionType() == PHPExcel_Style_Conditional::CONDITION_EXPRESSION) {
foreach ($conditional->getConditions() as $formula) { foreach ($conditional->getConditions() as $formula) {
@ -726,20 +745,20 @@ class PHPExcel_Writer_Excel2007_Worksheet extends PHPExcel_Writer_Excel2007_Writ
$objWriter->writeAttribute('orientation', $pSheet->getPageSetup()->getOrientation()); $objWriter->writeAttribute('orientation', $pSheet->getPageSetup()->getOrientation());
if (!is_null($pSheet->getPageSetup()->getScale())) { if (!is_null($pSheet->getPageSetup()->getScale())) {
$objWriter->writeAttribute('scale', $pSheet->getPageSetup()->getScale()); $objWriter->writeAttribute('scale', $pSheet->getPageSetup()->getScale());
} }
if (!is_null($pSheet->getPageSetup()->getFitToHeight())) { if (!is_null($pSheet->getPageSetup()->getFitToHeight())) {
$objWriter->writeAttribute('fitToHeight', $pSheet->getPageSetup()->getFitToHeight()); $objWriter->writeAttribute('fitToHeight', $pSheet->getPageSetup()->getFitToHeight());
} else { } else {
$objWriter->writeAttribute('fitToHeight', '0'); $objWriter->writeAttribute('fitToHeight', '0');
} }
if (!is_null($pSheet->getPageSetup()->getFitToWidth())) { if (!is_null($pSheet->getPageSetup()->getFitToWidth())) {
$objWriter->writeAttribute('fitToWidth', $pSheet->getPageSetup()->getFitToWidth()); $objWriter->writeAttribute('fitToWidth', $pSheet->getPageSetup()->getFitToWidth());
} else { } else {
$objWriter->writeAttribute('fitToWidth', '0'); $objWriter->writeAttribute('fitToWidth', '0');
} }
if (!is_null($pSheet->getPageSetup()->getFirstPageNumber())) { if (!is_null($pSheet->getPageSetup()->getFirstPageNumber())) {
$objWriter->writeAttribute('firstPageNumber', $pSheet->getPageSetup()->getFirstPageNumber()); $objWriter->writeAttribute('firstPageNumber', $pSheet->getPageSetup()->getFirstPageNumber());
$objWriter->writeAttribute('useFirstPageNumber', '1'); $objWriter->writeAttribute('useFirstPageNumber', '1');
} }
@ -864,7 +883,7 @@ class PHPExcel_Writer_Excel2007_Worksheet extends PHPExcel_Writer_Excel2007_Writ
$rowDimension = $pSheet->getRowDimension($currentRow); $rowDimension = $pSheet->getRowDimension($currentRow);
// Write current row? // Write current row?
$writeCurrentRow = isset($cellsByRow[$currentRow]) || $writeCurrentRow = isset($cellsByRow[$currentRow]) ||
$rowDimension->getRowHeight() >= 0 || $rowDimension->getRowHeight() >= 0 ||
$rowDimension->getVisible() == false || $rowDimension->getVisible() == false ||
$rowDimension->getCollapsed() == true || $rowDimension->getCollapsed() == true ||

View File

@ -54,7 +54,10 @@ Fixed in SVN:
- Bugfix: (MBaker) Work item 14980 - Images not getting copyied with the ->clone function - Bugfix: (MBaker) Work item 14980 - Images not getting copyied with the ->clone function
- Bugfix: (MBaker) Work item 11576 - AdvancedValueBinder.php: String sometimes becomes a date when it shouldn't - Bugfix: (MBaker) Work item 11576 - AdvancedValueBinder.php: String sometimes becomes a date when it shouldn't
- Bugfix: (MBaker) Fix Excel5 Writer so that it only writes column dimensions for columns that are actually used rather than the full range (A to IV) - Bugfix: (MBaker) Fix Excel5 Writer so that it only writes column dimensions for columns that are actually used rather than the full range (A to IV)
- Bugfix: (MBaker) The freezePaneByColumnAndRow() method row argument should default to 1 rather than 0.
Default row argument for all __ByColumnAndRow() methods should be 1
- General: (MBaker) Improved performance (speed), for building the Shared Strings table in the Excel2007 Writer. - General: (MBaker) Improved performance (speed), for building the Shared Strings table in the Excel2007 Writer.
- General: (MBaker) Enhanced SheetViews element structures in the Excel2007 Writer for frozen panes.