~begerega/ihris-chw-sl/trunk

« back to all changes in this revision

Viewing changes to tools/PHPExcel/PHPExcel/Writer/Abstract.php

  • Committer: Ese Egerega
  • Date: 2018-05-03 14:17:04 UTC
  • Revision ID: egerega@gmail.com-20180503141704-3br8dto013rgx65x
Initial import of Sierra Leone  CHW registry

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
<?php
 
2
 
 
3
/**
 
4
 * PHPExcel_Writer_Abstract
 
5
 *
 
6
 * Copyright (c) 2006 - 2015 PHPExcel
 
7
 *
 
8
 * This library is free software; you can redistribute it and/or
 
9
 * modify it under the terms of the GNU Lesser General Public
 
10
 * License as published by the Free Software Foundation; either
 
11
 * version 2.1 of the License, or (at your option) any later version.
 
12
 *
 
13
 * This library is distributed in the hope that it will be useful,
 
14
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
15
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 
16
 * Lesser General Public License for more details.
 
17
 *
 
18
 * You should have received a copy of the GNU Lesser General Public
 
19
 * License along with this library; if not, write to the Free Software
 
20
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
 
21
 *
 
22
 * @category   PHPExcel
 
23
 * @package    PHPExcel_Writer
 
24
 * @copyright  Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
 
25
 * @license    http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt    LGPL
 
26
 * @version    ##VERSION##, ##DATE##
 
27
 */
 
28
abstract class PHPExcel_Writer_Abstract implements PHPExcel_Writer_IWriter
 
29
{
 
30
    /**
 
31
     * Write charts that are defined in the workbook?
 
32
     * Identifies whether the Writer should write definitions for any charts that exist in the PHPExcel object;
 
33
     *
 
34
     * @var    boolean
 
35
     */
 
36
    protected $includeCharts = false;
 
37
 
 
38
    /**
 
39
     * Pre-calculate formulas
 
40
     * Forces PHPExcel to recalculate all formulae in a workbook when saving, so that the pre-calculated values are
 
41
     *    immediately available to MS Excel or other office spreadsheet viewer when opening the file
 
42
     *
 
43
     * @var boolean
 
44
     */
 
45
    protected $preCalculateFormulas = true;
 
46
 
 
47
    /**
 
48
     * Use disk caching where possible?
 
49
     *
 
50
     * @var boolean
 
51
     */
 
52
    protected $_useDiskCaching = false;
 
53
 
 
54
    /**
 
55
     * Disk caching directory
 
56
     *
 
57
     * @var string
 
58
     */
 
59
    protected $_diskCachingDirectory    = './';
 
60
 
 
61
    /**
 
62
     * Write charts in workbook?
 
63
     *        If this is true, then the Writer will write definitions for any charts that exist in the PHPExcel object.
 
64
     *        If false (the default) it will ignore any charts defined in the PHPExcel object.
 
65
     *
 
66
     * @return    boolean
 
67
     */
 
68
    public function getIncludeCharts()
 
69
    {
 
70
        return $this->includeCharts;
 
71
    }
 
72
 
 
73
    /**
 
74
     * Set write charts in workbook
 
75
     *        Set to true, to advise the Writer to include any charts that exist in the PHPExcel object.
 
76
     *        Set to false (the default) to ignore charts.
 
77
     *
 
78
     * @param    boolean    $pValue
 
79
     * @return    PHPExcel_Writer_IWriter
 
80
     */
 
81
    public function setIncludeCharts($pValue = false)
 
82
    {
 
83
        $this->includeCharts = (boolean) $pValue;
 
84
        return $this;
 
85
    }
 
86
 
 
87
    /**
 
88
     * Get Pre-Calculate Formulas flag
 
89
     *     If this is true (the default), then the writer will recalculate all formulae in a workbook when saving,
 
90
     *        so that the pre-calculated values are immediately available to MS Excel or other office spreadsheet
 
91
     *        viewer when opening the file
 
92
     *     If false, then formulae are not calculated on save. This is faster for saving in PHPExcel, but slower
 
93
     *        when opening the resulting file in MS Excel, because Excel has to recalculate the formulae itself
 
94
     *
 
95
     * @return boolean
 
96
     */
 
97
    public function getPreCalculateFormulas()
 
98
    {
 
99
        return $this->preCalculateFormulas;
 
100
    }
 
101
 
 
102
    /**
 
103
     * Set Pre-Calculate Formulas
 
104
     *        Set to true (the default) to advise the Writer to calculate all formulae on save
 
105
     *        Set to false to prevent precalculation of formulae on save.
 
106
     *
 
107
     * @param boolean $pValue    Pre-Calculate Formulas?
 
108
     * @return    PHPExcel_Writer_IWriter
 
109
     */
 
110
    public function setPreCalculateFormulas($pValue = true)
 
111
    {
 
112
        $this->preCalculateFormulas = (boolean) $pValue;
 
113
        return $this;
 
114
    }
 
115
 
 
116
    /**
 
117
     * Get use disk caching where possible?
 
118
     *
 
119
     * @return boolean
 
120
     */
 
121
    public function getUseDiskCaching()
 
122
    {
 
123
        return $this->_useDiskCaching;
 
124
    }
 
125
 
 
126
    /**
 
127
     * Set use disk caching where possible?
 
128
     *
 
129
     * @param     boolean     $pValue
 
130
     * @param    string        $pDirectory        Disk caching directory
 
131
     * @throws    PHPExcel_Writer_Exception    when directory does not exist
 
132
     * @return PHPExcel_Writer_Excel2007
 
133
     */
 
134
    public function setUseDiskCaching($pValue = false, $pDirectory = null)
 
135
    {
 
136
        $this->_useDiskCaching = $pValue;
 
137
 
 
138
        if ($pDirectory !== null) {
 
139
            if (is_dir($pDirectory)) {
 
140
                $this->_diskCachingDirectory = $pDirectory;
 
141
            } else {
 
142
                throw new PHPExcel_Writer_Exception("Directory does not exist: $pDirectory");
 
143
            }
 
144
        }
 
145
        return $this;
 
146
    }
 
147
 
 
148
    /**
 
149
     * Get disk caching directory
 
150
     *
 
151
     * @return string
 
152
     */
 
153
    public function getDiskCachingDirectory()
 
154
    {
 
155
        return $this->_diskCachingDirectory;
 
156
    }
 
157
}