[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Fmsystem-commits] [10212] api: phpexcel merge
From: |
Sigurd Nes |
Subject: |
[Fmsystem-commits] [10212] api: phpexcel merge |
Date: |
Mon, 15 Oct 2012 10:24:08 +0000 |
Revision: 10212
http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=10212
Author: sigurdne
Date: 2012-10-15 10:24:07 +0000 (Mon, 15 Oct 2012)
Log Message:
-----------
api: phpexcel merge
Modified Paths:
--------------
branches/Version-1_0-branch/phpgwapi/inc/phpexcel/PHPExcel.php
Modified: branches/Version-1_0-branch/phpgwapi/inc/phpexcel/PHPExcel.php
===================================================================
--- branches/Version-1_0-branch/phpgwapi/inc/phpexcel/PHPExcel.php
2012-10-15 10:21:53 UTC (rev 10211)
+++ branches/Version-1_0-branch/phpgwapi/inc/phpexcel/PHPExcel.php
2012-10-15 10:24:07 UTC (rev 10212)
@@ -22,7 +22,7 @@
* @package PHPExcel
* @copyright Copyright (c) 2006 - 2012 PHPExcel
(http://www.codeplex.com/PHPExcel)
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
- * @version 1.7.7, 2012-05-19
+ * @version 1.7.8, 2012-10-12
*/
@@ -198,7 +198,7 @@
* @return PHPExcel_Worksheet
* @throws Exception
*/
- public function createSheet($iSheetIndex = null)
+ public function createSheet($iSheetIndex = NULL)
{
$newSheet = new PHPExcel_Worksheet($this);
$this->addSheet($newSheet, $iSheetIndex);
@@ -206,6 +206,17 @@
}
/**
+ * Chech if a sheet with a specified name already exists
+ *
+ * @param string $pSheetName Name of the worksheet to check
+ * @return boolean
+ */
+ public function sheetNameExists($pSheetName)
+ {
+ return ($this->getSheetByName($pSheetName) !== NULL);
+ }
+
+ /**
* Add sheet
*
* @param PHPExcel_Worksheet $pSheet
@@ -213,9 +224,16 @@
* @return PHPExcel_Worksheet
* @throws Exception
*/
- public function addSheet(PHPExcel_Worksheet $pSheet = null, $iSheetIndex =
null)
+ public function addSheet(PHPExcel_Worksheet $pSheet, $iSheetIndex = NULL)
{
+ if ($this->sheetNameExists($pSheet->getTitle())) {
+ throw new Exception("Workbook already contains a
worksheet named '{$pSheet->getTitle()}'. Rename this worksheet first.");
+ }
+
if($iSheetIndex === NULL) {
+ if ($this->_activeSheetIndex < 0) {
+ $this->_activeSheetIndex = 0;
+ }
$this->_workSheetCollection[] = $pSheet;
} else {
// Insert the sheet at the requested index
@@ -420,7 +438,7 @@
* @return PHPExcel_Worksheet
*/
public function addExternalSheet(PHPExcel_Worksheet $pSheet,
$iSheetIndex = null) {
- if ($this->getSheetByName($pSheet->getTitle()) !== NULL) {
+ if ($this->sheetNameExists($pSheet->getTitle())) {
throw new Exception("Workbook already contains a
worksheet named '{$pSheet->getTitle()}'. Rename the external sheet first.");
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Fmsystem-commits] [10212] api: phpexcel merge,
Sigurd Nes <=