-
-
Save anton-harvey/5f356a631017c362abde1b3fd4e51b04 to your computer and use it in GitHub Desktop.
Modifications made to k1LoW's commit (d24e64080166f04e36a3a077fb5ba6271eb2b334)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/contribution.php b/contribution-updated.php | |
index e76cec5..8880e43 100644 | |
--- a/contribution.php | |
+++ b/contribution-updated.php | |
@@ -35,10 +35,8 @@ | |
*/ | |
class PHPExcel_Worksheet_SheetView | |
{ | |
- | |
- /* Fill types */ | |
- const VIEW_PAGE_LAYOUT = 'pageLayout'; | |
- const VIEW_PAGE_BREAK_PREVIEW = 'pageBreakPreview'; | |
+ const SHEETVIEW_PAGE_LAYOUT = 'pageLayout'; | |
+ const SHEETVIEW_PAGE_BREAK_PREVIEW = 'pageBreakPreview'; | |
/** | |
* ZoomScale | |
@@ -59,13 +57,13 @@ class PHPExcel_Worksheet_SheetView | |
private $_zoomScaleNormal = 100; | |
/** | |
- * View | |
+ * View. | |
* | |
* Valid values range from 10 to 400. | |
* | |
* @var string | |
*/ | |
- private $_view = false; | |
+ private $sheetviewType = self::SHEETVIEW_NORMAL; | |
/** | |
* Create a new PHPExcel_Worksheet_SheetView | |
@@ -131,30 +129,41 @@ class PHPExcel_Worksheet_SheetView | |
} | |
/** | |
- * Get View | |
+ * Get View. | |
* | |
- * @return int | |
+ * @return string | |
*/ | |
- public function getView() { | |
- return $this->_view; | |
+ public function getView() | |
+ { | |
+ return $this->sheetviewType; | |
} | |
/** | |
- * Set View | |
+ * Set View. | |
* | |
- * Valid values range from 10 to 400. | |
+ * Valid values are | |
+ * 'normal' self::SHEETVIEW_NORMAL | |
+ * 'pageLayout' self::SHEETVIEW_PAGE_LAYOUT | |
+ * 'pageBreakPreview' self::SHEETVIEW_PAGE_BREAK_PREVIEW | |
* | |
- * @param string $pValue | |
- * @throws Exception | |
- * @return PHPExcel_Worksheet_SheetView | |
+ * @param string $pValue | |
+ * | |
+ * @throws PhpSpreadsheetException | |
+ * | |
+ * @return SheetView | |
*/ | |
- public function setView($pValue = false) { | |
- // Microsoft Office Excel 2007 only allows setting a view 'pageLayout' or 'pageBreakPreview' via the user interface, | |
- if (($pValue === false) || in_array($pValue, array(self::VIEW_PAGE_LAYOUT, self::VIEW_PAGE_BREAK_PREVIEW))) { | |
- $this->_view = $pValue; | |
+ public function setView($pValue) | |
+ { | |
+ // MS Excel 2007 allows setting the view to 'normal', 'pageLayout' or 'pageBreakPreview' via the user interface | |
+ if ($pValue === null) { | |
+ $pValue = self::SHEETVIEW_NORMAL; | |
+ } | |
+ if (in_array($pValue, self::$sheetViewTypes)) { | |
+ $this->sheetviewType = $pValue; | |
} else { | |
- throw new Exception("Invalid view."); | |
+ throw new PhpSpreadsheetException('Invalid sheetview layout type.'); | |
} | |
+ | |
return $this; | |
} | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/contribution.php b/contribution-updated.php | |
index 036f4b7..7514769 100644 | |
--- a/contribution.php | |
+++ b/contribution-updated.php | |
@@ -218,9 +218,9 @@ class PHPExcel_Writer_Excel2007_Worksheet extends PHPExcel_Writer_Excel2007_Writ | |
$objWriter->writeAttribute('zoomScaleNormal', $pSheet->getSheetView()->getZoomScaleNormal()); | |
} | |
- // View | |
- if ($pSheet->getSheetView()->getView() != false) { | |
- $objWriter->writeAttribute('view', $pSheet->getSheetView()->getView()); | |
+ // View Layout Type | |
+ if ($pSheet->getSheetView()->getView() !== SheetView::SHEETVIEW_NORMAL) { | |
+ $objWriter->writeAttribute('view', $pSheet->getSheetView()->getView()); | |
} | |
// Gridlines |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment