diff --git a/src/PhpSpreadsheet/Calculation.php b/src/PhpSpreadsheet/Calculation.php index 1a9cf14a..4660aa9a 100644 --- a/src/PhpSpreadsheet/Calculation.php +++ b/src/PhpSpreadsheet/Calculation.php @@ -232,7 +232,7 @@ class Calculation 'NULL' => null, ]; - // PhpSpreadsheet functions + // PhpSpreadsheet functions private static $phpSpreadsheetFunctions = [ 'ABS' => [ 'category' => Calculation\Categories::CATEGORY_MATH_AND_TRIG, @@ -3073,13 +3073,13 @@ class Calculation $pCellParent = ($pCell !== null) ? $pCell->getWorksheet() : null; $regexpMatchString = '/^(' . self::CALCULATION_REGEXP_FUNCTION . - '|' . self::CALCULATION_REGEXP_CELLREF . - '|' . self::CALCULATION_REGEXP_NUMBER . - '|' . self::CALCULATION_REGEXP_STRING . - '|' . self::CALCULATION_REGEXP_OPENBRACE . - '|' . self::CALCULATION_REGEXP_NAMEDRANGE . - '|' . self::CALCULATION_REGEXP_ERROR . - ')/si'; + '|' . self::CALCULATION_REGEXP_CELLREF . + '|' . self::CALCULATION_REGEXP_NUMBER . + '|' . self::CALCULATION_REGEXP_STRING . + '|' . self::CALCULATION_REGEXP_OPENBRACE . + '|' . self::CALCULATION_REGEXP_NAMEDRANGE . + '|' . self::CALCULATION_REGEXP_ERROR . + ')/si'; // Start with initialisation $index = 0; diff --git a/src/PhpSpreadsheet/Calculation/FormulaParser.php b/src/PhpSpreadsheet/Calculation/FormulaParser.php index f3c15b2d..f045d27f 100644 --- a/src/PhpSpreadsheet/Calculation/FormulaParser.php +++ b/src/PhpSpreadsheet/Calculation/FormulaParser.php @@ -497,7 +497,7 @@ class FormulaParser (($previousToken->getTokenType() == FormulaToken::TOKEN_TYPE_FUNCTION) && ($previousToken->getTokenSubType() == FormulaToken::TOKEN_SUBTYPE_STOP)) || (($previousToken->getTokenType() == FormulaToken::TOKEN_TYPE_SUBEXPRESSION) && ($previousToken->getTokenSubType() == FormulaToken::TOKEN_SUBTYPE_STOP)) || ($previousToken->getTokenType() == FormulaToken::TOKEN_TYPE_OPERAND) - )) { + )) { continue; } @@ -509,7 +509,7 @@ class FormulaParser (($nextToken->getTokenType() == FormulaToken::TOKEN_TYPE_FUNCTION) && ($nextToken->getTokenSubType() == FormulaToken::TOKEN_SUBTYPE_START)) || (($nextToken->getTokenType() == FormulaToken::TOKEN_TYPE_SUBEXPRESSION) && ($nextToken->getTokenSubType() == FormulaToken::TOKEN_SUBTYPE_START)) || ($nextToken->getTokenType() == FormulaToken::TOKEN_TYPE_OPERAND) - )) { + )) { continue; } diff --git a/src/PhpSpreadsheet/Cell.php b/src/PhpSpreadsheet/Cell.php index 3a22d18f..66569903 100644 --- a/src/PhpSpreadsheet/Cell.php +++ b/src/PhpSpreadsheet/Cell.php @@ -845,11 +845,11 @@ class Cell $_indexCache[$pColumnIndex] = chr(65 + $pColumnIndex); } elseif ($pColumnIndex < 702) { $_indexCache[$pColumnIndex] = chr(64 + ($pColumnIndex / 26)) . - chr(65 + $pColumnIndex % 26); + chr(65 + $pColumnIndex % 26); } else { $_indexCache[$pColumnIndex] = chr(64 + (($pColumnIndex - 26) / 676)) . - chr(65 + ((($pColumnIndex - 26) % 676) / 26)) . - chr(65 + $pColumnIndex % 26); + chr(65 + ((($pColumnIndex - 26) % 676) / 26)) . + chr(65 + $pColumnIndex % 26); } } diff --git a/src/PhpSpreadsheet/Chart/GridLines.php b/src/PhpSpreadsheet/Chart/GridLines.php index 57bdc219..09992499 100644 --- a/src/PhpSpreadsheet/Chart/GridLines.php +++ b/src/PhpSpreadsheet/Chart/GridLines.php @@ -76,7 +76,7 @@ class GridLines extends Properties private $softEdges = [ 'size' => null, - ]; + ]; /** * Get Object State diff --git a/src/PhpSpreadsheet/Reader/CSV.php b/src/PhpSpreadsheet/Reader/CSV.php index 595ffe27..0bb70c1b 100644 --- a/src/PhpSpreadsheet/Reader/CSV.php +++ b/src/PhpSpreadsheet/Reader/CSV.php @@ -253,9 +253,10 @@ class CSV extends BaseReader implements IReader } $sheet = $spreadsheet->setActiveSheetIndex($this->sheetIndex); - $escapeEnclosures = ['\\' . $this->enclosure, - $this->enclosure . $this->enclosure, - ]; + $escapeEnclosures = [ + '\\' . $this->enclosure, + $this->enclosure . $this->enclosure, + ]; // Set our starting row based on whether we're in contiguous mode or not $currentRow = 1; diff --git a/src/PhpSpreadsheet/ReferenceHelper.php b/src/PhpSpreadsheet/ReferenceHelper.php index ba46a486..16bfca8b 100644 --- a/src/PhpSpreadsheet/ReferenceHelper.php +++ b/src/PhpSpreadsheet/ReferenceHelper.php @@ -446,7 +446,7 @@ class ReferenceHelper if ($cell->getDataType() == Cell\DataType::TYPE_FORMULA) { // Formula should be adjusted $pSheet->getCell($newCoordinates) - ->setValue($this->updateFormulaReferences($cell->getValue(), $pBefore, $pNumCols, $pNumRows, $pSheet->getTitle())); + ->setValue($this->updateFormulaReferences($cell->getValue(), $pBefore, $pNumCols, $pNumRows, $pSheet->getTitle())); } else { // Formula should not be adjusted $pSheet->getCell($newCoordinates)->setValue($cell->getValue()); diff --git a/src/PhpSpreadsheet/Shared/Font.php b/src/PhpSpreadsheet/Shared/Font.php index 5cb43ee2..363dc806 100644 --- a/src/PhpSpreadsheet/Shared/Font.php +++ b/src/PhpSpreadsheet/Shared/Font.php @@ -143,40 +143,40 @@ class Font */ public static $defaultColumnWidths = [ 'Arial' => [ - 1 => ['px' => 24, 'width' => 12.00000000], - 2 => ['px' => 24, 'width' => 12.00000000], - 3 => ['px' => 32, 'width' => 10.66406250], - 4 => ['px' => 32, 'width' => 10.66406250], - 5 => ['px' => 40, 'width' => 10.00000000], - 6 => ['px' => 48, 'width' => 9.59765625], - 7 => ['px' => 48, 'width' => 9.59765625], - 8 => ['px' => 56, 'width' => 9.33203125], - 9 => ['px' => 64, 'width' => 9.14062500], + 1 => ['px' => 24, 'width' => 12.00000000], + 2 => ['px' => 24, 'width' => 12.00000000], + 3 => ['px' => 32, 'width' => 10.66406250], + 4 => ['px' => 32, 'width' => 10.66406250], + 5 => ['px' => 40, 'width' => 10.00000000], + 6 => ['px' => 48, 'width' => 9.59765625], + 7 => ['px' => 48, 'width' => 9.59765625], + 8 => ['px' => 56, 'width' => 9.33203125], + 9 => ['px' => 64, 'width' => 9.14062500], 10 => ['px' => 64, 'width' => 9.14062500], ], 'Calibri' => [ - 1 => ['px' => 24, 'width' => 12.00000000], - 2 => ['px' => 24, 'width' => 12.00000000], - 3 => ['px' => 32, 'width' => 10.66406250], - 4 => ['px' => 32, 'width' => 10.66406250], - 5 => ['px' => 40, 'width' => 10.00000000], - 6 => ['px' => 48, 'width' => 9.59765625], - 7 => ['px' => 48, 'width' => 9.59765625], - 8 => ['px' => 56, 'width' => 9.33203125], - 9 => ['px' => 56, 'width' => 9.33203125], + 1 => ['px' => 24, 'width' => 12.00000000], + 2 => ['px' => 24, 'width' => 12.00000000], + 3 => ['px' => 32, 'width' => 10.66406250], + 4 => ['px' => 32, 'width' => 10.66406250], + 5 => ['px' => 40, 'width' => 10.00000000], + 6 => ['px' => 48, 'width' => 9.59765625], + 7 => ['px' => 48, 'width' => 9.59765625], + 8 => ['px' => 56, 'width' => 9.33203125], + 9 => ['px' => 56, 'width' => 9.33203125], 10 => ['px' => 64, 'width' => 9.14062500], 11 => ['px' => 64, 'width' => 9.14062500], ], 'Verdana' => [ - 1 => ['px' => 24, 'width' => 12.00000000], - 2 => ['px' => 24, 'width' => 12.00000000], - 3 => ['px' => 32, 'width' => 10.66406250], - 4 => ['px' => 32, 'width' => 10.66406250], - 5 => ['px' => 40, 'width' => 10.00000000], - 6 => ['px' => 48, 'width' => 9.59765625], - 7 => ['px' => 48, 'width' => 9.59765625], - 8 => ['px' => 64, 'width' => 9.14062500], - 9 => ['px' => 72, 'width' => 9.00000000], + 1 => ['px' => 24, 'width' => 12.00000000], + 2 => ['px' => 24, 'width' => 12.00000000], + 3 => ['px' => 32, 'width' => 10.66406250], + 4 => ['px' => 32, 'width' => 10.66406250], + 5 => ['px' => 40, 'width' => 10.00000000], + 6 => ['px' => 48, 'width' => 9.59765625], + 7 => ['px' => 48, 'width' => 9.59765625], + 8 => ['px' => 64, 'width' => 9.14062500], + 9 => ['px' => 72, 'width' => 9.00000000], 10 => ['px' => 72, 'width' => 9.00000000], ], ]; diff --git a/src/PhpSpreadsheet/Shared/PCLZip/PclZip.php b/src/PhpSpreadsheet/Shared/PCLZip/PclZip.php index 7197907b..5d8b2534 100644 --- a/src/PhpSpreadsheet/Shared/PCLZip/PclZip.php +++ b/src/PhpSpreadsheet/Shared/PCLZip/PclZip.php @@ -541,12 +541,12 @@ class PclZip // ----- For each file in the list check the attributes $v_supported_attributes = [ - PCLZIP_ATT_FILE_NAME => 'mandatory', - PCLZIP_ATT_FILE_NEW_SHORT_NAME => 'optional', - PCLZIP_ATT_FILE_NEW_FULL_NAME => 'optional', - PCLZIP_ATT_FILE_MTIME => 'optional', - PCLZIP_ATT_FILE_CONTENT => 'optional', - PCLZIP_ATT_FILE_COMMENT => 'optional', + PCLZIP_ATT_FILE_NAME => 'mandatory', + PCLZIP_ATT_FILE_NEW_SHORT_NAME => 'optional', + PCLZIP_ATT_FILE_NEW_FULL_NAME => 'optional', + PCLZIP_ATT_FILE_MTIME => 'optional', + PCLZIP_ATT_FILE_CONTENT => 'optional', + PCLZIP_ATT_FILE_COMMENT => 'optional', ]; foreach ($v_att_list as $v_entry) { $v_result = $this->privFileDescrParseAtt($v_entry, $v_filedescr_list[], $v_options, $v_supported_attributes); @@ -704,25 +704,25 @@ class PclZip if ((is_integer($v_arg_list[0])) && ($v_arg_list[0] > 77000)) { // ----- Parse the options $v_result = $this->privParseOptions($v_arg_list, $v_size, $v_options, [ - PCLZIP_OPT_PATH => 'optional', - PCLZIP_OPT_REMOVE_PATH => 'optional', - PCLZIP_OPT_REMOVE_ALL_PATH => 'optional', - PCLZIP_OPT_ADD_PATH => 'optional', - PCLZIP_CB_PRE_EXTRACT => 'optional', - PCLZIP_CB_POST_EXTRACT => 'optional', - PCLZIP_OPT_SET_CHMOD => 'optional', - PCLZIP_OPT_BY_NAME => 'optional', - PCLZIP_OPT_BY_EREG => 'optional', - PCLZIP_OPT_BY_PREG => 'optional', - PCLZIP_OPT_BY_INDEX => 'optional', - PCLZIP_OPT_EXTRACT_AS_STRING => 'optional', - PCLZIP_OPT_EXTRACT_IN_OUTPUT => 'optional', - PCLZIP_OPT_REPLACE_NEWER => 'optional', - PCLZIP_OPT_STOP_ON_ERROR => 'optional', - PCLZIP_OPT_EXTRACT_DIR_RESTRICTION => 'optional', - PCLZIP_OPT_TEMP_FILE_THRESHOLD => 'optional', - PCLZIP_OPT_TEMP_FILE_ON => 'optional', - PCLZIP_OPT_TEMP_FILE_OFF => 'optional', + PCLZIP_OPT_PATH => 'optional', + PCLZIP_OPT_REMOVE_PATH => 'optional', + PCLZIP_OPT_REMOVE_ALL_PATH => 'optional', + PCLZIP_OPT_ADD_PATH => 'optional', + PCLZIP_CB_PRE_EXTRACT => 'optional', + PCLZIP_CB_POST_EXTRACT => 'optional', + PCLZIP_OPT_SET_CHMOD => 'optional', + PCLZIP_OPT_BY_NAME => 'optional', + PCLZIP_OPT_BY_EREG => 'optional', + PCLZIP_OPT_BY_PREG => 'optional', + PCLZIP_OPT_BY_INDEX => 'optional', + PCLZIP_OPT_EXTRACT_AS_STRING => 'optional', + PCLZIP_OPT_EXTRACT_IN_OUTPUT => 'optional', + PCLZIP_OPT_REPLACE_NEWER => 'optional', + PCLZIP_OPT_STOP_ON_ERROR => 'optional', + PCLZIP_OPT_EXTRACT_DIR_RESTRICTION => 'optional', + PCLZIP_OPT_TEMP_FILE_THRESHOLD => 'optional', + PCLZIP_OPT_TEMP_FILE_ON => 'optional', + PCLZIP_OPT_TEMP_FILE_OFF => 'optional', ]); if ($v_result != 1) { return 0; diff --git a/src/PhpSpreadsheet/Worksheet/AutoFilter.php b/src/PhpSpreadsheet/Worksheet/AutoFilter.php index 06382ed9..7aae925c 100644 --- a/src/PhpSpreadsheet/Worksheet/AutoFilter.php +++ b/src/PhpSpreadsheet/Worksheet/AutoFilter.php @@ -706,9 +706,10 @@ class AutoFilter $operator = ($dynamicRuleType === AutoFilter\Column\Rule::AUTOFILTER_RULETYPE_DYNAMIC_ABOVEAVERAGE) ? AutoFilter\Column\Rule::AUTOFILTER_COLUMN_RULE_GREATERTHAN : AutoFilter\Column\Rule::AUTOFILTER_COLUMN_RULE_LESSTHAN; - $ruleValues[] = ['operator' => $operator, - 'value' => $average, - ]; + $ruleValues[] = [ + 'operator' => $operator, + 'value' => $average, + ]; $columnFilterTests[$columnID] = [ 'method' => 'filterTestInCustomDataSet', 'arguments' => ['filterRules' => $ruleValues, 'join' => AutoFilter\Column::AUTOFILTER_COLUMN_JOIN_OR], diff --git a/src/PhpSpreadsheet/Writer/Excel2007/Comments.php b/src/PhpSpreadsheet/Writer/Excel2007/Comments.php index 2e7b034f..97bd070d 100644 --- a/src/PhpSpreadsheet/Writer/Excel2007/Comments.php +++ b/src/PhpSpreadsheet/Writer/Excel2007/Comments.php @@ -46,11 +46,11 @@ class Comments extends WriterPart // XML header $objWriter->startDocument('1.0', 'UTF-8', 'yes'); - // Comments cache - $comments = $pWorksheet->getComments(); + // Comments cache + $comments = $pWorksheet->getComments(); - // Authors cache - $authors = []; + // Authors cache + $authors = []; $authorId = 0; foreach ($comments as $comment) { if (!isset($authors[$comment->getAuthor()])) { @@ -126,8 +126,8 @@ class Comments extends WriterPart // XML header $objWriter->startDocument('1.0', 'UTF-8', 'yes'); - // Comments cache - $comments = $pWorksheet->getComments(); + // Comments cache + $comments = $pWorksheet->getComments(); // xml $objWriter->startElement('xml'); @@ -189,7 +189,7 @@ class Comments extends WriterPart private function writeVMLComment(\PhpSpreadsheet\Shared\XMLWriter $objWriter = null, $pCellReference = 'A1', \PhpSpreadsheet\Comment $pComment = null) { // Metadata - list($column, $row) = \PhpSpreadsheet\Cell::coordinateFromString($pCellReference); + list($column, $row) = \PhpSpreadsheet\Cell::coordinateFromString($pCellReference); $column = \PhpSpreadsheet\Cell::columnIndexFromString($column); $id = 1024 + $column + $row; $id = substr($id, 0, 4); diff --git a/src/PhpSpreadsheet/Writer/Excel5.php b/src/PhpSpreadsheet/Writer/Excel5.php index 132cc530..f1af16ce 100644 --- a/src/PhpSpreadsheet/Writer/Excel5.php +++ b/src/PhpSpreadsheet/Writer/Excel5.php @@ -294,8 +294,7 @@ class Excel5 extends BaseWriter implements IWriter // set the shape index (we combine 1-based sheet index and $countShapes to create unique shape index) $reducedSpId = $countShapes[$sheetIndex]; - $spId = $reducedSpId - | ($sheet->getParent()->getIndex($sheet) + 1) << 10; + $spId = $reducedSpId | ($sheet->getParent()->getIndex($sheet) + 1) << 10; $spContainer->setSpId($spId); // keep track of last reducedSpId @@ -352,8 +351,7 @@ class Excel5 extends BaseWriter implements IWriter // set the shape index (we combine 1-based sheet index and $countShapes to create unique shape index) $reducedSpId = $countShapes[$sheetIndex]; - $spId = $reducedSpId - | ($sheet->getParent()->getIndex($sheet) + 1) << 10; + $spId = $reducedSpId | ($sheet->getParent()->getIndex($sheet) + 1) << 10; $spContainer->setSpId($spId); // keep track of last reducedSpId @@ -564,50 +562,64 @@ class Excel5 extends BaseWriter implements IWriter $dataSection_Content = ''; // GKPIDDSI_CODEPAGE: CodePage - $dataSection[] = ['summary' => ['pack' => 'V', 'data' => 0x01], - 'offset' => ['pack' => 'V'], - 'type' => ['pack' => 'V', 'data' => 0x02], // 2 byte signed integer - 'data' => ['data' => 1252], ]; + $dataSection[] = [ + 'summary' => ['pack' => 'V', 'data' => 0x01], + 'offset' => ['pack' => 'V'], + 'type' => ['pack' => 'V', 'data' => 0x02], // 2 byte signed integer + 'data' => ['data' => 1252], + ]; ++$dataSection_NumProps; // GKPIDDSI_CATEGORY : Category if ($this->spreadsheet->getProperties()->getCategory()) { $dataProp = $this->spreadsheet->getProperties()->getCategory(); - $dataSection[] = ['summary' => ['pack' => 'V', 'data' => 0x02], - 'offset' => ['pack' => 'V'], - 'type' => ['pack' => 'V', 'data' => 0x1E], - 'data' => ['data' => $dataProp, 'length' => strlen($dataProp)], ]; + $dataSection[] = [ + 'summary' => ['pack' => 'V', 'data' => 0x02], + 'offset' => ['pack' => 'V'], + 'type' => ['pack' => 'V', 'data' => 0x1E], + 'data' => ['data' => $dataProp, 'length' => strlen($dataProp)], + ]; ++$dataSection_NumProps; } // GKPIDDSI_VERSION :Version of the application that wrote the property storage - $dataSection[] = ['summary' => ['pack' => 'V', 'data' => 0x17], - 'offset' => ['pack' => 'V'], - 'type' => ['pack' => 'V', 'data' => 0x03], - 'data' => ['pack' => 'V', 'data' => 0x000C0000], ]; + $dataSection[] = [ + 'summary' => ['pack' => 'V', 'data' => 0x17], + 'offset' => ['pack' => 'V'], + 'type' => ['pack' => 'V', 'data' => 0x03], + 'data' => ['pack' => 'V', 'data' => 0x000C0000], + ]; ++$dataSection_NumProps; // GKPIDDSI_SCALE : FALSE - $dataSection[] = ['summary' => ['pack' => 'V', 'data' => 0x0B], - 'offset' => ['pack' => 'V'], - 'type' => ['pack' => 'V', 'data' => 0x0B], - 'data' => ['data' => false], ]; + $dataSection[] = [ + 'summary' => ['pack' => 'V', 'data' => 0x0B], + 'offset' => ['pack' => 'V'], + 'type' => ['pack' => 'V', 'data' => 0x0B], + 'data' => ['data' => false], + ]; ++$dataSection_NumProps; // GKPIDDSI_LINKSDIRTY : True if any of the values for the linked properties have changed outside of the application - $dataSection[] = ['summary' => ['pack' => 'V', 'data' => 0x10], - 'offset' => ['pack' => 'V'], - 'type' => ['pack' => 'V', 'data' => 0x0B], - 'data' => ['data' => false], ]; + $dataSection[] = [ + 'summary' => ['pack' => 'V', 'data' => 0x10], + 'offset' => ['pack' => 'V'], + 'type' => ['pack' => 'V', 'data' => 0x0B], + 'data' => ['data' => false], + ]; ++$dataSection_NumProps; // GKPIDDSI_SHAREDOC : FALSE - $dataSection[] = ['summary' => ['pack' => 'V', 'data' => 0x13], - 'offset' => ['pack' => 'V'], - 'type' => ['pack' => 'V', 'data' => 0x0B], - 'data' => ['data' => false], ]; + $dataSection[] = [ + 'summary' => ['pack' => 'V', 'data' => 0x13], + 'offset' => ['pack' => 'V'], + 'type' => ['pack' => 'V', 'data' => 0x0B], + 'data' => ['data' => false], + ]; ++$dataSection_NumProps; // GKPIDDSI_HYPERLINKSCHANGED : True if any of the values for the _PID_LINKS (hyperlink text) have changed outside of the application - $dataSection[] = ['summary' => ['pack' => 'V', 'data' => 0x16], - 'offset' => ['pack' => 'V'], - 'type' => ['pack' => 'V', 'data' => 0x0B], - 'data' => ['data' => false], ]; + $dataSection[] = [ + 'summary' => ['pack' => 'V', 'data' => 0x16], + 'offset' => ['pack' => 'V'], + 'type' => ['pack' => 'V', 'data' => 0x0B], + 'data' => ['data' => false], + ]; ++$dataSection_NumProps; // GKPIDDSI_DOCSPARTS @@ -617,50 +629,54 @@ class Excel5 extends BaseWriter implements IWriter $dataProp = pack('v', 0x0001); $dataProp .= pack('v', 0x0000); // array of UnalignedLpstr - // cch - $dataProp .= pack('v', 0x000A); + // cch + $dataProp .= pack('v', 0x000A); $dataProp .= pack('v', 0x0000); - // value - $dataProp .= 'Worksheet' . chr(0); + // value + $dataProp .= 'Worksheet' . chr(0); - $dataSection[] = ['summary' => ['pack' => 'V', 'data' => 0x0D], - 'offset' => ['pack' => 'V'], - 'type' => ['pack' => 'V', 'data' => 0x101E], - 'data' => ['data' => $dataProp, 'length' => strlen($dataProp)], ]; + $dataSection[] = [ + 'summary' => ['pack' => 'V', 'data' => 0x0D], + 'offset' => ['pack' => 'V'], + 'type' => ['pack' => 'V', 'data' => 0x101E], + 'data' => ['data' => $dataProp, 'length' => strlen($dataProp)], + ]; ++$dataSection_NumProps; // GKPIDDSI_HEADINGPAIR // VtVecHeadingPairValue - // cElements - $dataProp = pack('v', 0x0002); + // cElements + $dataProp = pack('v', 0x0002); $dataProp .= pack('v', 0x0000); - // Array of vtHeadingPair - // vtUnalignedString - headingString - // stringType - $dataProp .= pack('v', 0x001E); - // padding - $dataProp .= pack('v', 0x0000); - // UnalignedLpstr - // cch - $dataProp .= pack('v', 0x0013); + // Array of vtHeadingPair + // vtUnalignedString - headingString + // stringType + $dataProp .= pack('v', 0x001E); + // padding $dataProp .= pack('v', 0x0000); - // value - $dataProp .= 'Feuilles de calcul'; - // vtUnalignedString - headingParts - // wType : 0x0003 = 32 bit signed integer - $dataProp .= pack('v', 0x0300); - // padding - $dataProp .= pack('v', 0x0000); - // value - $dataProp .= pack('v', 0x0100); + // UnalignedLpstr + // cch + $dataProp .= pack('v', 0x0013); + $dataProp .= pack('v', 0x0000); + // value + $dataProp .= 'Feuilles de calcul'; + // vtUnalignedString - headingParts + // wType : 0x0003 = 32 bit signed integer + $dataProp .= pack('v', 0x0300); + // padding + $dataProp .= pack('v', 0x0000); + // value + $dataProp .= pack('v', 0x0100); $dataProp .= pack('v', 0x0000); $dataProp .= pack('v', 0x0000); $dataProp .= pack('v', 0x0000); - $dataSection[] = ['summary' => ['pack' => 'V', 'data' => 0x0C], - 'offset' => ['pack' => 'V'], - 'type' => ['pack' => 'V', 'data' => 0x100C], - 'data' => ['data' => $dataProp, 'length' => strlen($dataProp)], ]; + $dataSection[] = [ + 'summary' => ['pack' => 'V', 'data' => 0x0C], + 'offset' => ['pack' => 'V'], + 'type' => ['pack' => 'V', 'data' => 0x100C], + 'data' => ['data' => $dataProp, 'length' => strlen($dataProp)], + ]; ++$dataSection_NumProps; // 4 Section Length @@ -760,89 +776,109 @@ class Excel5 extends BaseWriter implements IWriter $dataSection_Content = ''; // CodePage : CP-1252 - $dataSection[] = ['summary' => ['pack' => 'V', 'data' => 0x01], - 'offset' => ['pack' => 'V'], - 'type' => ['pack' => 'V', 'data' => 0x02], // 2 byte signed integer - 'data' => ['data' => 1252], ]; + $dataSection[] = [ + 'summary' => ['pack' => 'V', 'data' => 0x01], + 'offset' => ['pack' => 'V'], + 'type' => ['pack' => 'V', 'data' => 0x02], // 2 byte signed integer + 'data' => ['data' => 1252], + ]; ++$dataSection_NumProps; // Title if ($this->spreadsheet->getProperties()->getTitle()) { $dataProp = $this->spreadsheet->getProperties()->getTitle(); - $dataSection[] = ['summary' => ['pack' => 'V', 'data' => 0x02], - 'offset' => ['pack' => 'V'], - 'type' => ['pack' => 'V', 'data' => 0x1E], // null-terminated string prepended by dword string length - 'data' => ['data' => $dataProp, 'length' => strlen($dataProp)], ]; + $dataSection[] = [ + 'summary' => ['pack' => 'V', 'data' => 0x02], + 'offset' => ['pack' => 'V'], + 'type' => ['pack' => 'V', 'data' => 0x1E], // null-terminated string prepended by dword string length + 'data' => ['data' => $dataProp, 'length' => strlen($dataProp)], + ]; ++$dataSection_NumProps; } // Subject if ($this->spreadsheet->getProperties()->getSubject()) { $dataProp = $this->spreadsheet->getProperties()->getSubject(); - $dataSection[] = ['summary' => ['pack' => 'V', 'data' => 0x03], - 'offset' => ['pack' => 'V'], - 'type' => ['pack' => 'V', 'data' => 0x1E], // null-terminated string prepended by dword string length - 'data' => ['data' => $dataProp, 'length' => strlen($dataProp)], ]; + $dataSection[] = [ + 'summary' => ['pack' => 'V', 'data' => 0x03], + 'offset' => ['pack' => 'V'], + 'type' => ['pack' => 'V', 'data' => 0x1E], // null-terminated string prepended by dword string length + 'data' => ['data' => $dataProp, 'length' => strlen($dataProp)], + ]; ++$dataSection_NumProps; } // Author (Creator) if ($this->spreadsheet->getProperties()->getCreator()) { $dataProp = $this->spreadsheet->getProperties()->getCreator(); - $dataSection[] = ['summary' => ['pack' => 'V', 'data' => 0x04], - 'offset' => ['pack' => 'V'], - 'type' => ['pack' => 'V', 'data' => 0x1E], // null-terminated string prepended by dword string length - 'data' => ['data' => $dataProp, 'length' => strlen($dataProp)], ]; + $dataSection[] = [ + 'summary' => ['pack' => 'V', 'data' => 0x04], + 'offset' => ['pack' => 'V'], + 'type' => ['pack' => 'V', 'data' => 0x1E], // null-terminated string prepended by dword string length + 'data' => ['data' => $dataProp, 'length' => strlen($dataProp)], + ]; ++$dataSection_NumProps; } // Keywords if ($this->spreadsheet->getProperties()->getKeywords()) { $dataProp = $this->spreadsheet->getProperties()->getKeywords(); - $dataSection[] = ['summary' => ['pack' => 'V', 'data' => 0x05], - 'offset' => ['pack' => 'V'], - 'type' => ['pack' => 'V', 'data' => 0x1E], // null-terminated string prepended by dword string length - 'data' => ['data' => $dataProp, 'length' => strlen($dataProp)], ]; + $dataSection[] = [ + 'summary' => ['pack' => 'V', 'data' => 0x05], + 'offset' => ['pack' => 'V'], + 'type' => ['pack' => 'V', 'data' => 0x1E], // null-terminated string prepended by dword string length + 'data' => ['data' => $dataProp, 'length' => strlen($dataProp)], + ]; ++$dataSection_NumProps; } // Comments (Description) if ($this->spreadsheet->getProperties()->getDescription()) { $dataProp = $this->spreadsheet->getProperties()->getDescription(); - $dataSection[] = ['summary' => ['pack' => 'V', 'data' => 0x06], - 'offset' => ['pack' => 'V'], - 'type' => ['pack' => 'V', 'data' => 0x1E], // null-terminated string prepended by dword string length - 'data' => ['data' => $dataProp, 'length' => strlen($dataProp)], ]; + $dataSection[] = [ + 'summary' => ['pack' => 'V', 'data' => 0x06], + 'offset' => ['pack' => 'V'], + 'type' => ['pack' => 'V', 'data' => 0x1E], // null-terminated string prepended by dword string length + 'data' => ['data' => $dataProp, 'length' => strlen($dataProp)], + ]; ++$dataSection_NumProps; } // Last Saved By (LastModifiedBy) if ($this->spreadsheet->getProperties()->getLastModifiedBy()) { $dataProp = $this->spreadsheet->getProperties()->getLastModifiedBy(); - $dataSection[] = ['summary' => ['pack' => 'V', 'data' => 0x08], - 'offset' => ['pack' => 'V'], - 'type' => ['pack' => 'V', 'data' => 0x1E], // null-terminated string prepended by dword string length - 'data' => ['data' => $dataProp, 'length' => strlen($dataProp)], ]; + $dataSection[] = [ + 'summary' => ['pack' => 'V', 'data' => 0x08], + 'offset' => ['pack' => 'V'], + 'type' => ['pack' => 'V', 'data' => 0x1E], // null-terminated string prepended by dword string length + 'data' => ['data' => $dataProp, 'length' => strlen($dataProp)], + ]; ++$dataSection_NumProps; } // Created Date/Time if ($this->spreadsheet->getProperties()->getCreated()) { $dataProp = $this->spreadsheet->getProperties()->getCreated(); - $dataSection[] = ['summary' => ['pack' => 'V', 'data' => 0x0C], - 'offset' => ['pack' => 'V'], - 'type' => ['pack' => 'V', 'data' => 0x40], // Filetime (64-bit value representing the number of 100-nanosecond intervals since January 1, 1601) - 'data' => ['data' => \PhpSpreadsheet\Shared\OLE::localDateToOLE($dataProp)], ]; + $dataSection[] = [ + 'summary' => ['pack' => 'V', 'data' => 0x0C], + 'offset' => ['pack' => 'V'], + 'type' => ['pack' => 'V', 'data' => 0x40], // Filetime (64-bit value representing the number of 100-nanosecond intervals since January 1, 1601) + 'data' => ['data' => \PhpSpreadsheet\Shared\OLE::localDateToOLE($dataProp)], + ]; ++$dataSection_NumProps; } // Modified Date/Time if ($this->spreadsheet->getProperties()->getModified()) { $dataProp = $this->spreadsheet->getProperties()->getModified(); - $dataSection[] = ['summary' => ['pack' => 'V', 'data' => 0x0D], - 'offset' => ['pack' => 'V'], - 'type' => ['pack' => 'V', 'data' => 0x40], // Filetime (64-bit value representing the number of 100-nanosecond intervals since January 1, 1601) - 'data' => ['data' => \PhpSpreadsheet\Shared\OLE::localDateToOLE($dataProp)], ]; + $dataSection[] = [ + 'summary' => ['pack' => 'V', 'data' => 0x0D], + 'offset' => ['pack' => 'V'], + 'type' => ['pack' => 'V', 'data' => 0x40], // Filetime (64-bit value representing the number of 100-nanosecond intervals since January 1, 1601) + 'data' => ['data' => \PhpSpreadsheet\Shared\OLE::localDateToOLE($dataProp)], + ]; ++$dataSection_NumProps; } // Security - $dataSection[] = ['summary' => ['pack' => 'V', 'data' => 0x13], - 'offset' => ['pack' => 'V'], - 'type' => ['pack' => 'V', 'data' => 0x03], // 4 byte signed integer - 'data' => ['data' => 0x00], ]; + $dataSection[] = [ + 'summary' => ['pack' => 'V', 'data' => 0x13], + 'offset' => ['pack' => 'V'], + 'type' => ['pack' => 'V', 'data' => 0x03], // 4 byte signed integer + 'data' => ['data' => 0x00], + ]; ++$dataSection_NumProps; // 4 Section Length diff --git a/src/PhpSpreadsheet/Writer/Excel5/Parser.php b/src/PhpSpreadsheet/Writer/Excel5/Parser.php index 133484b0..e188672d 100644 --- a/src/PhpSpreadsheet/Writer/Excel5/Parser.php +++ b/src/PhpSpreadsheet/Writer/Excel5/Parser.php @@ -666,7 +666,7 @@ class Parser list($row1, $col1) = $this->cellToPackedRowcol($cell1); list($row2, $col2) = $this->cellToPackedRowcol($cell2); } else { // It's a rows range (like 26:27) - list($row1, $col1, $row2, $col2) = $this->rangeToPackedRange($cell1 . ':' . $cell2); + list($row1, $col1, $row2, $col2) = $this->rangeToPackedRange($cell1 . ':' . $cell2); } // The ptg value depends on the class of the ptg. diff --git a/src/PhpSpreadsheet/Writer/Excel5/Worksheet.php b/src/PhpSpreadsheet/Writer/Excel5/Worksheet.php index b4a48724..1ba09865 100644 --- a/src/PhpSpreadsheet/Writer/Excel5/Worksheet.php +++ b/src/PhpSpreadsheet/Writer/Excel5/Worksheet.php @@ -1019,9 +1019,7 @@ class Worksheet extends BIFFwriter $data = pack('vvvv', $row1, $row2, $col1, $col2); // Write the packed data - $this->append($header . $data . - $unknown1 . $options . - $unknown2 . $url_len . $url); + $this->append($header . $data . $unknown1 . $options . $unknown2 . $url_len . $url); return 0; } @@ -1068,9 +1066,7 @@ class Worksheet extends BIFFwriter $data = pack('vvvv', $row1, $row2, $col1, $col2); // Write the packed data - $this->append($header . $data . - $unknown1 . $options . - $url_len . $url); + $this->append($header . $data . $unknown1 . $options . $url_len . $url); return 0; }