@@ 1841-1853 (lines=13) @@ | ||
1838 | * -- "OpenOffice.org's Documentation of the Microsoft |
|
1839 | * Excel File Format" |
|
1840 | */ |
|
1841 | private function readCodepage() |
|
1842 | { |
|
1843 | $length = self::getInt2d($this->data, $this->pos + 2); |
|
1844 | $recordData = $this->readRecordData($this->data, $this->pos + 4, $length); |
|
1845 | ||
1846 | // move stream pointer to next record |
|
1847 | $this->pos += 4 + $length; |
|
1848 | ||
1849 | // offset: 0; size: 2; code page identifier |
|
1850 | $codepage = self::getInt2d($recordData, 0); |
|
1851 | ||
1852 | $this->codepage = \PhpOffice\PhpSpreadsheet\Shared\CodePage::numberToName($codepage); |
|
1853 | } |
|
1854 | ||
1855 | /** |
|
1856 | * DATEMODE. |
|
@@ 2993-3005 (lines=13) @@ | ||
2990 | /** |
|
2991 | * Read DEFAULTROWHEIGHT record. |
|
2992 | */ |
|
2993 | private function readDefaultRowHeight() |
|
2994 | { |
|
2995 | $length = self::getInt2d($this->data, $this->pos + 2); |
|
2996 | $recordData = $this->readRecordData($this->data, $this->pos + 4, $length); |
|
2997 | ||
2998 | // move stream pointer to next record |
|
2999 | $this->pos += 4 + $length; |
|
3000 | ||
3001 | // offset: 0; size: 2; option flags |
|
3002 | // offset: 2; size: 2; default height for unused rows, (twips 1/20 point) |
|
3003 | $height = self::getInt2d($recordData, 2); |
|
3004 | $this->phpSheet->getDefaultRowDimension()->setRowHeight($height / 20); |
|
3005 | } |
|
3006 | ||
3007 | /** |
|
3008 | * Read SHEETPR record. |
|
@@ 3143-3157 (lines=15) @@ | ||
3140 | /** |
|
3141 | * Read HCENTER record. |
|
3142 | */ |
|
3143 | private function readHcenter() |
|
3144 | { |
|
3145 | $length = self::getInt2d($this->data, $this->pos + 2); |
|
3146 | $recordData = $this->readRecordData($this->data, $this->pos + 4, $length); |
|
3147 | ||
3148 | // move stream pointer to next record |
|
3149 | $this->pos += 4 + $length; |
|
3150 | ||
3151 | if (!$this->readDataOnly) { |
|
3152 | // offset: 0; size: 2; 0 = print sheet left aligned, 1 = print sheet centered horizontally |
|
3153 | $isHorizontalCentered = (bool) self::getInt2d($recordData, 0); |
|
3154 | ||
3155 | $this->phpSheet->getPageSetup()->setHorizontalCentered($isHorizontalCentered); |
|
3156 | } |
|
3157 | } |
|
3158 | ||
3159 | /** |
|
3160 | * Read VCENTER record. |
|
@@ 3162-3176 (lines=15) @@ | ||
3159 | /** |
|
3160 | * Read VCENTER record. |
|
3161 | */ |
|
3162 | private function readVcenter() |
|
3163 | { |
|
3164 | $length = self::getInt2d($this->data, $this->pos + 2); |
|
3165 | $recordData = $this->readRecordData($this->data, $this->pos + 4, $length); |
|
3166 | ||
3167 | // move stream pointer to next record |
|
3168 | $this->pos += 4 + $length; |
|
3169 | ||
3170 | if (!$this->readDataOnly) { |
|
3171 | // offset: 0; size: 2; 0 = print sheet aligned at top page border, 1 = print sheet vertically centered |
|
3172 | $isVerticalCentered = (bool) self::getInt2d($recordData, 0); |
|
3173 | ||
3174 | $this->phpSheet->getPageSetup()->setVerticalCentered($isVerticalCentered); |
|
3175 | } |
|
3176 | } |
|
3177 | ||
3178 | /** |
|
3179 | * Read LEFTMARGIN record. |
|
@@ 3310-3327 (lines=18) @@ | ||
3307 | * PROTECT - Sheet protection (BIFF2 through BIFF8) |
|
3308 | * if this record is omitted, then it also means no sheet protection. |
|
3309 | */ |
|
3310 | private function readProtect() |
|
3311 | { |
|
3312 | $length = self::getInt2d($this->data, $this->pos + 2); |
|
3313 | $recordData = $this->readRecordData($this->data, $this->pos + 4, $length); |
|
3314 | ||
3315 | // move stream pointer to next record |
|
3316 | $this->pos += 4 + $length; |
|
3317 | ||
3318 | if ($this->readDataOnly) { |
|
3319 | return; |
|
3320 | } |
|
3321 | ||
3322 | // offset: 0; size: 2; |
|
3323 | ||
3324 | // bit 0, mask 0x01; 1 = sheet is protected |
|
3325 | $bool = (0x01 & self::getInt2d($recordData, 0)) >> 0; |
|
3326 | $this->phpSheet->getProtection()->setSheet((bool) $bool); |
|
3327 | } |
|
3328 | ||
3329 | /** |
|
3330 | * SCENPROTECT. |
|
@@ 3332-3350 (lines=19) @@ | ||
3329 | /** |
|
3330 | * SCENPROTECT. |
|
3331 | */ |
|
3332 | private function readScenProtect() |
|
3333 | { |
|
3334 | $length = self::getInt2d($this->data, $this->pos + 2); |
|
3335 | $recordData = $this->readRecordData($this->data, $this->pos + 4, $length); |
|
3336 | ||
3337 | // move stream pointer to next record |
|
3338 | $this->pos += 4 + $length; |
|
3339 | ||
3340 | if ($this->readDataOnly) { |
|
3341 | return; |
|
3342 | } |
|
3343 | ||
3344 | // offset: 0; size: 2; |
|
3345 | ||
3346 | // bit: 0, mask 0x01; 1 = scenarios are protected |
|
3347 | $bool = (0x01 & self::getInt2d($recordData, 0)) >> 0; |
|
3348 | ||
3349 | $this->phpSheet->getProtection()->setScenarios((bool) $bool); |
|
3350 | } |
|
3351 | ||
3352 | /** |
|
3353 | * OBJECTPROTECT. |
|
@@ 3355-3373 (lines=19) @@ | ||
3352 | /** |
|
3353 | * OBJECTPROTECT. |
|
3354 | */ |
|
3355 | private function readObjectProtect() |
|
3356 | { |
|
3357 | $length = self::getInt2d($this->data, $this->pos + 2); |
|
3358 | $recordData = $this->readRecordData($this->data, $this->pos + 4, $length); |
|
3359 | ||
3360 | // move stream pointer to next record |
|
3361 | $this->pos += 4 + $length; |
|
3362 | ||
3363 | if ($this->readDataOnly) { |
|
3364 | return; |
|
3365 | } |
|
3366 | ||
3367 | // offset: 0; size: 2; |
|
3368 | ||
3369 | // bit: 0, mask 0x01; 1 = objects are protected |
|
3370 | $bool = (0x01 & self::getInt2d($recordData, 0)) >> 0; |
|
3371 | ||
3372 | $this->phpSheet->getProtection()->setObjects((bool) $bool); |
|
3373 | } |
|
3374 | ||
3375 | /** |
|
3376 | * PASSWORD - Sheet protection (hashed) password (BIFF2 through BIFF8). |
|
@@ 3396-3409 (lines=14) @@ | ||
3393 | /** |
|
3394 | * Read DEFCOLWIDTH record. |
|
3395 | */ |
|
3396 | private function readDefColWidth() |
|
3397 | { |
|
3398 | $length = self::getInt2d($this->data, $this->pos + 2); |
|
3399 | $recordData = $this->readRecordData($this->data, $this->pos + 4, $length); |
|
3400 | ||
3401 | // move stream pointer to next record |
|
3402 | $this->pos += 4 + $length; |
|
3403 | ||
3404 | // offset: 0; size: 2; default column width |
|
3405 | $width = self::getInt2d($recordData, 0); |
|
3406 | if ($width != 8) { |
|
3407 | $this->phpSheet->getDefaultColumnDimension()->setWidth($width); |
|
3408 | } |
|
3409 | } |
|
3410 | ||
3411 | /** |
|
3412 | * Read COLINFO record. |