PSR-2 : Fixes

This commit is contained in:
Progi1984 2015-05-15 13:17:40 +02:00
parent 96f3d0e6ee
commit 5508013569
8 changed files with 371 additions and 310 deletions

View File

@ -107,81 +107,81 @@
class PHPExcel_Worksheet_PageSetup class PHPExcel_Worksheet_PageSetup
{ {
/* Paper size */ /* Paper size */
const PAPERSIZE_LETTER = 1; const PAPERSIZE_LETTER = 1;
const PAPERSIZE_LETTER_SMALL = 2; const PAPERSIZE_LETTER_SMALL = 2;
const PAPERSIZE_TABLOID = 3; const PAPERSIZE_TABLOID = 3;
const PAPERSIZE_LEDGER = 4; const PAPERSIZE_LEDGER = 4;
const PAPERSIZE_LEGAL = 5; const PAPERSIZE_LEGAL = 5;
const PAPERSIZE_STATEMENT = 6; const PAPERSIZE_STATEMENT = 6;
const PAPERSIZE_EXECUTIVE = 7; const PAPERSIZE_EXECUTIVE = 7;
const PAPERSIZE_A3 = 8; const PAPERSIZE_A3 = 8;
const PAPERSIZE_A4 = 9; const PAPERSIZE_A4 = 9;
const PAPERSIZE_A4_SMALL = 10; const PAPERSIZE_A4_SMALL = 10;
const PAPERSIZE_A5 = 11; const PAPERSIZE_A5 = 11;
const PAPERSIZE_B4 = 12; const PAPERSIZE_B4 = 12;
const PAPERSIZE_B5 = 13; const PAPERSIZE_B5 = 13;
const PAPERSIZE_FOLIO = 14; const PAPERSIZE_FOLIO = 14;
const PAPERSIZE_QUARTO = 15; const PAPERSIZE_QUARTO = 15;
const PAPERSIZE_STANDARD_1 = 16; const PAPERSIZE_STANDARD_1 = 16;
const PAPERSIZE_STANDARD_2 = 17; const PAPERSIZE_STANDARD_2 = 17;
const PAPERSIZE_NOTE = 18; const PAPERSIZE_NOTE = 18;
const PAPERSIZE_NO9_ENVELOPE = 19; const PAPERSIZE_NO9_ENVELOPE = 19;
const PAPERSIZE_NO10_ENVELOPE = 20; const PAPERSIZE_NO10_ENVELOPE = 20;
const PAPERSIZE_NO11_ENVELOPE = 21; const PAPERSIZE_NO11_ENVELOPE = 21;
const PAPERSIZE_NO12_ENVELOPE = 22; const PAPERSIZE_NO12_ENVELOPE = 22;
const PAPERSIZE_NO14_ENVELOPE = 23; const PAPERSIZE_NO14_ENVELOPE = 23;
const PAPERSIZE_C = 24; const PAPERSIZE_C = 24;
const PAPERSIZE_D = 25; const PAPERSIZE_D = 25;
const PAPERSIZE_E = 26; const PAPERSIZE_E = 26;
const PAPERSIZE_DL_ENVELOPE = 27; const PAPERSIZE_DL_ENVELOPE = 27;
const PAPERSIZE_C5_ENVELOPE = 28; const PAPERSIZE_C5_ENVELOPE = 28;
const PAPERSIZE_C3_ENVELOPE = 29; const PAPERSIZE_C3_ENVELOPE = 29;
const PAPERSIZE_C4_ENVELOPE = 30; const PAPERSIZE_C4_ENVELOPE = 30;
const PAPERSIZE_C6_ENVELOPE = 31; const PAPERSIZE_C6_ENVELOPE = 31;
const PAPERSIZE_C65_ENVELOPE = 32; const PAPERSIZE_C65_ENVELOPE = 32;
const PAPERSIZE_B4_ENVELOPE = 33; const PAPERSIZE_B4_ENVELOPE = 33;
const PAPERSIZE_B5_ENVELOPE = 34; const PAPERSIZE_B5_ENVELOPE = 34;
const PAPERSIZE_B6_ENVELOPE = 35; const PAPERSIZE_B6_ENVELOPE = 35;
const PAPERSIZE_ITALY_ENVELOPE = 36; const PAPERSIZE_ITALY_ENVELOPE = 36;
const PAPERSIZE_MONARCH_ENVELOPE = 37; const PAPERSIZE_MONARCH_ENVELOPE = 37;
const PAPERSIZE_6_3_4_ENVELOPE = 38; const PAPERSIZE_6_3_4_ENVELOPE = 38;
const PAPERSIZE_US_STANDARD_FANFOLD = 39; const PAPERSIZE_US_STANDARD_FANFOLD = 39;
const PAPERSIZE_GERMAN_STANDARD_FANFOLD = 40; const PAPERSIZE_GERMAN_STANDARD_FANFOLD = 40;
const PAPERSIZE_GERMAN_LEGAL_FANFOLD = 41; const PAPERSIZE_GERMAN_LEGAL_FANFOLD = 41;
const PAPERSIZE_ISO_B4 = 42; const PAPERSIZE_ISO_B4 = 42;
const PAPERSIZE_JAPANESE_DOUBLE_POSTCARD = 43; const PAPERSIZE_JAPANESE_DOUBLE_POSTCARD = 43;
const PAPERSIZE_STANDARD_PAPER_1 = 44; const PAPERSIZE_STANDARD_PAPER_1 = 44;
const PAPERSIZE_STANDARD_PAPER_2 = 45; const PAPERSIZE_STANDARD_PAPER_2 = 45;
const PAPERSIZE_STANDARD_PAPER_3 = 46; const PAPERSIZE_STANDARD_PAPER_3 = 46;
const PAPERSIZE_INVITE_ENVELOPE = 47; const PAPERSIZE_INVITE_ENVELOPE = 47;
const PAPERSIZE_LETTER_EXTRA_PAPER = 48; const PAPERSIZE_LETTER_EXTRA_PAPER = 48;
const PAPERSIZE_LEGAL_EXTRA_PAPER = 49; const PAPERSIZE_LEGAL_EXTRA_PAPER = 49;
const PAPERSIZE_TABLOID_EXTRA_PAPER = 50; const PAPERSIZE_TABLOID_EXTRA_PAPER = 50;
const PAPERSIZE_A4_EXTRA_PAPER = 51; const PAPERSIZE_A4_EXTRA_PAPER = 51;
const PAPERSIZE_LETTER_TRANSVERSE_PAPER = 52; const PAPERSIZE_LETTER_TRANSVERSE_PAPER = 52;
const PAPERSIZE_A4_TRANSVERSE_PAPER = 53; const PAPERSIZE_A4_TRANSVERSE_PAPER = 53;
const PAPERSIZE_LETTER_EXTRA_TRANSVERSE_PAPER = 54; const PAPERSIZE_LETTER_EXTRA_TRANSVERSE_PAPER = 54;
const PAPERSIZE_SUPERA_SUPERA_A4_PAPER = 55; const PAPERSIZE_SUPERA_SUPERA_A4_PAPER = 55;
const PAPERSIZE_SUPERB_SUPERB_A3_PAPER = 56; const PAPERSIZE_SUPERB_SUPERB_A3_PAPER = 56;
const PAPERSIZE_LETTER_PLUS_PAPER = 57; const PAPERSIZE_LETTER_PLUS_PAPER = 57;
const PAPERSIZE_A4_PLUS_PAPER = 58; const PAPERSIZE_A4_PLUS_PAPER = 58;
const PAPERSIZE_A5_TRANSVERSE_PAPER = 59; const PAPERSIZE_A5_TRANSVERSE_PAPER = 59;
const PAPERSIZE_JIS_B5_TRANSVERSE_PAPER = 60; const PAPERSIZE_JIS_B5_TRANSVERSE_PAPER = 60;
const PAPERSIZE_A3_EXTRA_PAPER = 61; const PAPERSIZE_A3_EXTRA_PAPER = 61;
const PAPERSIZE_A5_EXTRA_PAPER = 62; const PAPERSIZE_A5_EXTRA_PAPER = 62;
const PAPERSIZE_ISO_B5_EXTRA_PAPER = 63; const PAPERSIZE_ISO_B5_EXTRA_PAPER = 63;
const PAPERSIZE_A2_PAPER = 64; const PAPERSIZE_A2_PAPER = 64;
const PAPERSIZE_A3_TRANSVERSE_PAPER = 65; const PAPERSIZE_A3_TRANSVERSE_PAPER = 65;
const PAPERSIZE_A3_EXTRA_TRANSVERSE_PAPER = 66; const PAPERSIZE_A3_EXTRA_TRANSVERSE_PAPER = 66;
/* Page orientation */ /* Page orientation */
const ORIENTATION_DEFAULT = 'default'; const ORIENTATION_DEFAULT = 'default';
const ORIENTATION_LANDSCAPE = 'landscape'; const ORIENTATION_LANDSCAPE = 'landscape';
const ORIENTATION_PORTRAIT = 'portrait'; const ORIENTATION_PORTRAIT = 'portrait';
/* Print Range Set Method */ /* Print Range Set Method */
const SETPRINTRANGE_OVERWRITE = 'O'; const SETPRINTRANGE_OVERWRITE = 'O';
const SETPRINTRANGE_INSERT = 'I'; const SETPRINTRANGE_INSERT = 'I';
/** /**
@ -189,14 +189,14 @@ class PHPExcel_Worksheet_PageSetup
* *
* @var int * @var int
*/ */
private $_paperSize = PHPExcel_Worksheet_PageSetup::PAPERSIZE_LETTER; private $_paperSize = PHPExcel_Worksheet_PageSetup::PAPERSIZE_LETTER;
/** /**
* Orientation * Orientation
* *
* @var string * @var string
*/ */
private $_orientation = PHPExcel_Worksheet_PageSetup::ORIENTATION_DEFAULT; private $_orientation = PHPExcel_Worksheet_PageSetup::ORIENTATION_DEFAULT;
/** /**
* Scale (Print Scale) * Scale (Print Scale)
@ -206,7 +206,7 @@ class PHPExcel_Worksheet_PageSetup
* *
* @var int? * @var int?
*/ */
private $_scale = 100; private $_scale = 100;
/** /**
* Fit To Page * Fit To Page
@ -214,7 +214,7 @@ class PHPExcel_Worksheet_PageSetup
* *
* @var boolean * @var boolean
*/ */
private $_fitToPage = FALSE; private $_fitToPage = false;
/** /**
* Fit To Height * Fit To Height
@ -251,28 +251,28 @@ class PHPExcel_Worksheet_PageSetup
* *
* @var boolean * @var boolean
*/ */
private $_horizontalCentered = FALSE; private $_horizontalCentered = false;
/** /**
* Center page vertically * Center page vertically
* *
* @var boolean * @var boolean
*/ */
private $_verticalCentered = FALSE; private $_verticalCentered = false;
/** /**
* Print area * Print area
* *
* @var string * @var string
*/ */
private $_printArea = NULL; private $_printArea = null;
/** /**
* First page number * First page number
* *
* @var int * @var int
*/ */
private $_firstPageNumber = NULL; private $_firstPageNumber = null;
/** /**
* Create a new PHPExcel_Worksheet_PageSetup * Create a new PHPExcel_Worksheet_PageSetup
@ -286,7 +286,8 @@ class PHPExcel_Worksheet_PageSetup
* *
* @return int * @return int
*/ */
public function getPaperSize() { public function getPaperSize()
{
return $this->_paperSize; return $this->_paperSize;
} }
@ -370,7 +371,7 @@ class PHPExcel_Worksheet_PageSetup
* @param boolean $pValue * @param boolean $pValue
* @return PHPExcel_Worksheet_PageSetup * @return PHPExcel_Worksheet_PageSetup
*/ */
public function setFitToPage($pValue = TRUE) { public function setFitToPage($pValue = true) {
$this->_fitToPage = $pValue; $this->_fitToPage = $pValue;
return $this; return $this;
} }
@ -391,10 +392,10 @@ class PHPExcel_Worksheet_PageSetup
* @param boolean $pUpdate Update fitToPage so it applies rather than scaling * @param boolean $pUpdate Update fitToPage so it applies rather than scaling
* @return PHPExcel_Worksheet_PageSetup * @return PHPExcel_Worksheet_PageSetup
*/ */
public function setFitToHeight($pValue = 1, $pUpdate = TRUE) { public function setFitToHeight($pValue = 1, $pUpdate = true) {
$this->_fitToHeight = $pValue; $this->_fitToHeight = $pValue;
if ($pUpdate) { if ($pUpdate) {
$this->_fitToPage = TRUE; $this->_fitToPage = true;
} }
return $this; return $this;
} }
@ -415,10 +416,10 @@ class PHPExcel_Worksheet_PageSetup
* @param boolean $pUpdate Update fitToPage so it applies rather than scaling * @param boolean $pUpdate Update fitToPage so it applies rather than scaling
* @return PHPExcel_Worksheet_PageSetup * @return PHPExcel_Worksheet_PageSetup
*/ */
public function setFitToWidth($pValue = 1, $pUpdate = TRUE) { public function setFitToWidth($pValue = 1, $pUpdate = true) {
$this->_fitToWidth = $pValue; $this->_fitToWidth = $pValue;
if ($pUpdate) { if ($pUpdate) {
$this->_fitToPage = TRUE; $this->_fitToPage = true;
} }
return $this; return $this;
} }
@ -610,7 +611,7 @@ class PHPExcel_Worksheet_PageSetup
*/ */
public function clearPrintArea($index = 0) { public function clearPrintArea($index = 0) {
if ($index == 0) { if ($index == 0) {
$this->_printArea = NULL; $this->_printArea = null;
} else { } else {
$printAreas = explode(',', $this->_printArea); $printAreas = explode(',', $this->_printArea);
if (isset($printAreas[$index-1])) { if (isset($printAreas[$index-1])) {

View File

@ -166,8 +166,9 @@ class PHPExcel_Worksheet_Protection
* *
* @return boolean * @return boolean
*/ */
function isProtectionEnabled() { function isProtectionEnabled()
return $this->_sheet || {
return $this->_sheet ||
$this->_objects || $this->_objects ||
$this->_scenarios || $this->_scenarios ||
$this->_formatCells || $this->_formatCells ||
@ -190,7 +191,8 @@ class PHPExcel_Worksheet_Protection
* *
* @return boolean * @return boolean
*/ */
function getSheet() { function getSheet()
{
return $this->_sheet; return $this->_sheet;
} }
@ -200,7 +202,8 @@ class PHPExcel_Worksheet_Protection
* @param boolean $pValue * @param boolean $pValue
* @return PHPExcel_Worksheet_Protection * @return PHPExcel_Worksheet_Protection
*/ */
function setSheet($pValue = false) { function setSheet($pValue = false)
{
$this->_sheet = $pValue; $this->_sheet = $pValue;
return $this; return $this;
} }
@ -210,7 +213,8 @@ class PHPExcel_Worksheet_Protection
* *
* @return boolean * @return boolean
*/ */
function getObjects() { function getObjects()
{
return $this->_objects; return $this->_objects;
} }
@ -220,7 +224,8 @@ class PHPExcel_Worksheet_Protection
* @param boolean $pValue * @param boolean $pValue
* @return PHPExcel_Worksheet_Protection * @return PHPExcel_Worksheet_Protection
*/ */
function setObjects($pValue = false) { function setObjects($pValue = false)
{
$this->_objects = $pValue; $this->_objects = $pValue;
return $this; return $this;
} }
@ -230,7 +235,8 @@ class PHPExcel_Worksheet_Protection
* *
* @return boolean * @return boolean
*/ */
function getScenarios() { function getScenarios()
{
return $this->_scenarios; return $this->_scenarios;
} }
@ -240,7 +246,8 @@ class PHPExcel_Worksheet_Protection
* @param boolean $pValue * @param boolean $pValue
* @return PHPExcel_Worksheet_Protection * @return PHPExcel_Worksheet_Protection
*/ */
function setScenarios($pValue = false) { function setScenarios($pValue = false)
{
$this->_scenarios = $pValue; $this->_scenarios = $pValue;
return $this; return $this;
} }
@ -250,7 +257,8 @@ class PHPExcel_Worksheet_Protection
* *
* @return boolean * @return boolean
*/ */
function getFormatCells() { function getFormatCells()
{
return $this->_formatCells; return $this->_formatCells;
} }
@ -260,7 +268,8 @@ class PHPExcel_Worksheet_Protection
* @param boolean $pValue * @param boolean $pValue
* @return PHPExcel_Worksheet_Protection * @return PHPExcel_Worksheet_Protection
*/ */
function setFormatCells($pValue = false) { function setFormatCells($pValue = false)
{
$this->_formatCells = $pValue; $this->_formatCells = $pValue;
return $this; return $this;
} }
@ -270,7 +279,8 @@ class PHPExcel_Worksheet_Protection
* *
* @return boolean * @return boolean
*/ */
function getFormatColumns() { function getFormatColumns()
{
return $this->_formatColumns; return $this->_formatColumns;
} }
@ -280,7 +290,8 @@ class PHPExcel_Worksheet_Protection
* @param boolean $pValue * @param boolean $pValue
* @return PHPExcel_Worksheet_Protection * @return PHPExcel_Worksheet_Protection
*/ */
function setFormatColumns($pValue = false) { function setFormatColumns($pValue = false)
{
$this->_formatColumns = $pValue; $this->_formatColumns = $pValue;
return $this; return $this;
} }
@ -290,7 +301,8 @@ class PHPExcel_Worksheet_Protection
* *
* @return boolean * @return boolean
*/ */
function getFormatRows() { function getFormatRows()
{
return $this->_formatRows; return $this->_formatRows;
} }
@ -300,7 +312,8 @@ class PHPExcel_Worksheet_Protection
* @param boolean $pValue * @param boolean $pValue
* @return PHPExcel_Worksheet_Protection * @return PHPExcel_Worksheet_Protection
*/ */
function setFormatRows($pValue = false) { function setFormatRows($pValue = false)
{
$this->_formatRows = $pValue; $this->_formatRows = $pValue;
return $this; return $this;
} }
@ -310,7 +323,8 @@ class PHPExcel_Worksheet_Protection
* *
* @return boolean * @return boolean
*/ */
function getInsertColumns() { function getInsertColumns()
{
return $this->_insertColumns; return $this->_insertColumns;
} }
@ -320,7 +334,8 @@ class PHPExcel_Worksheet_Protection
* @param boolean $pValue * @param boolean $pValue
* @return PHPExcel_Worksheet_Protection * @return PHPExcel_Worksheet_Protection
*/ */
function setInsertColumns($pValue = false) { function setInsertColumns($pValue = false)
{
$this->_insertColumns = $pValue; $this->_insertColumns = $pValue;
return $this; return $this;
} }
@ -330,7 +345,8 @@ class PHPExcel_Worksheet_Protection
* *
* @return boolean * @return boolean
*/ */
function getInsertRows() { function getInsertRows()
{
return $this->_insertRows; return $this->_insertRows;
} }
@ -340,7 +356,8 @@ class PHPExcel_Worksheet_Protection
* @param boolean $pValue * @param boolean $pValue
* @return PHPExcel_Worksheet_Protection * @return PHPExcel_Worksheet_Protection
*/ */
function setInsertRows($pValue = false) { function setInsertRows($pValue = false)
{
$this->_insertRows = $pValue; $this->_insertRows = $pValue;
return $this; return $this;
} }
@ -350,7 +367,8 @@ class PHPExcel_Worksheet_Protection
* *
* @return boolean * @return boolean
*/ */
function getInsertHyperlinks() { function getInsertHyperlinks()
{
return $this->_insertHyperlinks; return $this->_insertHyperlinks;
} }
@ -360,7 +378,8 @@ class PHPExcel_Worksheet_Protection
* @param boolean $pValue * @param boolean $pValue
* @return PHPExcel_Worksheet_Protection * @return PHPExcel_Worksheet_Protection
*/ */
function setInsertHyperlinks($pValue = false) { function setInsertHyperlinks($pValue = false)
{
$this->_insertHyperlinks = $pValue; $this->_insertHyperlinks = $pValue;
return $this; return $this;
} }
@ -370,7 +389,8 @@ class PHPExcel_Worksheet_Protection
* *
* @return boolean * @return boolean
*/ */
function getDeleteColumns() { function getDeleteColumns()
{
return $this->_deleteColumns; return $this->_deleteColumns;
} }
@ -380,7 +400,8 @@ class PHPExcel_Worksheet_Protection
* @param boolean $pValue * @param boolean $pValue
* @return PHPExcel_Worksheet_Protection * @return PHPExcel_Worksheet_Protection
*/ */
function setDeleteColumns($pValue = false) { function setDeleteColumns($pValue = false)
{
$this->_deleteColumns = $pValue; $this->_deleteColumns = $pValue;
return $this; return $this;
} }
@ -390,7 +411,8 @@ class PHPExcel_Worksheet_Protection
* *
* @return boolean * @return boolean
*/ */
function getDeleteRows() { function getDeleteRows()
{
return $this->_deleteRows; return $this->_deleteRows;
} }
@ -400,7 +422,8 @@ class PHPExcel_Worksheet_Protection
* @param boolean $pValue * @param boolean $pValue
* @return PHPExcel_Worksheet_Protection * @return PHPExcel_Worksheet_Protection
*/ */
function setDeleteRows($pValue = false) { function setDeleteRows($pValue = false)
{
$this->_deleteRows = $pValue; $this->_deleteRows = $pValue;
return $this; return $this;
} }
@ -410,7 +433,8 @@ class PHPExcel_Worksheet_Protection
* *
* @return boolean * @return boolean
*/ */
function getSelectLockedCells() { function getSelectLockedCells()
{
return $this->_selectLockedCells; return $this->_selectLockedCells;
} }
@ -420,7 +444,8 @@ class PHPExcel_Worksheet_Protection
* @param boolean $pValue * @param boolean $pValue
* @return PHPExcel_Worksheet_Protection * @return PHPExcel_Worksheet_Protection
*/ */
function setSelectLockedCells($pValue = false) { function setSelectLockedCells($pValue = false)
{
$this->_selectLockedCells = $pValue; $this->_selectLockedCells = $pValue;
return $this; return $this;
} }
@ -430,7 +455,8 @@ class PHPExcel_Worksheet_Protection
* *
* @return boolean * @return boolean
*/ */
function getSort() { function getSort()
{
return $this->_sort; return $this->_sort;
} }
@ -440,7 +466,8 @@ class PHPExcel_Worksheet_Protection
* @param boolean $pValue * @param boolean $pValue
* @return PHPExcel_Worksheet_Protection * @return PHPExcel_Worksheet_Protection
*/ */
function setSort($pValue = false) { function setSort($pValue = false)
{
$this->_sort = $pValue; $this->_sort = $pValue;
return $this; return $this;
} }
@ -450,7 +477,8 @@ class PHPExcel_Worksheet_Protection
* *
* @return boolean * @return boolean
*/ */
function getAutoFilter() { function getAutoFilter()
{
return $this->_autoFilter; return $this->_autoFilter;
} }
@ -460,7 +488,8 @@ class PHPExcel_Worksheet_Protection
* @param boolean $pValue * @param boolean $pValue
* @return PHPExcel_Worksheet_Protection * @return PHPExcel_Worksheet_Protection
*/ */
function setAutoFilter($pValue = false) { function setAutoFilter($pValue = false)
{
$this->_autoFilter = $pValue; $this->_autoFilter = $pValue;
return $this; return $this;
} }
@ -470,7 +499,8 @@ class PHPExcel_Worksheet_Protection
* *
* @return boolean * @return boolean
*/ */
function getPivotTables() { function getPivotTables()
{
return $this->_pivotTables; return $this->_pivotTables;
} }
@ -480,7 +510,8 @@ class PHPExcel_Worksheet_Protection
* @param boolean $pValue * @param boolean $pValue
* @return PHPExcel_Worksheet_Protection * @return PHPExcel_Worksheet_Protection
*/ */
function setPivotTables($pValue = false) { function setPivotTables($pValue = false)
{
$this->_pivotTables = $pValue; $this->_pivotTables = $pValue;
return $this; return $this;
} }
@ -490,7 +521,8 @@ class PHPExcel_Worksheet_Protection
* *
* @return boolean * @return boolean
*/ */
function getSelectUnlockedCells() { function getSelectUnlockedCells()
{
return $this->_selectUnlockedCells; return $this->_selectUnlockedCells;
} }
@ -500,7 +532,8 @@ class PHPExcel_Worksheet_Protection
* @param boolean $pValue * @param boolean $pValue
* @return PHPExcel_Worksheet_Protection * @return PHPExcel_Worksheet_Protection
*/ */
function setSelectUnlockedCells($pValue = false) { function setSelectUnlockedCells($pValue = false)
{
$this->_selectUnlockedCells = $pValue; $this->_selectUnlockedCells = $pValue;
return $this; return $this;
} }
@ -510,7 +543,8 @@ class PHPExcel_Worksheet_Protection
* *
* @return string * @return string
*/ */
function getPassword() { function getPassword()
{
return $this->_password; return $this->_password;
} }
@ -521,7 +555,8 @@ class PHPExcel_Worksheet_Protection
* @param boolean $pAlreadyHashed If the password has already been hashed, set this to true * @param boolean $pAlreadyHashed If the password has already been hashed, set this to true
* @return PHPExcel_Worksheet_Protection * @return PHPExcel_Worksheet_Protection
*/ */
function setPassword($pValue = '', $pAlreadyHashed = false) { function setPassword($pValue = '', $pAlreadyHashed = false)
{
if (!$pAlreadyHashed) { if (!$pAlreadyHashed) {
$pValue = PHPExcel_Shared_PasswordHasher::hashPassword($pValue); $pValue = PHPExcel_Shared_PasswordHasher::hashPassword($pValue);
} }
@ -532,7 +567,8 @@ class PHPExcel_Worksheet_Protection
/** /**
* Implement PHP __clone to create a deep clone, not just a shallow copy. * Implement PHP __clone to create a deep clone, not just a shallow copy.
*/ */
public function __clone() { public function __clone()
{
$vars = get_object_vars($this); $vars = get_object_vars($this);
foreach ($vars as $key => $value) { foreach ($vars as $key => $value) {
if (is_object($value)) { if (is_object($value)) {

View File

@ -65,7 +65,8 @@ abstract class PHPExcel_Writer_Abstract implements PHPExcel_Writer_IWriter
* *
* @return boolean * @return boolean
*/ */
public function getIncludeCharts() { public function getIncludeCharts()
{
return $this->_includeCharts; return $this->_includeCharts;
} }
@ -93,7 +94,8 @@ abstract class PHPExcel_Writer_Abstract implements PHPExcel_Writer_IWriter
* *
* @return boolean * @return boolean
*/ */
public function getPreCalculateFormulas() { public function getPreCalculateFormulas()
{
return $this->_preCalculateFormulas; return $this->_preCalculateFormulas;
} }
@ -105,7 +107,8 @@ abstract class PHPExcel_Writer_Abstract implements PHPExcel_Writer_IWriter
* @param boolean $pValue Pre-Calculate Formulas? * @param boolean $pValue Pre-Calculate Formulas?
* @return PHPExcel_Writer_IWriter * @return PHPExcel_Writer_IWriter
*/ */
public function setPreCalculateFormulas($pValue = TRUE) { public function setPreCalculateFormulas($pValue = true)
{
$this->_preCalculateFormulas = (boolean) $pValue; $this->_preCalculateFormulas = (boolean) $pValue;
return $this; return $this;
} }
@ -115,7 +118,8 @@ abstract class PHPExcel_Writer_Abstract implements PHPExcel_Writer_IWriter
* *
* @return boolean * @return boolean
*/ */
public function getUseDiskCaching() { public function getUseDiskCaching()
{
return $this->_useDiskCaching; return $this->_useDiskCaching;
} }
@ -127,10 +131,11 @@ abstract class PHPExcel_Writer_Abstract implements PHPExcel_Writer_IWriter
* @throws PHPExcel_Writer_Exception when directory does not exist * @throws PHPExcel_Writer_Exception when directory does not exist
* @return PHPExcel_Writer_Excel2007 * @return PHPExcel_Writer_Excel2007
*/ */
public function setUseDiskCaching($pValue = FALSE, $pDirectory = NULL) { public function setUseDiskCaching($pValue = false, $pDirectory = null)
{
$this->_useDiskCaching = $pValue; $this->_useDiskCaching = $pValue;
if ($pDirectory !== NULL) { if ($pDirectory !== null) {
if (is_dir($pDirectory)) { if (is_dir($pDirectory)) {
$this->_diskCachingDirectory = $pDirectory; $this->_diskCachingDirectory = $pDirectory;
} else { } else {
@ -145,7 +150,8 @@ abstract class PHPExcel_Writer_Abstract implements PHPExcel_Writer_IWriter
* *
* @return string * @return string
*/ */
public function getDiskCachingDirectory() { public function getDiskCachingDirectory()
{
return $this->_diskCachingDirectory; return $this->_diskCachingDirectory;
} }
} }

View File

@ -257,7 +257,7 @@ class PHPExcel_Writer_Excel2007 extends PHPExcel_Writer_Abstract implements PHPE
if ($this->_spreadSheet->hasRibbonBinObjects()) { if ($this->_spreadSheet->hasRibbonBinObjects()) {
$tmpRootPath=dirname($tmpRibbonTarget).'/'; $tmpRootPath=dirname($tmpRibbonTarget).'/';
$ribbonBinObjects=$this->_spreadSheet->getRibbonBinObjects('data');//the files to write $ribbonBinObjects=$this->_spreadSheet->getRibbonBinObjects('data');//the files to write
foreach ($ribbonBinObjects as $aPath=>$aContent) { foreach ($ribbonBinObjects as $aPath => $aContent) {
$objZip->addFromString($tmpRootPath.$aPath, $aContent); $objZip->addFromString($tmpRootPath.$aPath, $aContent);
} }
//the rels for files //the rels for files
@ -494,7 +494,7 @@ class PHPExcel_Writer_Excel2007 extends PHPExcel_Writer_Abstract implements PHPE
* *
* @return PHPExcel_HashTable * @return PHPExcel_HashTable
*/ */
public function getNumFmtHashTable() public function getNumFmtHashTable()
{ {
return $this->_numFmtHashTable; return $this->_numFmtHashTable;
} }

View File

@ -32,7 +32,8 @@
* @package PHPExcel_Writer_Excel2007 * @package PHPExcel_Writer_Excel2007
* @copyright Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel) * @copyright Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
*/ */
class PHPExcel_Writer_Excel2007_Chart extends PHPExcel_Writer_Excel2007_WriterPart { class PHPExcel_Writer_Excel2007_Chart extends PHPExcel_Writer_Excel2007_WriterPart
{
/** /**
* Write charts to XML format * Write charts to XML format
* *
@ -41,7 +42,8 @@ class PHPExcel_Writer_Excel2007_Chart extends PHPExcel_Writer_Excel2007_WriterPa
* @return string XML Output * @return string XML Output
* @throws PHPExcel_Writer_Exception * @throws PHPExcel_Writer_Exception
*/ */
public function writeChart(PHPExcel_Chart $pChart = null) { public function writeChart(PHPExcel_Chart $pChart = null)
{
// Create XML writer // Create XML writer
$objWriter = null; $objWriter = null;
if ($this->getParentWriter()->getUseDiskCaching()) { if ($this->getParentWriter()->getUseDiskCaching()) {
@ -115,7 +117,8 @@ class PHPExcel_Writer_Excel2007_Chart extends PHPExcel_Writer_Excel2007_WriterPa
* *
* @throws PHPExcel_Writer_Exception * @throws PHPExcel_Writer_Exception
*/ */
private function _writeTitle(PHPExcel_Chart_Title $title = null, $objWriter) { private function _writeTitle(PHPExcel_Chart_Title $title = null, $objWriter)
{
if (is_null($title)) { if (is_null($title)) {
return; return;
} }
@ -159,7 +162,8 @@ class PHPExcel_Writer_Excel2007_Chart extends PHPExcel_Writer_Excel2007_WriterPa
* *
* @throws PHPExcel_Writer_Exception * @throws PHPExcel_Writer_Exception
*/ */
private function _writeLegend(PHPExcel_Chart_Legend $legend = null, $objWriter) { private function _writeLegend(PHPExcel_Chart_Legend $legend = null, $objWriter)
{
if (is_null($legend)) { if (is_null($legend)) {
return; return;
} }
@ -210,10 +214,10 @@ class PHPExcel_Writer_Excel2007_Chart extends PHPExcel_Writer_Excel2007_WriterPa
* @param PHPExcel_Chart_Axis $xAxis * @param PHPExcel_Chart_Axis $xAxis
* @param PHPExcel_Chart_Axis $yAxis * @param PHPExcel_Chart_Axis $yAxis
* @param PHPExcel_Shared_XMLWriter $objWriter XML Writer * @param PHPExcel_Shared_XMLWriter $objWriter XML Writer
* *
* @throws PHPExcel_Writer_Exception * @throws PHPExcel_Writer_Exception
*/ */
private function _writePlotArea(PHPExcel_Chart_PlotArea $plotArea, PHPExcel_Chart_Title $xAxisLabel = null, PHPExcel_Chart_Title $yAxisLabel = null, $objWriter, PHPExcel_Worksheet $pSheet, PHPExcel_Chart_Axis $xAxis, PHPExcel_Chart_Axis $yAxis, PHPExcel_Chart_GridLines $majorGridlines, PHPExcel_Chart_GridLines $minorGridlines ) private function _writePlotArea(PHPExcel_Chart_PlotArea $plotArea, PHPExcel_Chart_Title $xAxisLabel = null, PHPExcel_Chart_Title $yAxisLabel = null, $objWriter, PHPExcel_Worksheet $pSheet, PHPExcel_Chart_Axis $xAxis, PHPExcel_Chart_Axis $yAxis, PHPExcel_Chart_GridLines $majorGridlines, PHPExcel_Chart_GridLines $minorGridlines)
{ {
if (is_null($plotArea)) { if (is_null($plotArea)) {
return; return;
@ -349,7 +353,8 @@ class PHPExcel_Writer_Excel2007_Chart extends PHPExcel_Writer_Excel2007_WriterPa
* *
* @throws PHPExcel_Writer_Exception * @throws PHPExcel_Writer_Exception
*/ */
private function _writeDataLbls($objWriter, $chartLayout) { private function _writeDataLbls($objWriter, $chartLayout)
{
$objWriter->startElement('c:dLbls'); $objWriter->startElement('c:dLbls');
$objWriter->startElement('c:showLegendKey'); $objWriter->startElement('c:showLegendKey');
@ -403,7 +408,8 @@ class PHPExcel_Writer_Excel2007_Chart extends PHPExcel_Writer_Excel2007_WriterPa
* *
* @throws PHPExcel_Writer_Exception * @throws PHPExcel_Writer_Exception
*/ */
private function _writeCatAx($objWriter, PHPExcel_Chart_PlotArea $plotArea, $xAxisLabel, $groupType, $id1, $id2, $isMultiLevelSeries, $xAxis, $yAxis) { private function _writeCatAx($objWriter, PHPExcel_Chart_PlotArea $plotArea, $xAxisLabel, $groupType, $id1, $id2, $isMultiLevelSeries, $xAxis, $yAxis)
{
$objWriter->startElement('c:catAx'); $objWriter->startElement('c:catAx');
if ($id1 > 0) { if ($id1 > 0) {
@ -524,7 +530,8 @@ class PHPExcel_Writer_Excel2007_Chart extends PHPExcel_Writer_Excel2007_WriterPa
* *
* @throws PHPExcel_Writer_Exception * @throws PHPExcel_Writer_Exception
*/ */
private function _writeValAx($objWriter, PHPExcel_Chart_PlotArea $plotArea, $yAxisLabel, $groupType, $id1, $id2, $isMultiLevelSeries, $xAxis, $yAxis, $majorGridlines, $minorGridlines) { private function _writeValAx($objWriter, PHPExcel_Chart_PlotArea $plotArea, $yAxisLabel, $groupType, $id1, $id2, $isMultiLevelSeries, $xAxis, $yAxis, $majorGridlines, $minorGridlines)
{
$objWriter->startElement('c:valAx'); $objWriter->startElement('c:valAx');
if ($id2 > 0) { if ($id2 > 0) {
@ -1004,7 +1011,8 @@ class PHPExcel_Writer_Excel2007_Chart extends PHPExcel_Writer_Excel2007_WriterPa
* @return string|array * @return string|array
* @throws PHPExcel_Writer_Exception * @throws PHPExcel_Writer_Exception
*/ */
private static function _getChartType($plotArea) { private static function _getChartType($plotArea)
{
$groupCount = $plotArea->getPlotGroupCount(); $groupCount = $plotArea->getPlotGroupCount();
if ($groupCount == 1) { if ($groupCount == 1) {
@ -1036,7 +1044,8 @@ class PHPExcel_Writer_Excel2007_Chart extends PHPExcel_Writer_Excel2007_WriterPa
* *
* @throws PHPExcel_Writer_Exception * @throws PHPExcel_Writer_Exception
*/ */
private function _writePlotGroup($plotGroup, $groupType, $objWriter, &$catIsMultiLevelSeries, &$valIsMultiLevelSeries, &$plotGroupingType, PHPExcel_Worksheet $pSheet ) { private function _writePlotGroup($plotGroup, $groupType, $objWriter, &$catIsMultiLevelSeries, &$valIsMultiLevelSeries, &$plotGroupingType, PHPExcel_Worksheet $pSheet)
{
if (is_null($plotGroup)) { if (is_null($plotGroup)) {
return; return;
} }
@ -1209,7 +1218,8 @@ class PHPExcel_Writer_Excel2007_Chart extends PHPExcel_Writer_Excel2007_WriterPa
* *
* @throws PHPExcel_Writer_Exception * @throws PHPExcel_Writer_Exception
*/ */
private function _writePlotSeriesLabel($plotSeriesLabel, $objWriter) { private function _writePlotSeriesLabel($plotSeriesLabel, $objWriter)
{
if (is_null($plotSeriesLabel)) { if (is_null($plotSeriesLabel)) {
return; return;
} }
@ -1246,7 +1256,8 @@ class PHPExcel_Writer_Excel2007_Chart extends PHPExcel_Writer_Excel2007_WriterPa
* *
* @throws PHPExcel_Writer_Exception * @throws PHPExcel_Writer_Exception
*/ */
private function _writePlotSeriesValues($plotSeriesValues, $objWriter, $groupType, $dataType = 'str', PHPExcel_Worksheet $pSheet) { private function _writePlotSeriesValues($plotSeriesValues, $objWriter, $groupType, $dataType = 'str', PHPExcel_Worksheet $pSheet)
{
if (is_null($plotSeriesValues)) { if (is_null($plotSeriesValues)) {
return; return;
} }
@ -1337,7 +1348,8 @@ class PHPExcel_Writer_Excel2007_Chart extends PHPExcel_Writer_Excel2007_WriterPa
* *
* @throws PHPExcel_Writer_Exception * @throws PHPExcel_Writer_Exception
*/ */
private function _writeBubbles($plotSeriesValues, $objWriter, PHPExcel_Worksheet $pSheet) { private function _writeBubbles($plotSeriesValues, $objWriter, PHPExcel_Worksheet $pSheet)
{
if (is_null($plotSeriesValues)) { if (is_null($plotSeriesValues)) {
return; return;
} }
@ -1383,7 +1395,8 @@ class PHPExcel_Writer_Excel2007_Chart extends PHPExcel_Writer_Excel2007_WriterPa
* *
* @throws PHPExcel_Writer_Exception * @throws PHPExcel_Writer_Exception
*/ */
private function _writeLayout(PHPExcel_Chart_Layout $layout = null, $objWriter) { private function _writeLayout(PHPExcel_Chart_Layout $layout = null, $objWriter)
{
$objWriter->startElement('c:layout'); $objWriter->startElement('c:layout');
if (!is_null($layout)) { if (!is_null($layout)) {
@ -1451,7 +1464,8 @@ class PHPExcel_Writer_Excel2007_Chart extends PHPExcel_Writer_Excel2007_WriterPa
* *
* @throws PHPExcel_Writer_Exception * @throws PHPExcel_Writer_Exception
*/ */
private function _writeAlternateContent($objWriter) { private function _writeAlternateContent($objWriter)
{
$objWriter->startElement('mc:AlternateContent'); $objWriter->startElement('mc:AlternateContent');
$objWriter->writeAttribute('xmlns:mc', 'http://schemas.openxmlformats.org/markup-compatibility/2006'); $objWriter->writeAttribute('xmlns:mc', 'http://schemas.openxmlformats.org/markup-compatibility/2006');
@ -1480,7 +1494,8 @@ class PHPExcel_Writer_Excel2007_Chart extends PHPExcel_Writer_Excel2007_WriterPa
* *
* @throws PHPExcel_Writer_Exception * @throws PHPExcel_Writer_Exception
*/ */
private function _writePrintSettings($objWriter) { private function _writePrintSettings($objWriter)
{
$objWriter->startElement('c:printSettings'); $objWriter->startElement('c:printSettings');
$objWriter->startElement('c:headerFooter'); $objWriter->startElement('c:headerFooter');

View File

@ -71,19 +71,19 @@ class PHPExcel_Writer_Excel2007_Comments extends PHPExcel_Writer_Excel2007_Write
$objWriter->startElement('comments'); $objWriter->startElement('comments');
$objWriter->writeAttribute('xmlns', 'http://schemas.openxmlformats.org/spreadsheetml/2006/main'); $objWriter->writeAttribute('xmlns', 'http://schemas.openxmlformats.org/spreadsheetml/2006/main');
// Loop through authors // Loop through authors
$objWriter->startElement('authors'); $objWriter->startElement('authors');
foreach ($authors as $author => $index) { foreach ($authors as $author => $index) {
$objWriter->writeElement('author', $author); $objWriter->writeElement('author', $author);
} }
$objWriter->endElement(); $objWriter->endElement();
// Loop through comments // Loop through comments
$objWriter->startElement('commentList'); $objWriter->startElement('commentList');
foreach ($comments as $key => $value) { foreach ($comments as $key => $value) {
$this->_writeComment($objWriter, $key, $value, $authors); $this->_writeComment($objWriter, $key, $value, $authors);
} }
$objWriter->endElement(); $objWriter->endElement();
$objWriter->endElement(); $objWriter->endElement();
@ -104,13 +104,13 @@ class PHPExcel_Writer_Excel2007_Comments extends PHPExcel_Writer_Excel2007_Write
{ {
// comment // comment
$objWriter->startElement('comment'); $objWriter->startElement('comment');
$objWriter->writeAttribute('ref', $pCellReference); $objWriter->writeAttribute('ref', $pCellReference);
$objWriter->writeAttribute('authorId', $pAuthors[$pComment->getAuthor()]); $objWriter->writeAttribute('authorId', $pAuthors[$pComment->getAuthor()]);
// text // text
$objWriter->startElement('text'); $objWriter->startElement('text');
$this->getParentWriter()->getWriterPart('stringtable')->writeRichText($objWriter, $pComment->getText()); $this->getParentWriter()->getWriterPart('stringtable')->writeRichText($objWriter, $pComment->getText());
$objWriter->endElement(); $objWriter->endElement();
$objWriter->endElement(); $objWriter->endElement();
} }
@ -144,42 +144,42 @@ class PHPExcel_Writer_Excel2007_Comments extends PHPExcel_Writer_Excel2007_Write
$objWriter->writeAttribute('xmlns:o', 'urn:schemas-microsoft-com:office:office'); $objWriter->writeAttribute('xmlns:o', 'urn:schemas-microsoft-com:office:office');
$objWriter->writeAttribute('xmlns:x', 'urn:schemas-microsoft-com:office:excel'); $objWriter->writeAttribute('xmlns:x', 'urn:schemas-microsoft-com:office:excel');
// o:shapelayout // o:shapelayout
$objWriter->startElement('o:shapelayout'); $objWriter->startElement('o:shapelayout');
$objWriter->writeAttribute('v:ext', 'edit'); $objWriter->writeAttribute('v:ext', 'edit');
// o:idmap
$objWriter->startElement('o:idmap');
$objWriter->writeAttribute('v:ext', 'edit');
$objWriter->writeAttribute('data', '1');
$objWriter->endElement();
// o:idmap
$objWriter->startElement('o:idmap');
$objWriter->writeAttribute('v:ext', 'edit');
$objWriter->writeAttribute('data', '1');
$objWriter->endElement(); $objWriter->endElement();
// v:shapetype $objWriter->endElement();
$objWriter->startElement('v:shapetype');
$objWriter->writeAttribute('id', '_x0000_t202');
$objWriter->writeAttribute('coordsize', '21600,21600');
$objWriter->writeAttribute('o:spt', '202');
$objWriter->writeAttribute('path', 'm,l,21600r21600,l21600,xe');
// v:stroke // v:shapetype
$objWriter->startElement('v:stroke'); $objWriter->startElement('v:shapetype');
$objWriter->writeAttribute('joinstyle', 'miter'); $objWriter->writeAttribute('id', '_x0000_t202');
$objWriter->endElement(); $objWriter->writeAttribute('coordsize', '21600,21600');
$objWriter->writeAttribute('o:spt', '202');
// v:path $objWriter->writeAttribute('path', 'm,l,21600r21600,l21600,xe');
$objWriter->startElement('v:path');
$objWriter->writeAttribute('gradientshapeok', 't');
$objWriter->writeAttribute('o:connecttype', 'rect');
$objWriter->endElement();
// v:stroke
$objWriter->startElement('v:stroke');
$objWriter->writeAttribute('joinstyle', 'miter');
$objWriter->endElement(); $objWriter->endElement();
// Loop through comments // v:path
foreach ($comments as $key => $value) { $objWriter->startElement('v:path');
$this->_writeVMLComment($objWriter, $key, $value); $objWriter->writeAttribute('gradientshapeok', 't');
} $objWriter->writeAttribute('o:connecttype', 'rect');
$objWriter->endElement();
$objWriter->endElement();
// Loop through comments
foreach ($comments as $key => $value) {
$this->_writeVMLComment($objWriter, $key, $value);
}
$objWriter->endElement(); $objWriter->endElement();
@ -205,22 +205,22 @@ class PHPExcel_Writer_Excel2007_Comments extends PHPExcel_Writer_Excel2007_Write
// v:shape // v:shape
$objWriter->startElement('v:shape'); $objWriter->startElement('v:shape');
$objWriter->writeAttribute('id', '_x0000_s' . $id); $objWriter->writeAttribute('id', '_x0000_s' . $id);
$objWriter->writeAttribute('type', '#_x0000_t202'); $objWriter->writeAttribute('type', '#_x0000_t202');
$objWriter->writeAttribute('style', 'position:absolute;margin-left:' . $pComment->getMarginLeft() . ';margin-top:' . $pComment->getMarginTop() . ';width:' . $pComment->getWidth() . ';height:' . $pComment->getHeight() . ';z-index:1;visibility:' . ($pComment->getVisible() ? 'visible' : 'hidden')); $objWriter->writeAttribute('style', 'position:absolute;margin-left:' . $pComment->getMarginLeft() . ';margin-top:' . $pComment->getMarginTop() . ';width:' . $pComment->getWidth() . ';height:' . $pComment->getHeight() . ';z-index:1;visibility:' . ($pComment->getVisible() ? 'visible' : 'hidden'));
$objWriter->writeAttribute('fillcolor', '#' . $pComment->getFillColor()->getRGB()); $objWriter->writeAttribute('fillcolor', '#' . $pComment->getFillColor()->getRGB());
$objWriter->writeAttribute('o:insetmode', 'auto'); $objWriter->writeAttribute('o:insetmode', 'auto');
// v:fill // v:fill
$objWriter->startElement('v:fill'); $objWriter->startElement('v:fill');
$objWriter->writeAttribute('color2', '#' . $pComment->getFillColor()->getRGB()); $objWriter->writeAttribute('color2', '#' . $pComment->getFillColor()->getRGB());
$objWriter->endElement(); $objWriter->endElement();
// v:shadow // v:shadow
$objWriter->startElement('v:shadow'); $objWriter->startElement('v:shadow');
$objWriter->writeAttribute('on', 't'); $objWriter->writeAttribute('on', 't');
$objWriter->writeAttribute('color', 'black'); $objWriter->writeAttribute('color', 'black');
$objWriter->writeAttribute('obscured', 't'); $objWriter->writeAttribute('obscured', 't');
$objWriter->endElement(); $objWriter->endElement();
// v:path // v:path

View File

@ -60,125 +60,126 @@ class PHPExcel_Writer_Excel2007_ContentTypes extends PHPExcel_Writer_Excel2007_W
$objWriter->startElement('Types'); $objWriter->startElement('Types');
$objWriter->writeAttribute('xmlns', 'http://schemas.openxmlformats.org/package/2006/content-types'); $objWriter->writeAttribute('xmlns', 'http://schemas.openxmlformats.org/package/2006/content-types');
// Theme // Theme
$this->_writeOverrideContentType($objWriter, '/xl/theme/theme1.xml', 'application/vnd.openxmlformats-officedocument.theme+xml'); $this->_writeOverrideContentType($objWriter, '/xl/theme/theme1.xml', 'application/vnd.openxmlformats-officedocument.theme+xml');
// Styles // Styles
$this->_writeOverrideContentType($objWriter, '/xl/styles.xml', 'application/vnd.openxmlformats-officedocument.spreadsheetml.styles+xml'); $this->_writeOverrideContentType($objWriter, '/xl/styles.xml', 'application/vnd.openxmlformats-officedocument.spreadsheetml.styles+xml');
// Rels // Rels
$this->_writeDefaultContentType($objWriter, 'rels', 'application/vnd.openxmlformats-package.relationships+xml'); $this->_writeDefaultContentType($objWriter, 'rels', 'application/vnd.openxmlformats-package.relationships+xml');
// XML // XML
$this->_writeDefaultContentType($objWriter, 'xml', 'application/xml'); $this->_writeDefaultContentType($objWriter, 'xml', 'application/xml');
// VML // VML
$this->_writeDefaultContentType($objWriter, 'vml', 'application/vnd.openxmlformats-officedocument.vmlDrawing'); $this->_writeDefaultContentType($objWriter, 'vml', 'application/vnd.openxmlformats-officedocument.vmlDrawing');
// Workbook // Workbook
if ($pPHPExcel->hasMacros()) { //Macros in workbook ? if ($pPHPExcel->hasMacros()) { //Macros in workbook ?
// Yes : not standard content but "macroEnabled" // Yes : not standard content but "macroEnabled"
$this->_writeOverrideContentType($objWriter, '/xl/workbook.xml', 'application/vnd.ms-excel.sheet.macroEnabled.main+xml'); $this->_writeOverrideContentType($objWriter, '/xl/workbook.xml', 'application/vnd.ms-excel.sheet.macroEnabled.main+xml');
//... and define a new type for the VBA project //... and define a new type for the VBA project
$this->_writeDefaultContentType($objWriter, 'bin', 'application/vnd.ms-office.vbaProject'); $this->_writeDefaultContentType($objWriter, 'bin', 'application/vnd.ms-office.vbaProject');
if ($pPHPExcel->hasMacrosCertificate()) {// signed macros ? if ($pPHPExcel->hasMacrosCertificate()) {// signed macros ?
// Yes : add needed information // Yes : add needed information
$this->_writeOverrideContentType($objWriter, '/xl/vbaProjectSignature.bin', 'application/vnd.ms-office.vbaProjectSignature'); $this->_writeOverrideContentType($objWriter, '/xl/vbaProjectSignature.bin', 'application/vnd.ms-office.vbaProjectSignature');
}
} else {// no macros in workbook, so standard type
$this->_writeOverrideContentType($objWriter, '/xl/workbook.xml', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet.main+xml');
}
// DocProps
$this->_writeOverrideContentType($objWriter, '/docProps/app.xml', 'application/vnd.openxmlformats-officedocument.extended-properties+xml');
$this->_writeOverrideContentType($objWriter, '/docProps/core.xml', 'application/vnd.openxmlformats-package.core-properties+xml');
$customPropertyList = $pPHPExcel->getProperties()->getCustomProperties();
if (!empty($customPropertyList)) {
$this->_writeOverrideContentType($objWriter, '/docProps/custom.xml', 'application/vnd.openxmlformats-officedocument.custom-properties+xml');
}
// Worksheets
$sheetCount = $pPHPExcel->getSheetCount();
for ($i = 0; $i < $sheetCount; ++$i) {
$this->_writeOverrideContentType($objWriter, '/xl/worksheets/sheet' . ($i + 1) . '.xml', 'application/vnd.openxmlformats-officedocument.spreadsheetml.worksheet+xml');
}
// Shared strings
$this->_writeOverrideContentType($objWriter, '/xl/sharedStrings.xml', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sharedStrings+xml');
// Add worksheet relationship content types
$chart = 1;
for ($i = 0; $i < $sheetCount; ++$i) {
$drawings = $pPHPExcel->getSheet($i)->getDrawingCollection();
$drawingCount = count($drawings);
$chartCount = ($includeCharts) ? $pPHPExcel->getSheet($i)->getChartCount() : 0;
// We need a drawing relationship for the worksheet if we have either drawings or charts
if (($drawingCount > 0) || ($chartCount > 0)) {
$this->_writeOverrideContentType($objWriter, '/xl/drawings/drawing' . ($i + 1) . '.xml', 'application/vnd.openxmlformats-officedocument.drawing+xml');
}
// If we have charts, then we need a chart relationship for every individual chart
if ($chartCount > 0) {
for ($c = 0; $c < $chartCount; ++$c) {
$this->_writeOverrideContentType($objWriter, '/xl/charts/chart' . $chart++ . '.xml', 'application/vnd.openxmlformats-officedocument.drawingml.chart+xml');
} }
} else {// no macros in workbook, so standard type }
$this->_writeOverrideContentType($objWriter, '/xl/workbook.xml', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet.main+xml'); }
// Comments
for ($i = 0; $i < $sheetCount; ++$i) {
if (count($pPHPExcel->getSheet($i)->getComments()) > 0) {
$this->_writeOverrideContentType($objWriter, '/xl/comments' . ($i + 1) . '.xml', 'application/vnd.openxmlformats-officedocument.spreadsheetml.comments+xml');
}
}
// Add media content-types
$aMediaContentTypes = array();
$mediaCount = $this->getParentWriter()->getDrawingHashTable()->count();
for ($i = 0; $i < $mediaCount; ++$i) {
$extension = '';
$mimeType = '';
if ($this->getParentWriter()->getDrawingHashTable()->getByIndex($i) instanceof PHPExcel_Worksheet_Drawing) {
$extension = strtolower($this->getParentWriter()->getDrawingHashTable()->getByIndex($i)->getExtension());
$mimeType = $this->_getImageMimeType( $this->getParentWriter()->getDrawingHashTable()->getByIndex($i)->getPath());
} else if ($this->getParentWriter()->getDrawingHashTable()->getByIndex($i) instanceof PHPExcel_Worksheet_MemoryDrawing) {
$extension = strtolower($this->getParentWriter()->getDrawingHashTable()->getByIndex($i)->getMimeType());
$extension = explode('/', $extension);
$extension = $extension[1];
$mimeType = $this->getParentWriter()->getDrawingHashTable()->getByIndex($i)->getMimeType();
} }
// DocProps if (!isset( $aMediaContentTypes[$extension])) {
$this->_writeOverrideContentType($objWriter, '/docProps/app.xml', 'application/vnd.openxmlformats-officedocument.extended-properties+xml'); $aMediaContentTypes[$extension] = $mimeType;
$this->_writeOverrideContentType($objWriter, '/docProps/core.xml', 'application/vnd.openxmlformats-package.core-properties+xml'); $this->_writeDefaultContentType($objWriter, $extension, $mimeType);
$customPropertyList = $pPHPExcel->getProperties()->getCustomProperties();
if (!empty($customPropertyList)) {
$this->_writeOverrideContentType($objWriter, '/docProps/custom.xml', 'application/vnd.openxmlformats-officedocument.custom-properties+xml');
} }
}
// Worksheets if ($pPHPExcel->hasRibbonBinObjects()) {
$sheetCount = $pPHPExcel->getSheetCount(); // Some additional objects in the ribbon ?
for ($i = 0; $i < $sheetCount; ++$i) { // we need to write "Extension" but not already write for media content
$this->_writeOverrideContentType($objWriter, '/xl/worksheets/sheet' . ($i + 1) . '.xml', 'application/vnd.openxmlformats-officedocument.spreadsheetml.worksheet+xml'); $tabRibbonTypes=array_diff($pPHPExcel->getRibbonBinObjects('types'), array_keys($aMediaContentTypes));
foreach ($tabRibbonTypes as $aRibbonType) {
$mimeType='image/.'.$aRibbonType;//we wrote $mimeType like customUI Editor
$this->_writeDefaultContentType($objWriter, $aRibbonType, $mimeType);
} }
}
$sheetCount = $pPHPExcel->getSheetCount();
for ($i = 0; $i < $sheetCount; ++$i) {
if (count($pPHPExcel->getSheet()->getHeaderFooter()->getImages()) > 0) {
foreach ($pPHPExcel->getSheet()->getHeaderFooter()->getImages() as $image) {
if (!isset( $aMediaContentTypes[strtolower($image->getExtension())])) {
$aMediaContentTypes[strtolower($image->getExtension())] = $this->_getImageMimeType($image->getPath());
// Shared strings $this->_writeDefaultContentType($objWriter, strtolower($image->getExtension()), $aMediaContentTypes[strtolower($image->getExtension())]);
$this->_writeOverrideContentType($objWriter, '/xl/sharedStrings.xml', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sharedStrings+xml');
// Add worksheet relationship content types
$chart = 1;
for ($i = 0; $i < $sheetCount; ++$i) {
$drawings = $pPHPExcel->getSheet($i)->getDrawingCollection();
$drawingCount = count($drawings);
$chartCount = ($includeCharts) ? $pPHPExcel->getSheet($i)->getChartCount() : 0;
// We need a drawing relationship for the worksheet if we have either drawings or charts
if (($drawingCount > 0) || ($chartCount > 0)) {
$this->_writeOverrideContentType($objWriter, '/xl/drawings/drawing' . ($i + 1) . '.xml', 'application/vnd.openxmlformats-officedocument.drawing+xml');
}
// If we have charts, then we need a chart relationship for every individual chart
if ($chartCount > 0) {
for ($c = 0; $c < $chartCount; ++$c) {
$this->_writeOverrideContentType($objWriter, '/xl/charts/chart' . $chart++ . '.xml', 'application/vnd.openxmlformats-officedocument.drawingml.chart+xml');
}
}
}
// Comments
for ($i = 0; $i < $sheetCount; ++$i) {
if (count($pPHPExcel->getSheet($i)->getComments()) > 0) {
$this->_writeOverrideContentType($objWriter, '/xl/comments' . ($i + 1) . '.xml', 'application/vnd.openxmlformats-officedocument.spreadsheetml.comments+xml');
}
}
// Add media content-types
$aMediaContentTypes = array();
$mediaCount = $this->getParentWriter()->getDrawingHashTable()->count();
for ($i = 0; $i < $mediaCount; ++$i) {
$extension = '';
$mimeType = '';
if ($this->getParentWriter()->getDrawingHashTable()->getByIndex($i) instanceof PHPExcel_Worksheet_Drawing) {
$extension = strtolower($this->getParentWriter()->getDrawingHashTable()->getByIndex($i)->getExtension());
$mimeType = $this->_getImageMimeType( $this->getParentWriter()->getDrawingHashTable()->getByIndex($i)->getPath() );
} else if ($this->getParentWriter()->getDrawingHashTable()->getByIndex($i) instanceof PHPExcel_Worksheet_MemoryDrawing) {
$extension = strtolower($this->getParentWriter()->getDrawingHashTable()->getByIndex($i)->getMimeType());
$extension = explode('/', $extension);
$extension = $extension[1];
$mimeType = $this->getParentWriter()->getDrawingHashTable()->getByIndex($i)->getMimeType();
}
if (!isset( $aMediaContentTypes[$extension]) ) {
$aMediaContentTypes[$extension] = $mimeType;
$this->_writeDefaultContentType($objWriter, $extension, $mimeType);
}
}
if ($pPHPExcel->hasRibbonBinObjects()) {//Some additional objects in the ribbon ?
//we need to write "Extension" but not already write for media content
$tabRibbonTypes=array_diff($pPHPExcel->getRibbonBinObjects('types'), array_keys($aMediaContentTypes));
foreach ($tabRibbonTypes as $aRibbonType) {
$mimeType='image/.'.$aRibbonType;//we wrote $mimeType like customUI Editor
$this->_writeDefaultContentType($objWriter, $aRibbonType, $mimeType);
}
}
$sheetCount = $pPHPExcel->getSheetCount();
for ($i = 0; $i < $sheetCount; ++$i) {
if (count($pPHPExcel->getSheet()->getHeaderFooter()->getImages()) > 0) {
foreach ($pPHPExcel->getSheet()->getHeaderFooter()->getImages() as $image) {
if (!isset( $aMediaContentTypes[strtolower($image->getExtension())])) {
$aMediaContentTypes[strtolower($image->getExtension())] = $this->_getImageMimeType($image->getPath());
$this->_writeDefaultContentType($objWriter, strtolower($image->getExtension()), $aMediaContentTypes[strtolower($image->getExtension())]);
}
} }
} }
} }
}
$objWriter->endElement(); $objWriter->endElement();

View File

@ -231,7 +231,7 @@ class PHPExcel_Writer_Excel2007_Worksheet extends PHPExcel_Writer_Excel2007_Writ
// View Layout Type // View Layout Type
if ($pSheet->getSheetView()->getView() !== PHPExcel_Worksheet_SheetView::SHEETVIEW_NORMAL) { if ($pSheet->getSheetView()->getView() !== PHPExcel_Worksheet_SheetView::SHEETVIEW_NORMAL) {
$objWriter->writeAttribute('view', $pSheet->getSheetView()->getView()); $objWriter->writeAttribute('view', $pSheet->getSheetView()->getView());
} }
// Gridlines // Gridlines
@ -294,15 +294,15 @@ class PHPExcel_Writer_Excel2007_Worksheet extends PHPExcel_Writer_Excel2007_Writ
// Selection // Selection
// if ($pane != '') { // if ($pane != '') {
// Only need to write selection element if we have a split pane // Only need to write selection element if we have a split pane
// We cheat a little by over-riding the active cell selection, setting it to the split cell // We cheat a little by over-riding the active cell selection, setting it to the split cell
$objWriter->startElement('selection'); $objWriter->startElement('selection');
if ($pane != '') { if ($pane != '') {
$objWriter->writeAttribute('pane', $pane); $objWriter->writeAttribute('pane', $pane);
} }
$objWriter->writeAttribute('activeCell', $activeCell); $objWriter->writeAttribute('activeCell', $activeCell);
$objWriter->writeAttribute('sqref', $activeCell); $objWriter->writeAttribute('sqref', $activeCell);
$objWriter->endElement(); $objWriter->endElement();
// } // }
$objWriter->endElement(); $objWriter->endElement();
@ -760,7 +760,7 @@ class PHPExcel_Writer_Excel2007_Worksheet extends PHPExcel_Writer_Excel2007_Writ
$range = PHPExcel_Cell::splitRange($autoFilterRange); $range = PHPExcel_Cell::splitRange($autoFilterRange);
$range = $range[0]; $range = $range[0];
// Strip any worksheet ref // Strip any worksheet ref
if (strpos($range[0],'!') !== false) { if (strpos($range[0], '!') !== false) {
list($ws, $range[0]) = explode('!', $range[0]); list($ws, $range[0]) = explode('!', $range[0]);
} }
$range = implode(':', $range); $range = implode(':', $range);
@ -785,7 +785,7 @@ class PHPExcel_Writer_Excel2007_Worksheet extends PHPExcel_Writer_Excel2007_Writ
($rule->getOperator() === PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_COLUMN_RULE_EQUAL) && ($rule->getOperator() === PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_COLUMN_RULE_EQUAL) &&
($rule->getValue() === '')) { ($rule->getValue() === '')) {
// Filter rule for Blanks // Filter rule for Blanks
$objWriter->writeAttribute('blank', 1); $objWriter->writeAttribute('blank', 1);
} elseif ($rule->getRuleType() === PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DYNAMICFILTER) { } elseif ($rule->getRuleType() === PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DYNAMICFILTER) {
// Dynamic Filter Rule // Dynamic Filter Rule
$objWriter->writeAttribute('type', $rule->getGrouping()); $objWriter->writeAttribute('type', $rule->getGrouping());
@ -812,7 +812,9 @@ class PHPExcel_Writer_Excel2007_Worksheet extends PHPExcel_Writer_Excel2007_Writ
if ($rule->getRuleType() === PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DATEGROUP) { if ($rule->getRuleType() === PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DATEGROUP) {
// Date Group filters // Date Group filters
foreach ($rule->getValue() as $key => $value) { foreach ($rule->getValue() as $key => $value) {
if ($value > '') $objWriter->writeAttribute($key, $value); if ($value > '') {
$objWriter->writeAttribute($key, $value);
}
} }
$objWriter->writeAttribute('dateTimeGrouping', $rule->getGrouping()); $objWriter->writeAttribute('dateTimeGrouping', $rule->getGrouping());
} else { } else {