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