Blame view

addons/fastflow/library/PHPWord-master/src/PhpWord/Style/Cell.php 6.53 KB
2db47680   hexiaodong   chore: 初始提交 php 遗...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
  <?php
  /**
   * This file is part of PHPWord - A pure PHP library for reading and writing
   * word processing documents.
   *
   * PHPWord is free software distributed under the terms of the GNU Lesser
   * General Public License version 3 as published by the Free Software Foundation.
   *
   * For the full copyright and license information, please read the LICENSE
   * file that was distributed with this source code. For the full list of
   * contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
   *
   * @see         https://github.com/PHPOffice/PHPWord
   * @copyright   2010-2018 PHPWord contributors
   * @license     http://www.gnu.org/licenses/lgpl.txt LGPL version 3
   */
  
  namespace PhpOffice\PhpWord\Style;
  
  use PhpOffice\PhpWord\SimpleType\TblWidth;
  use PhpOffice\PhpWord\SimpleType\VerticalJc;
  
  /**
   * Table cell style
   */
  class Cell extends Border
  {
      /**
       * Vertical alignment constants
       *
       * @const string
       * @deprecated Use \PhpOffice\PhpWord\SimpleType\VerticalJc::TOP instead
       */
      const VALIGN_TOP = 'top';
      /**
       * @deprecated Use \PhpOffice\PhpWord\SimpleType\VerticalJc::CENTER instead
       */
      const VALIGN_CENTER = 'center';
      /**
       * @deprecated Use \PhpOffice\PhpWord\SimpleType\VerticalJc::BOTTOM instead
       */
      const VALIGN_BOTTOM = 'bottom';
      /**
       * @deprecated Use \PhpOffice\PhpWord\SimpleType\VerticalJc::BOTH instead
       */
      const VALIGN_BOTH = 'both';
  
      //Text direction constants
      /**
       * Left to Right, Top to Bottom
       */
      const TEXT_DIR_LRTB = 'lrTb';
      /**
       * Top to Bottom, Right to Left
       */
      const TEXT_DIR_TBRL = 'tbRl';
      /**
       * Bottom to Top, Left to Right
       */
      const TEXT_DIR_BTLR = 'btLr';
      /**
       * Left to Right, Top to Bottom Rotated
       */
      const TEXT_DIR_LRTBV = 'lrTbV';
      /**
       * Top to Bottom, Right to Left Rotated
       */
      const TEXT_DIR_TBRLV = 'tbRlV';
      /**
       * Top to Bottom, Left to Right Rotated
       */
      const TEXT_DIR_TBLRV = 'tbLrV';
  
      /**
       * Vertical merge (rowspan) constants
       *
       * @const string
       */
      const VMERGE_RESTART = 'restart';
      const VMERGE_CONTINUE = 'continue';
  
      /**
       * Default border color
       *
       * @const string
       */
      const DEFAULT_BORDER_COLOR = '000000';
  
      /**
       * Vertical align (top, center, both, bottom)
       *
       * @var string
       */
      private $vAlign;
  
      /**
       * Text Direction
       *
       * @var string
       */
      private $textDirection;
  
      /**
       * colspan
       *
       * @var int
       */
      private $gridSpan;
  
      /**
       * rowspan (restart, continue)
       *
       * - restart: Start/restart merged region
       * - continue: Continue merged region
       *
       * @var string
       */
      private $vMerge;
  
      /**
       * Shading
       *
       * @var \PhpOffice\PhpWord\Style\Shading
       */
      private $shading;
  
      /**
       * Width
       *
       * @var int
       */
      private $width;
  
      /**
       * Width unit
       *
       * @var string
       */
      private $unit = TblWidth::TWIP;
  
      /**
       * Get vertical align.
       *
       * @return string
       */
      public function getVAlign()
      {
          return $this->vAlign;
      }
  
      /**
       * Set vertical align
       *
       * @param string $value
       * @return self
       */
      public function setVAlign($value = null)
      {
          VerticalJc::validate($value);
          $this->vAlign = $this->setEnumVal($value, VerticalJc::values(), $this->vAlign);
  
          return $this;
      }
  
      /**
       * Get text direction.
       *
       * @return string
       */
      public function getTextDirection()
      {
          return $this->textDirection;
      }
  
      /**
       * Set text direction
       *
       * @param string $value
       * @return self
       */
      public function setTextDirection($value = null)
      {
          $enum = array(self::TEXT_DIR_BTLR, self::TEXT_DIR_TBRL);
          $this->textDirection = $this->setEnumVal($value, $enum, $this->textDirection);
  
          return $this;
      }
  
      /**
       * Get background
       *
       * @return string
       */
      public function getBgColor()
      {
          if ($this->shading !== null) {
              return $this->shading->getFill();
          }
  
          return null;
      }
  
      /**
       * Set background
       *
       * @param string $value
       * @return self
       */
      public function setBgColor($value = null)
      {
          return $this->setShading(array('fill' => $value));
      }
  
      /**
       * Get grid span (colspan).
       *
       * @return int
       */
      public function getGridSpan()
      {
          return $this->gridSpan;
      }
  
      /**
       * Set grid span (colspan)
       *
       * @param int $value
       * @return self
       */
      public function setGridSpan($value = null)
      {
          $this->gridSpan = $this->setIntVal($value, $this->gridSpan);
  
          return $this;
      }
  
      /**
       * Get vertical merge (rowspan).
       *
       * @return string
       */
      public function getVMerge()
      {
          return $this->vMerge;
      }
  
      /**
       * Set vertical merge (rowspan)
       *
       * @param string $value
       * @return self
       */
      public function setVMerge($value = null)
      {
          $enum = array(self::VMERGE_RESTART, self::VMERGE_CONTINUE);
          $this->vMerge = $this->setEnumVal($value, $enum, $this->vMerge);
  
          return $this;
      }
  
      /**
       * Get shading
       *
       * @return \PhpOffice\PhpWord\Style\Shading
       */
      public function getShading()
      {
          return $this->shading;
      }
  
      /**
       * Set shading
       *
       * @param mixed $value
       * @return self
       */
      public function setShading($value = null)
      {
          $this->setObjectVal($value, 'Shading', $this->shading);
  
          return $this;
      }
  
      /**
       * Get cell width
       *
       * @return int
       */
      public function getWidth()
      {
          return $this->width;
      }
  
      /**
       * Set cell width
       *
       * @param int $value
       * @return self
       */
      public function setWidth($value)
      {
          $this->setIntVal($value);
  
          return $this;
      }
  
      /**
       * Get width unit
       *
       * @return string
       */
      public function getUnit()
      {
          return $this->unit;
      }
  
      /**
       * Set width unit
       *
       * @param string $value
       */
      public function setUnit($value)
      {
          $this->unit = $this->setEnumVal($value, array(TblWidth::AUTO, TblWidth::PERCENT, TblWidth::TWIP), TblWidth::TWIP);
  
          return $this;
      }
  
      /**
       * Get default border color
       *
       * @deprecated 0.10.0
       *
       * @codeCoverageIgnore
       */
      public function getDefaultBorderColor()
      {
          return self::DEFAULT_BORDER_COLOR;
      }
  }