Failed Conditions
Push — develop ( 11b055...32a55a )
by Adrien
30:13
created

Xlsx::__construct()   B

Complexity

Conditions 3
Paths 4

Size

Total Lines 35
Code Lines 22

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 8
CRAP Score 3

Importance

Changes 0
Metric Value
cc 3
eloc 22
nc 4
nop 1
dl 0
loc 35
ccs 8
cts 8
cp 1
crap 3
rs 8.8571
c 0
b 0
f 0
1
<?php
2
3
namespace PhpOffice\PhpSpreadsheet\Writer;
4
5
use PhpOffice\PhpSpreadsheet\Calculation\Calculation;
6
use PhpOffice\PhpSpreadsheet\Calculation\Functions;
7
use PhpOffice\PhpSpreadsheet\HashTable;
8
use PhpOffice\PhpSpreadsheet\Shared\File;
9
use PhpOffice\PhpSpreadsheet\Spreadsheet;
10
use PhpOffice\PhpSpreadsheet\Worksheet\Drawing as WorksheetDrawing;
11
use PhpOffice\PhpSpreadsheet\Worksheet\MemoryDrawing;
12
use PhpOffice\PhpSpreadsheet\Writer\Exception as WriterException;
13
use PhpOffice\PhpSpreadsheet\Writer\Xlsx\Chart;
14
use PhpOffice\PhpSpreadsheet\Writer\Xlsx\Comments;
15
use PhpOffice\PhpSpreadsheet\Writer\Xlsx\ContentTypes;
16
use PhpOffice\PhpSpreadsheet\Writer\Xlsx\DocProps;
17
use PhpOffice\PhpSpreadsheet\Writer\Xlsx\Drawing;
18
use PhpOffice\PhpSpreadsheet\Writer\Xlsx\Rels;
19
use PhpOffice\PhpSpreadsheet\Writer\Xlsx\RelsRibbon;
20
use PhpOffice\PhpSpreadsheet\Writer\Xlsx\RelsVBA;
21
use PhpOffice\PhpSpreadsheet\Writer\Xlsx\StringTable;
22
use PhpOffice\PhpSpreadsheet\Writer\Xlsx\Style;
23
use PhpOffice\PhpSpreadsheet\Writer\Xlsx\Theme;
24
use PhpOffice\PhpSpreadsheet\Writer\Xlsx\Workbook;
25
use PhpOffice\PhpSpreadsheet\Writer\Xlsx\Worksheet;
26
use ZipArchive;
27
28
class Xlsx extends BaseWriter
29
{
30
    /**
31
     * Office2003 compatibility.
32
     *
33
     * @var bool
34
     */
35
    private $office2003compatibility = false;
36
37
    /**
38
     * Private writer parts.
39
     *
40
     * @var Xlsx\WriterPart[]
41
     */
42
    private $writerParts = [];
43
44
    /**
45
     * Private Spreadsheet.
46
     *
47
     * @var Spreadsheet
48
     */
49
    private $spreadSheet;
50
51
    /**
52
     * Private string table.
53
     *
54
     * @var string[]
55
     */
56
    private $stringTable = [];
57
58
    /**
59
     * Private unique Conditional HashTable.
60
     *
61
     * @var HashTable
62
     */
63
    private $stylesConditionalHashTable;
64
65
    /**
66
     * Private unique Style HashTable.
67
     *
68
     * @var HashTable
69
     */
70
    private $styleHashTable;
71
72
    /**
73
     * Private unique Fill HashTable.
74
     *
75
     * @var HashTable
76
     */
77
    private $fillHashTable;
78
79
    /**
80
     * Private unique \PhpOffice\PhpSpreadsheet\Style\Font HashTable.
81
     *
82
     * @var HashTable
83
     */
84
    private $fontHashTable;
85
86
    /**
87
     * Private unique Borders HashTable.
88
     *
89
     * @var HashTable
90
     */
91
    private $bordersHashTable;
92
93
    /**
94
     * Private unique NumberFormat HashTable.
95
     *
96
     * @var HashTable
97
     */
98
    private $numFmtHashTable;
99
100
    /**
101
     * Private unique \PhpOffice\PhpSpreadsheet\Worksheet\Worksheet\BaseDrawing HashTable.
102
     *
103
     * @var HashTable
104
     */
105
    private $drawingHashTable;
106
107
    /**
108
     * Create a new Xlsx Writer.
109
     *
110
     * @param Spreadsheet $spreadsheet
111
     */
112 57
    public function __construct(Spreadsheet $spreadsheet)
113
    {
114
        // Assign PhpSpreadsheet
115 57
        $this->setSpreadsheet($spreadsheet);
116
117
        $writerPartsArray = [
118 57
            'stringtable' => StringTable::class,
119
            'contenttypes' => ContentTypes::class,
120
            'docprops' => DocProps::class,
121
            'rels' => Rels::class,
122
            'theme' => Theme::class,
123
            'style' => Style::class,
124
            'workbook' => Workbook::class,
125
            'worksheet' => Worksheet::class,
126
            'drawing' => Drawing::class,
127
            'comments' => Comments::class,
128
            'chart' => Chart::class,
129
            'relsvba' => RelsVBA::class,
130
            'relsribbonobjects' => RelsRibbon::class,
131
        ];
132
133
        //    Initialise writer parts
134
        //        and Assign their parent IWriters
135 57
        foreach ($writerPartsArray as $writer => $class) {
136 57
            $this->writerParts[$writer] = new $class($this);
137
        }
138
139 57
        $hashTablesArray = ['stylesConditionalHashTable', 'fillHashTable', 'fontHashTable',
140
                                    'bordersHashTable', 'numFmtHashTable', 'drawingHashTable',
141
                                    'styleHashTable',
142
                                ];
143
144
        // Set HashTable variables
145 57
        foreach ($hashTablesArray as $tableName) {
146 57
            $this->$tableName = new HashTable();
147
        }
148 57
    }
149
150
    /**
151
     * Get writer part.
152
     *
153
     * @param string $pPartName Writer part name
154
     *
155
     * @return \PhpOffice\PhpSpreadsheet\Writer\Xlsx\WriterPart
156
     */
157 56 View Code Duplication
    public function getWriterPart($pPartName)
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
158
    {
159 56
        if ($pPartName != '' && isset($this->writerParts[strtolower($pPartName)])) {
160 56
            return $this->writerParts[strtolower($pPartName)];
161
        }
162
163
        return null;
164
    }
165
166
    /**
167
     * Save PhpSpreadsheet to file.
168
     *
169
     * @param string $pFilename
170
     *
171
     * @throws WriterException
172
     */
173 56
    public function save($pFilename)
174
    {
175 56
        if ($this->spreadSheet !== null) {
176
            // garbage collect
177 56
            $this->spreadSheet->garbageCollect();
178
179
            // If $pFilename is php://output or php://stdout, make it a temporary file...
180 56
            $originalFilename = $pFilename;
181 56 View Code Duplication
            if (strtolower($pFilename) == 'php://output' || strtolower($pFilename) == 'php://stdout') {
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
182
                $pFilename = @tempnam(File::sysGetTempDir(), 'phpxltmp');
183
                if ($pFilename == '') {
184
                    $pFilename = $originalFilename;
185
                }
186
            }
187
188 56
            $saveDebugLog = Calculation::getInstance($this->spreadSheet)->getDebugLog()->getWriteDebugLog();
189 56
            Calculation::getInstance($this->spreadSheet)->getDebugLog()->setWriteDebugLog(false);
190 56
            $saveDateReturnType = Functions::getReturnDateType();
191 56
            Functions::setReturnDateType(Functions::RETURNDATE_EXCEL);
192
193
            // Create string lookup table
194 56
            $this->stringTable = [];
195 56
            for ($i = 0; $i < $this->spreadSheet->getSheetCount(); ++$i) {
196 56
                $this->stringTable = $this->getWriterPart('StringTable')->createStringTable($this->spreadSheet->getSheet($i), $this->stringTable);
0 ignored issues
show
Bug introduced by
The method createStringTable() does not exist on PhpOffice\PhpSpreadsheet\Writer\Xlsx\WriterPart. It seems like you code against a sub-type of PhpOffice\PhpSpreadsheet\Writer\Xlsx\WriterPart such as PhpOffice\PhpSpreadsheet\Writer\Xlsx\StringTable. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

196
                $this->stringTable = $this->getWriterPart('StringTable')->/** @scrutinizer ignore-call */ createStringTable($this->spreadSheet->getSheet($i), $this->stringTable);
Loading history...
197
            }
198
199
            // Create styles dictionaries
200 56
            $this->styleHashTable->addFromSource($this->getWriterPart('Style')->allStyles($this->spreadSheet));
0 ignored issues
show
Bug introduced by
The method allStyles() does not exist on PhpOffice\PhpSpreadsheet\Writer\Xlsx\WriterPart. It seems like you code against a sub-type of PhpOffice\PhpSpreadsheet\Writer\Xlsx\WriterPart such as PhpOffice\PhpSpreadsheet\Writer\Xlsx\Style. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

200
            $this->styleHashTable->addFromSource($this->getWriterPart('Style')->/** @scrutinizer ignore-call */ allStyles($this->spreadSheet));
Loading history...
201 56
            $this->stylesConditionalHashTable->addFromSource($this->getWriterPart('Style')->allConditionalStyles($this->spreadSheet));
0 ignored issues
show
Bug introduced by
The method allConditionalStyles() does not exist on PhpOffice\PhpSpreadsheet\Writer\Xlsx\WriterPart. It seems like you code against a sub-type of PhpOffice\PhpSpreadsheet\Writer\Xlsx\WriterPart such as PhpOffice\PhpSpreadsheet\Writer\Xlsx\Style. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

201
            $this->stylesConditionalHashTable->addFromSource($this->getWriterPart('Style')->/** @scrutinizer ignore-call */ allConditionalStyles($this->spreadSheet));
Loading history...
202 56
            $this->fillHashTable->addFromSource($this->getWriterPart('Style')->allFills($this->spreadSheet));
0 ignored issues
show
Bug introduced by
The method allFills() does not exist on PhpOffice\PhpSpreadsheet\Writer\Xlsx\WriterPart. It seems like you code against a sub-type of PhpOffice\PhpSpreadsheet\Writer\Xlsx\WriterPart such as PhpOffice\PhpSpreadsheet\Writer\Xlsx\Style. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

202
            $this->fillHashTable->addFromSource($this->getWriterPart('Style')->/** @scrutinizer ignore-call */ allFills($this->spreadSheet));
Loading history...
203 56
            $this->fontHashTable->addFromSource($this->getWriterPart('Style')->allFonts($this->spreadSheet));
0 ignored issues
show
Bug introduced by
The method allFonts() does not exist on PhpOffice\PhpSpreadsheet\Writer\Xlsx\WriterPart. It seems like you code against a sub-type of PhpOffice\PhpSpreadsheet\Writer\Xlsx\WriterPart such as PhpOffice\PhpSpreadsheet\Writer\Xlsx\Style. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

203
            $this->fontHashTable->addFromSource($this->getWriterPart('Style')->/** @scrutinizer ignore-call */ allFonts($this->spreadSheet));
Loading history...
204 56
            $this->bordersHashTable->addFromSource($this->getWriterPart('Style')->allBorders($this->spreadSheet));
0 ignored issues
show
Bug introduced by
The method allBorders() does not exist on PhpOffice\PhpSpreadsheet\Writer\Xlsx\WriterPart. It seems like you code against a sub-type of PhpOffice\PhpSpreadsheet\Writer\Xlsx\WriterPart such as PhpOffice\PhpSpreadsheet\Writer\Xlsx\Style. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

204
            $this->bordersHashTable->addFromSource($this->getWriterPart('Style')->/** @scrutinizer ignore-call */ allBorders($this->spreadSheet));
Loading history...
205 56
            $this->numFmtHashTable->addFromSource($this->getWriterPart('Style')->allNumberFormats($this->spreadSheet));
0 ignored issues
show
Bug introduced by
The method allNumberFormats() does not exist on PhpOffice\PhpSpreadsheet\Writer\Xlsx\WriterPart. It seems like you code against a sub-type of PhpOffice\PhpSpreadsheet\Writer\Xlsx\WriterPart such as PhpOffice\PhpSpreadsheet\Writer\Xlsx\Style. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

205
            $this->numFmtHashTable->addFromSource($this->getWriterPart('Style')->/** @scrutinizer ignore-call */ allNumberFormats($this->spreadSheet));
Loading history...
206
207
            // Create drawing dictionary
208 56
            $this->drawingHashTable->addFromSource($this->getWriterPart('Drawing')->allDrawings($this->spreadSheet));
0 ignored issues
show
Bug introduced by
The method allDrawings() does not exist on PhpOffice\PhpSpreadsheet\Writer\Xlsx\WriterPart. It seems like you code against a sub-type of PhpOffice\PhpSpreadsheet\Writer\Xlsx\WriterPart such as PhpOffice\PhpSpreadsheet\Writer\Xlsx\Drawing. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

208
            $this->drawingHashTable->addFromSource($this->getWriterPart('Drawing')->/** @scrutinizer ignore-call */ allDrawings($this->spreadSheet));
Loading history...
209
210 56
            $zip = new ZipArchive();
211
212 56
            if (file_exists($pFilename)) {
1 ignored issue
show
Bug introduced by
It seems like $pFilename can also be of type false; however, parameter $filename of file_exists() does only seem to accept string, maybe add an additional type check? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

212
            if (file_exists(/** @scrutinizer ignore-type */ $pFilename)) {
Loading history...
213
                unlink($pFilename);
1 ignored issue
show
Bug introduced by
It seems like $pFilename can also be of type false; however, parameter $filename of unlink() does only seem to accept string, maybe add an additional type check? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

213
                unlink(/** @scrutinizer ignore-type */ $pFilename);
Loading history...
214
            }
215
            // Try opening the ZIP file
216 56 View Code Duplication
            if ($zip->open($pFilename, ZipArchive::OVERWRITE) !== true) {
1 ignored issue
show
Duplication introduced by
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
Bug introduced by
It seems like $pFilename can also be of type false; however, parameter $filename of ZipArchive::open() does only seem to accept string, maybe add an additional type check? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

216
            if ($zip->open(/** @scrutinizer ignore-type */ $pFilename, ZipArchive::OVERWRITE) !== true) {
Loading history...
217 56
                if ($zip->open($pFilename, ZipArchive::CREATE) !== true) {
218
                    throw new WriterException('Could not open ' . $pFilename . ' for writing.');
1 ignored issue
show
Bug introduced by
Are you sure $pFilename of type false|string can be used in concatenation? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

218
                    throw new WriterException('Could not open ' . /** @scrutinizer ignore-type */ $pFilename . ' for writing.');
Loading history...
219
                }
220
            }
221
222
            // Add [Content_Types].xml to ZIP file
223 56
            $zip->addFromString('[Content_Types].xml', $this->getWriterPart('ContentTypes')->writeContentTypes($this->spreadSheet, $this->includeCharts));
0 ignored issues
show
Bug introduced by
The method writeContentTypes() does not exist on PhpOffice\PhpSpreadsheet\Writer\Xlsx\WriterPart. It seems like you code against a sub-type of PhpOffice\PhpSpreadsheet\Writer\Xlsx\WriterPart such as PhpOffice\PhpSpreadsheet\Writer\Xlsx\ContentTypes. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

223
            $zip->addFromString('[Content_Types].xml', $this->getWriterPart('ContentTypes')->/** @scrutinizer ignore-call */ writeContentTypes($this->spreadSheet, $this->includeCharts));
Loading history...
224
225
            //if hasMacros, add the vbaProject.bin file, Certificate file(if exists)
226 56
            if ($this->spreadSheet->hasMacros()) {
227
                $macrosCode = $this->spreadSheet->getMacrosCode();
228
                if ($macrosCode !== null) {
229
                    // we have the code ?
230
                    $zip->addFromString('xl/vbaProject.bin', $macrosCode); //allways in 'xl', allways named vbaProject.bin
231
                    if ($this->spreadSheet->hasMacrosCertificate()) {
232
                        //signed macros ?
233
                        // Yes : add the certificate file and the related rels file
234
                        $zip->addFromString('xl/vbaProjectSignature.bin', $this->spreadSheet->getMacrosCertificate());
235
                        $zip->addFromString('xl/_rels/vbaProject.bin.rels', $this->getWriterPart('RelsVBA')->writeVBARelationships($this->spreadSheet));
0 ignored issues
show
Bug introduced by
The method writeVBARelationships() does not exist on PhpOffice\PhpSpreadsheet\Writer\Xlsx\WriterPart. It seems like you code against a sub-type of PhpOffice\PhpSpreadsheet\Writer\Xlsx\WriterPart such as PhpOffice\PhpSpreadsheet\Writer\Xlsx\RelsVBA. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

235
                        $zip->addFromString('xl/_rels/vbaProject.bin.rels', $this->getWriterPart('RelsVBA')->/** @scrutinizer ignore-call */ writeVBARelationships($this->spreadSheet));
Loading history...
236
                    }
237
                }
238
            }
239
            //a custom UI in this workbook ? add it ("base" xml and additional objects (pictures) and rels)
240 56
            if ($this->spreadSheet->hasRibbon()) {
241
                $tmpRibbonTarget = $this->spreadSheet->getRibbonXMLData('target');
242
                $zip->addFromString($tmpRibbonTarget, $this->spreadSheet->getRibbonXMLData('data'));
243
                if ($this->spreadSheet->hasRibbonBinObjects()) {
244
                    $tmpRootPath = dirname($tmpRibbonTarget) . '/';
245
                    $ribbonBinObjects = $this->spreadSheet->getRibbonBinObjects('data'); //the files to write
246
                    foreach ($ribbonBinObjects as $aPath => $aContent) {
247
                        $zip->addFromString($tmpRootPath . $aPath, $aContent);
248
                    }
249
                    //the rels for files
250
                    $zip->addFromString($tmpRootPath . '_rels/' . basename($tmpRibbonTarget) . '.rels', $this->getWriterPart('RelsRibbonObjects')->writeRibbonRelationships($this->spreadSheet));
0 ignored issues
show
Bug introduced by
The method writeRibbonRelationships() does not exist on PhpOffice\PhpSpreadsheet\Writer\Xlsx\WriterPart. It seems like you code against a sub-type of PhpOffice\PhpSpreadsheet\Writer\Xlsx\WriterPart such as PhpOffice\PhpSpreadsheet\Writer\Xlsx\RelsRibbon. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

250
                    $zip->addFromString($tmpRootPath . '_rels/' . basename($tmpRibbonTarget) . '.rels', $this->getWriterPart('RelsRibbonObjects')->/** @scrutinizer ignore-call */ writeRibbonRelationships($this->spreadSheet));
Loading history...
251
                }
252
            }
253
254
            // Add relationships to ZIP file
255 56
            $zip->addFromString('_rels/.rels', $this->getWriterPart('Rels')->writeRelationships($this->spreadSheet));
0 ignored issues
show
Bug introduced by
The method writeRelationships() does not exist on PhpOffice\PhpSpreadsheet\Writer\Xlsx\WriterPart. It seems like you code against a sub-type of PhpOffice\PhpSpreadsheet\Writer\Xlsx\WriterPart such as PhpOffice\PhpSpreadsheet\Writer\Xlsx\Rels. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

255
            $zip->addFromString('_rels/.rels', $this->getWriterPart('Rels')->/** @scrutinizer ignore-call */ writeRelationships($this->spreadSheet));
Loading history...
256 56
            $zip->addFromString('xl/_rels/workbook.xml.rels', $this->getWriterPart('Rels')->writeWorkbookRelationships($this->spreadSheet));
0 ignored issues
show
Bug introduced by
The method writeWorkbookRelationships() does not exist on PhpOffice\PhpSpreadsheet\Writer\Xlsx\WriterPart. It seems like you code against a sub-type of PhpOffice\PhpSpreadsheet\Writer\Xlsx\WriterPart such as PhpOffice\PhpSpreadsheet\Writer\Xlsx\Rels. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

256
            $zip->addFromString('xl/_rels/workbook.xml.rels', $this->getWriterPart('Rels')->/** @scrutinizer ignore-call */ writeWorkbookRelationships($this->spreadSheet));
Loading history...
257
258
            // Add document properties to ZIP file
259 56
            $zip->addFromString('docProps/app.xml', $this->getWriterPart('DocProps')->writeDocPropsApp($this->spreadSheet));
0 ignored issues
show
Bug introduced by
The method writeDocPropsApp() does not exist on PhpOffice\PhpSpreadsheet\Writer\Xlsx\WriterPart. It seems like you code against a sub-type of PhpOffice\PhpSpreadsheet\Writer\Xlsx\WriterPart such as PhpOffice\PhpSpreadsheet\Writer\Xlsx\DocProps. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

259
            $zip->addFromString('docProps/app.xml', $this->getWriterPart('DocProps')->/** @scrutinizer ignore-call */ writeDocPropsApp($this->spreadSheet));
Loading history...
260 56
            $zip->addFromString('docProps/core.xml', $this->getWriterPart('DocProps')->writeDocPropsCore($this->spreadSheet));
0 ignored issues
show
Bug introduced by
The method writeDocPropsCore() does not exist on PhpOffice\PhpSpreadsheet\Writer\Xlsx\WriterPart. It seems like you code against a sub-type of PhpOffice\PhpSpreadsheet\Writer\Xlsx\WriterPart such as PhpOffice\PhpSpreadsheet\Writer\Xlsx\DocProps. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

260
            $zip->addFromString('docProps/core.xml', $this->getWriterPart('DocProps')->/** @scrutinizer ignore-call */ writeDocPropsCore($this->spreadSheet));
Loading history...
261 56
            $customPropertiesPart = $this->getWriterPart('DocProps')->writeDocPropsCustom($this->spreadSheet);
0 ignored issues
show
Bug introduced by
The method writeDocPropsCustom() does not exist on PhpOffice\PhpSpreadsheet\Writer\Xlsx\WriterPart. It seems like you code against a sub-type of PhpOffice\PhpSpreadsheet\Writer\Xlsx\WriterPart such as PhpOffice\PhpSpreadsheet\Writer\Xlsx\DocProps. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

261
            $customPropertiesPart = $this->getWriterPart('DocProps')->/** @scrutinizer ignore-call */ writeDocPropsCustom($this->spreadSheet);
Loading history...
262 56
            if ($customPropertiesPart !== null) {
263 2
                $zip->addFromString('docProps/custom.xml', $customPropertiesPart);
264
            }
265
266
            // Add theme to ZIP file
267 56
            $zip->addFromString('xl/theme/theme1.xml', $this->getWriterPart('Theme')->writeTheme($this->spreadSheet));
0 ignored issues
show
Bug introduced by
The method writeTheme() does not exist on PhpOffice\PhpSpreadsheet\Writer\Xlsx\WriterPart. It seems like you code against a sub-type of PhpOffice\PhpSpreadsheet\Writer\Xlsx\WriterPart such as PhpOffice\PhpSpreadsheet\Writer\Xlsx\Theme. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

267
            $zip->addFromString('xl/theme/theme1.xml', $this->getWriterPart('Theme')->/** @scrutinizer ignore-call */ writeTheme($this->spreadSheet));
Loading history...
268
269
            // Add string table to ZIP file
270 56
            $zip->addFromString('xl/sharedStrings.xml', $this->getWriterPart('StringTable')->writeStringTable($this->stringTable));
0 ignored issues
show
Bug introduced by
The method writeStringTable() does not exist on PhpOffice\PhpSpreadsheet\Writer\Xlsx\WriterPart. It seems like you code against a sub-type of PhpOffice\PhpSpreadsheet\Writer\Xlsx\WriterPart such as PhpOffice\PhpSpreadsheet\Writer\Xlsx\StringTable. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

270
            $zip->addFromString('xl/sharedStrings.xml', $this->getWriterPart('StringTable')->/** @scrutinizer ignore-call */ writeStringTable($this->stringTable));
Loading history...
271
272
            // Add styles to ZIP file
273 56
            $zip->addFromString('xl/styles.xml', $this->getWriterPart('Style')->writeStyles($this->spreadSheet));
0 ignored issues
show
Bug introduced by
The method writeStyles() does not exist on PhpOffice\PhpSpreadsheet\Writer\Xlsx\WriterPart. It seems like you code against a sub-type of PhpOffice\PhpSpreadsheet\Writer\Xlsx\WriterPart such as PhpOffice\PhpSpreadsheet\Writer\Xlsx\Style. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

273
            $zip->addFromString('xl/styles.xml', $this->getWriterPart('Style')->/** @scrutinizer ignore-call */ writeStyles($this->spreadSheet));
Loading history...
274
275
            // Add workbook to ZIP file
276 56
            $zip->addFromString('xl/workbook.xml', $this->getWriterPart('Workbook')->writeWorkbook($this->spreadSheet, $this->preCalculateFormulas));
0 ignored issues
show
Bug introduced by
The method writeWorkbook() does not exist on PhpOffice\PhpSpreadsheet\Writer\Xlsx\WriterPart. It seems like you code against a sub-type of PhpOffice\PhpSpreadsheet\Writer\Xlsx\WriterPart such as PhpOffice\PhpSpreadsheet\Writer\Xlsx\Workbook. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

276
            $zip->addFromString('xl/workbook.xml', $this->getWriterPart('Workbook')->/** @scrutinizer ignore-call */ writeWorkbook($this->spreadSheet, $this->preCalculateFormulas));
Loading history...
277
278 56
            $chartCount = 0;
279
            // Add worksheets
280 56
            for ($i = 0; $i < $this->spreadSheet->getSheetCount(); ++$i) {
281 56
                $zip->addFromString('xl/worksheets/sheet' . ($i + 1) . '.xml', $this->getWriterPart('Worksheet')->writeWorksheet($this->spreadSheet->getSheet($i), $this->stringTable, $this->includeCharts));
0 ignored issues
show
Bug introduced by
The method writeWorksheet() does not exist on PhpOffice\PhpSpreadsheet\Writer\Xlsx\WriterPart. It seems like you code against a sub-type of PhpOffice\PhpSpreadsheet\Writer\Xlsx\WriterPart such as PhpOffice\PhpSpreadsheet\Writer\Xlsx\Worksheet. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

281
                $zip->addFromString('xl/worksheets/sheet' . ($i + 1) . '.xml', $this->getWriterPart('Worksheet')->/** @scrutinizer ignore-call */ writeWorksheet($this->spreadSheet->getSheet($i), $this->stringTable, $this->includeCharts));
Loading history...
282 56
                if ($this->includeCharts) {
283 14
                    $charts = $this->spreadSheet->getSheet($i)->getChartCollection();
284 14
                    if (count($charts) > 0) {
285 13
                        foreach ($charts as $chart) {
286 13
                            $zip->addFromString('xl/charts/chart' . ($chartCount + 1) . '.xml', $this->getWriterPart('Chart')->writeChart($chart, $this->preCalculateFormulas));
0 ignored issues
show
Bug introduced by
The method writeChart() does not exist on PhpOffice\PhpSpreadsheet\Writer\Xlsx\WriterPart. It seems like you code against a sub-type of PhpOffice\PhpSpreadsheet\Writer\Xlsx\WriterPart such as PhpOffice\PhpSpreadsheet\Writer\Xlsx\Chart or PhpOffice\PhpSpreadsheet\Writer\Xlsx\Drawing. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

286
                            $zip->addFromString('xl/charts/chart' . ($chartCount + 1) . '.xml', $this->getWriterPart('Chart')->/** @scrutinizer ignore-call */ writeChart($chart, $this->preCalculateFormulas));
Loading history...
287 13
                            ++$chartCount;
288
                        }
289
                    }
290
                }
291
            }
292
293 56
            $chartRef1 = $chartRef2 = 0;
0 ignored issues
show
Unused Code introduced by
The assignment to $chartRef2 is dead and can be removed.
Loading history...
294
            // Add worksheet relationships (drawings, ...)
295 56
            for ($i = 0; $i < $this->spreadSheet->getSheetCount(); ++$i) {
296
                // Add relationships
297 56
                $zip->addFromString('xl/worksheets/_rels/sheet' . ($i + 1) . '.xml.rels', $this->getWriterPart('Rels')->writeWorksheetRelationships($this->spreadSheet->getSheet($i), ($i + 1), $this->includeCharts));
0 ignored issues
show
Bug introduced by
The method writeWorksheetRelationships() does not exist on PhpOffice\PhpSpreadsheet\Writer\Xlsx\WriterPart. It seems like you code against a sub-type of PhpOffice\PhpSpreadsheet\Writer\Xlsx\WriterPart such as PhpOffice\PhpSpreadsheet\Writer\Xlsx\Rels. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

297
                $zip->addFromString('xl/worksheets/_rels/sheet' . ($i + 1) . '.xml.rels', $this->getWriterPart('Rels')->/** @scrutinizer ignore-call */ writeWorksheetRelationships($this->spreadSheet->getSheet($i), ($i + 1), $this->includeCharts));
Loading history...
298
299 56
                $drawings = $this->spreadSheet->getSheet($i)->getDrawingCollection();
300 56
                $drawingCount = count($drawings);
301 56
                if ($this->includeCharts) {
302 14
                    $chartCount = $this->spreadSheet->getSheet($i)->getChartCount();
303
                }
304
305
                // Add drawing and image relationship parts
306 56
                if (($drawingCount > 0) || ($chartCount > 0)) {
307
                    // Drawing relationships
308 22
                    $zip->addFromString('xl/drawings/_rels/drawing' . ($i + 1) . '.xml.rels', $this->getWriterPart('Rels')->writeDrawingRelationships($this->spreadSheet->getSheet($i), $chartRef1, $this->includeCharts));
0 ignored issues
show
Bug introduced by
The method writeDrawingRelationships() does not exist on PhpOffice\PhpSpreadsheet\Writer\Xlsx\WriterPart. It seems like you code against a sub-type of PhpOffice\PhpSpreadsheet\Writer\Xlsx\WriterPart such as PhpOffice\PhpSpreadsheet\Writer\Xlsx\Rels. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

308
                    $zip->addFromString('xl/drawings/_rels/drawing' . ($i + 1) . '.xml.rels', $this->getWriterPart('Rels')->/** @scrutinizer ignore-call */ writeDrawingRelationships($this->spreadSheet->getSheet($i), $chartRef1, $this->includeCharts));
Loading history...
309
310
                    // Drawings
311 22
                    $zip->addFromString('xl/drawings/drawing' . ($i + 1) . '.xml', $this->getWriterPart('Drawing')->writeDrawings($this->spreadSheet->getSheet($i), $this->includeCharts));
0 ignored issues
show
Bug introduced by
The method writeDrawings() does not exist on PhpOffice\PhpSpreadsheet\Writer\Xlsx\WriterPart. It seems like you code against a sub-type of PhpOffice\PhpSpreadsheet\Writer\Xlsx\WriterPart such as PhpOffice\PhpSpreadsheet\Writer\Xlsx\Drawing or PhpOffice\PhpSpreadsheet\Writer\Xlsx\Worksheet. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

311
                    $zip->addFromString('xl/drawings/drawing' . ($i + 1) . '.xml', $this->getWriterPart('Drawing')->/** @scrutinizer ignore-call */ writeDrawings($this->spreadSheet->getSheet($i), $this->includeCharts));
Loading history...
312
                }
313
314
                // Add comment relationship parts
315 56
                if (count($this->spreadSheet->getSheet($i)->getComments()) > 0) {
316
                    // VML Comments
317 9
                    $zip->addFromString('xl/drawings/vmlDrawing' . ($i + 1) . '.vml', $this->getWriterPart('Comments')->writeVMLComments($this->spreadSheet->getSheet($i)));
0 ignored issues
show
Bug introduced by
The method writeVMLComments() does not exist on PhpOffice\PhpSpreadsheet\Writer\Xlsx\WriterPart. It seems like you code against a sub-type of PhpOffice\PhpSpreadsheet\Writer\Xlsx\WriterPart such as PhpOffice\PhpSpreadsheet\Writer\Xlsx\Comments. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

317
                    $zip->addFromString('xl/drawings/vmlDrawing' . ($i + 1) . '.vml', $this->getWriterPart('Comments')->/** @scrutinizer ignore-call */ writeVMLComments($this->spreadSheet->getSheet($i)));
Loading history...
318
319
                    // Comments
320 9
                    $zip->addFromString('xl/comments' . ($i + 1) . '.xml', $this->getWriterPart('Comments')->writeComments($this->spreadSheet->getSheet($i)));
0 ignored issues
show
Bug introduced by
The method writeComments() does not exist on PhpOffice\PhpSpreadsheet\Writer\Xlsx\WriterPart. It seems like you code against a sub-type of PhpOffice\PhpSpreadsheet\Writer\Xlsx\WriterPart such as PhpOffice\PhpSpreadsheet\Writer\Xlsx\Comments. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

320
                    $zip->addFromString('xl/comments' . ($i + 1) . '.xml', $this->getWriterPart('Comments')->/** @scrutinizer ignore-call */ writeComments($this->spreadSheet->getSheet($i)));
Loading history...
321
                }
322
323
                // Add header/footer relationship parts
324 56
                if (count($this->spreadSheet->getSheet($i)->getHeaderFooter()->getImages()) > 0) {
325
                    // VML Drawings
326 1
                    $zip->addFromString('xl/drawings/vmlDrawingHF' . ($i + 1) . '.vml', $this->getWriterPart('Drawing')->writeVMLHeaderFooterImages($this->spreadSheet->getSheet($i)));
0 ignored issues
show
Bug introduced by
The method writeVMLHeaderFooterImages() does not exist on PhpOffice\PhpSpreadsheet\Writer\Xlsx\WriterPart. It seems like you code against a sub-type of PhpOffice\PhpSpreadsheet\Writer\Xlsx\WriterPart such as PhpOffice\PhpSpreadsheet\Writer\Xlsx\Drawing. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

326
                    $zip->addFromString('xl/drawings/vmlDrawingHF' . ($i + 1) . '.vml', $this->getWriterPart('Drawing')->/** @scrutinizer ignore-call */ writeVMLHeaderFooterImages($this->spreadSheet->getSheet($i)));
Loading history...
327
328
                    // VML Drawing relationships
329 1
                    $zip->addFromString('xl/drawings/_rels/vmlDrawingHF' . ($i + 1) . '.vml.rels', $this->getWriterPart('Rels')->writeHeaderFooterDrawingRelationships($this->spreadSheet->getSheet($i)));
0 ignored issues
show
Bug introduced by
The method writeHeaderFooterDrawingRelationships() does not exist on PhpOffice\PhpSpreadsheet\Writer\Xlsx\WriterPart. It seems like you code against a sub-type of PhpOffice\PhpSpreadsheet\Writer\Xlsx\WriterPart such as PhpOffice\PhpSpreadsheet\Writer\Xlsx\Rels. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

329
                    $zip->addFromString('xl/drawings/_rels/vmlDrawingHF' . ($i + 1) . '.vml.rels', $this->getWriterPart('Rels')->/** @scrutinizer ignore-call */ writeHeaderFooterDrawingRelationships($this->spreadSheet->getSheet($i)));
Loading history...
330
331
                    // Media
332 1
                    foreach ($this->spreadSheet->getSheet($i)->getHeaderFooter()->getImages() as $image) {
333 1
                        $zip->addFromString('xl/media/' . $image->getIndexedFilename(), file_get_contents($image->getPath()));
1 ignored issue
show
Bug introduced by
It seems like file_get_contents($image->getPath()) can also be of type false; however, parameter $contents of ZipArchive::addFromString() does only seem to accept string, maybe add an additional type check? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

333
                        $zip->addFromString('xl/media/' . $image->getIndexedFilename(), /** @scrutinizer ignore-type */ file_get_contents($image->getPath()));
Loading history...
334
                    }
335
                }
336
            }
337
338
            // Add media
339 56
            for ($i = 0; $i < $this->getDrawingHashTable()->count(); ++$i) {
340 10
                if ($this->getDrawingHashTable()->getByIndex($i) instanceof WorksheetDrawing) {
341 6
                    $imageContents = null;
342 6
                    $imagePath = $this->getDrawingHashTable()->getByIndex($i)->getPath();
1 ignored issue
show
Bug introduced by
The method getPath() does not exist on PhpOffice\PhpSpreadsheet\IComparable. It seems like you code against a sub-type of PhpOffice\PhpSpreadsheet\IComparable such as PhpOffice\PhpSpreadsheet\Worksheet\Drawing. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

342
                    $imagePath = $this->getDrawingHashTable()->getByIndex($i)->/** @scrutinizer ignore-call */ getPath();
Loading history...
343 6
                    if (strpos($imagePath, 'zip://') !== false) {
344 2
                        $imagePath = substr($imagePath, 6);
345 2
                        $imagePathSplitted = explode('#', $imagePath);
1 ignored issue
show
Bug introduced by
It seems like $imagePath can also be of type false; however, parameter $string of explode() does only seem to accept string, maybe add an additional type check? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

345
                        $imagePathSplitted = explode('#', /** @scrutinizer ignore-type */ $imagePath);
Loading history...
346
347 2
                        $imageZip = new ZipArchive();
348 2
                        $imageZip->open($imagePathSplitted[0]);
349 2
                        $imageContents = $imageZip->getFromName($imagePathSplitted[1]);
350 2
                        $imageZip->close();
351 2
                        unset($imageZip);
352
                    } else {
353 5
                        $imageContents = file_get_contents($imagePath);
354
                    }
355
356 6
                    $zip->addFromString('xl/media/' . str_replace(' ', '_', $this->getDrawingHashTable()->getByIndex($i)->getIndexedFilename()), $imageContents);
0 ignored issues
show
Bug introduced by
The method getIndexedFilename() does not exist on PhpOffice\PhpSpreadsheet\IComparable. It seems like you code against a sub-type of PhpOffice\PhpSpreadsheet\IComparable such as PhpOffice\PhpSpreadsheet\Worksheet\Drawing or PhpOffice\PhpSpreadsheet\Worksheet\MemoryDrawing. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

356
                    $zip->addFromString('xl/media/' . str_replace(' ', '_', $this->getDrawingHashTable()->getByIndex($i)->/** @scrutinizer ignore-call */ getIndexedFilename()), $imageContents);
Loading history...
357 4
                } elseif ($this->getDrawingHashTable()->getByIndex($i) instanceof MemoryDrawing) {
358 4
                    ob_start();
359 4
                    call_user_func(
360 4
                        $this->getDrawingHashTable()->getByIndex($i)->getRenderingFunction(),
1 ignored issue
show
Bug introduced by
The method getRenderingFunction() does not exist on PhpOffice\PhpSpreadsheet\IComparable. It seems like you code against a sub-type of PhpOffice\PhpSpreadsheet\IComparable such as PhpOffice\PhpSpreadsheet\Worksheet\MemoryDrawing. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

360
                        $this->getDrawingHashTable()->getByIndex($i)->/** @scrutinizer ignore-call */ getRenderingFunction(),
Loading history...
361 4
                        $this->getDrawingHashTable()->getByIndex($i)->getImageResource()
1 ignored issue
show
Bug introduced by
The method getImageResource() does not exist on PhpOffice\PhpSpreadsheet\IComparable. It seems like you code against a sub-type of PhpOffice\PhpSpreadsheet\IComparable such as PhpOffice\PhpSpreadsheet\Worksheet\MemoryDrawing. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

361
                        $this->getDrawingHashTable()->getByIndex($i)->/** @scrutinizer ignore-call */ getImageResource()
Loading history...
362
                    );
363 4
                    $imageContents = ob_get_contents();
364 4
                    ob_end_clean();
365
366 4
                    $zip->addFromString('xl/media/' . str_replace(' ', '_', $this->getDrawingHashTable()->getByIndex($i)->getIndexedFilename()), $imageContents);
367
                }
368
            }
369
370 56
            Functions::setReturnDateType($saveDateReturnType);
371 56
            Calculation::getInstance($this->spreadSheet)->getDebugLog()->setWriteDebugLog($saveDebugLog);
372
373
            // Close file
374 56
            if ($zip->close() === false) {
375
                throw new WriterException("Could not close zip file $pFilename.");
376
            }
377
378
            // If a temporary file was used, copy it to the correct file stream
379 56 View Code Duplication
            if ($originalFilename != $pFilename) {
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
380
                if (copy($pFilename, $originalFilename) === false) {
1 ignored issue
show
Bug introduced by
It seems like $pFilename can also be of type false; however, parameter $source of copy() does only seem to accept string, maybe add an additional type check? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

380
                if (copy(/** @scrutinizer ignore-type */ $pFilename, $originalFilename) === false) {
Loading history...
381
                    throw new WriterException("Could not copy temporary zip file $pFilename to $originalFilename.");
382
                }
383 56
                @unlink($pFilename);
1 ignored issue
show
Security Best Practice introduced by
It seems like you do not handle an error condition for unlink(). This can introduce security issues, and is generally not recommended. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unhandled  annotation

383
                /** @scrutinizer ignore-unhandled */ @unlink($pFilename);

If you suppress an error, we recommend checking for the error condition explicitly:

// For example instead of
@mkdir($dir);

// Better use
if (@mkdir($dir) === false) {
    throw new \RuntimeException('The directory '.$dir.' could not be created.');
}
Loading history...
384
            }
385
        } else {
386
            throw new WriterException('PhpSpreadsheet object unassigned.');
387
        }
388 56
    }
389
390
    /**
391
     * Get Spreadsheet object.
392
     *
393
     * @throws WriterException
394
     *
395
     * @return Spreadsheet
396
     */
397 56
    public function getSpreadsheet()
398
    {
399 56
        if ($this->spreadSheet !== null) {
400 56
            return $this->spreadSheet;
401
        }
402
403
        throw new WriterException('No Spreadsheet object assigned.');
404
    }
405
406
    /**
407
     * Set Spreadsheet object.
408
     *
409
     * @param Spreadsheet $spreadsheet PhpSpreadsheet object
410
     *
411
     * @return Xlsx
412
     */
413 57
    public function setSpreadsheet(Spreadsheet $spreadsheet)
414
    {
415 57
        $this->spreadSheet = $spreadsheet;
416
417 57
        return $this;
418
    }
419
420
    /**
421
     * Get string table.
422
     *
423
     * @return string[]
424
     */
425
    public function getStringTable()
426
    {
427
        return $this->stringTable;
428
    }
429
430
    /**
431
     * Get Style HashTable.
432
     *
433
     * @return HashTable
434
     */
435
    public function getStyleHashTable()
436
    {
437
        return $this->styleHashTable;
438
    }
439
440
    /**
441
     * Get Conditional HashTable.
442
     *
443
     * @return HashTable
444
     */
445 56
    public function getStylesConditionalHashTable()
446
    {
447 56
        return $this->stylesConditionalHashTable;
448
    }
449
450
    /**
451
     * Get Fill HashTable.
452
     *
453
     * @return HashTable
454
     */
455 56
    public function getFillHashTable()
456
    {
457 56
        return $this->fillHashTable;
458
    }
459
460
    /**
461
     * Get \PhpOffice\PhpSpreadsheet\Style\Font HashTable.
462
     *
463
     * @return HashTable
464
     */
465 56
    public function getFontHashTable()
466
    {
467 56
        return $this->fontHashTable;
468
    }
469
470
    /**
471
     * Get Borders HashTable.
472
     *
473
     * @return HashTable
474
     */
475 56
    public function getBordersHashTable()
476
    {
477 56
        return $this->bordersHashTable;
478
    }
479
480
    /**
481
     * Get NumberFormat HashTable.
482
     *
483
     * @return HashTable
484
     */
485 56
    public function getNumFmtHashTable()
486
    {
487 56
        return $this->numFmtHashTable;
488
    }
489
490
    /**
491
     * Get \PhpOffice\PhpSpreadsheet\Worksheet\Worksheet\BaseDrawing HashTable.
492
     *
493
     * @return HashTable
494
     */
495 56
    public function getDrawingHashTable()
496
    {
497 56
        return $this->drawingHashTable;
498
    }
499
500
    /**
501
     * Get Office2003 compatibility.
502
     *
503
     * @return bool
504
     */
505 56
    public function getOffice2003Compatibility()
506
    {
507 56
        return $this->office2003compatibility;
508
    }
509
510
    /**
511
     * Set Office2003 compatibility.
512
     *
513
     * @param bool $pValue Office2003 compatibility?
514
     *
515
     * @return Xlsx
516
     */
517
    public function setOffice2003Compatibility($pValue)
518
    {
519
        $this->office2003compatibility = $pValue;
520
521
        return $this;
522
    }
523
}
524