1<?php
2
3namespace Box\Spout\Writer\XLSX;
4
5use Box\Spout\Writer\Common\Entity\Options;
6use Box\Spout\Writer\WriterMultiSheetsAbstract;
7
8/**
9 * Class Writer
10 * This class provides base support to write data to XLSX files
11 */
12class Writer extends WriterMultiSheetsAbstract
13{
14    /** @var string Content-Type value for the header */
15    protected static $headerContentType = 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet';
16
17    /**
18     * Sets a custom temporary folder for creating intermediate files/folders.
19     * This must be set before opening the writer.
20     *
21     * @param string $tempFolder Temporary folder where the files to create the XLSX will be stored
22     * @throws \Box\Spout\Writer\Exception\WriterAlreadyOpenedException If the writer was already opened
23     * @return Writer
24     */
25    public function setTempFolder($tempFolder)
26    {
27        $this->throwIfWriterAlreadyOpened('Writer must be configured before opening it.');
28
29        $this->optionsManager->setOption(Options::TEMP_FOLDER, $tempFolder);
30
31        return $this;
32    }
33
34    /**
35     * Use inline string to be more memory efficient. If set to false, it will use shared strings.
36     * This must be set before opening the writer.
37     *
38     * @param bool $shouldUseInlineStrings Whether inline or shared strings should be used
39     * @throws \Box\Spout\Writer\Exception\WriterAlreadyOpenedException If the writer was already opened
40     * @return Writer
41     */
42    public function setShouldUseInlineStrings($shouldUseInlineStrings)
43    {
44        $this->throwIfWriterAlreadyOpened('Writer must be configured before opening it.');
45
46        $this->optionsManager->setOption(Options::SHOULD_USE_INLINE_STRINGS, $shouldUseInlineStrings);
47
48        return $this;
49    }
50}
51