Overview

Packages

  • PHP
  • PHPWord

Classes

  • PHPWord
  • PHPWord_Autoloader
  • PHPWord_DocumentProperties
  • PHPWord_HashTable
  • PHPWord_IOFactory
  • PHPWord_Media
  • PHPWord_Section
  • PHPWord_Section_Footer
  • PHPWord_Section_Footer_PreserveText
  • PHPWord_Section_Header
  • PHPWord_Section_Image
  • PHPWord_Section_Link
  • PHPWord_Section_ListItem
  • PHPWord_Section_MemoryImage
  • PHPWord_Section_Object
  • PHPWord_Section_PageBreak
  • PHPWord_Section_Settings
  • PHPWord_Section_Table
  • PHPWord_Section_Table_Cell
  • PHPWord_Section_Table_Row
  • PHPWord_Section_Text
  • PHPWord_Section_TextBreak
  • PHPWord_Section_TextRun
  • PHPWord_Section_Title
  • PHPWord_Shared_Drawing
  • PHPWord_Shared_File
  • PHPWord_Shared_Font
  • PHPWord_Shared_String
  • PHPWord_Shared_XMLWriter
  • PHPWord_Shared_ZipStreamWrapper
  • PHPWord_Style
  • PHPWord_Style_Cell
  • PHPWord_Style_Font
  • PHPWord_Style_Image
  • PHPWord_Style_ListItem
  • PHPWord_Style_Paragraph
  • PHPWord_Style_Row
  • PHPWord_Style_Tab
  • PHPWord_Style_Table
  • PHPWord_Style_TableFull
  • PHPWord_Style_Tabs
  • PHPWord_Style_TOC
  • PHPWord_Template
  • PHPWord_TOC
  • PHPWord_Writer_ODText
  • PHPWord_Writer_ODText_Content
  • PHPWord_Writer_ODText_Manifest
  • PHPWord_Writer_ODText_Meta
  • PHPWord_Writer_ODText_Mimetype
  • PHPWord_Writer_ODText_Styles
  • PHPWord_Writer_ODText_WriterPart
  • PHPWord_Writer_RTF
  • PHPWord_Writer_Word2007
  • PHPWord_Writer_Word2007_Base
  • PHPWord_Writer_Word2007_ContentTypes
  • PHPWord_Writer_Word2007_DocProps
  • PHPWord_Writer_Word2007_Document
  • PHPWord_Writer_Word2007_DocumentRels
  • PHPWord_Writer_Word2007_Footer
  • PHPWord_Writer_Word2007_Header
  • PHPWord_Writer_Word2007_Rels
  • PHPWord_Writer_Word2007_Styles
  • PHPWord_Writer_Word2007_WriterPart

Interfaces

  • PHPWord_Writer_IWriter

Exceptions

  • PHPWord_Exception
  • Overview
  • Package
  • Class
  • Tree
  1: <?php
  2: /**
  3:  * PHPWord
  4:  *
  5:  * Copyright (c) 2013 PHPWord
  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   PHPWord
 22:  * @package    PHPWord
 23:  * @copyright  Copyright (c) 2013 PHPWord
 24:  * @license    http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt    LGPL
 25:  * @version    0.7.0
 26:  */
 27: 
 28: /**
 29:  * PHPWord_Style_Paragraph
 30:  */
 31: class PHPWord_Style_Paragraph
 32: {
 33: 
 34:     /**
 35:      * Paragraph alignment
 36:      *
 37:      * @var string
 38:      */
 39:     private $_align;
 40: 
 41:     /**
 42:      * Space before Paragraph
 43:      *
 44:      * @var int
 45:      */
 46:     private $_spaceBefore;
 47: 
 48:     /**
 49:      * Space after Paragraph
 50:      *
 51:      * @var int
 52:      */
 53:     private $_spaceAfter;
 54: 
 55:     /**
 56:      * Spacing between breaks
 57:      *
 58:      * @var int
 59:      */
 60:     private $_spacing;
 61: 
 62:     /**
 63:      * Set of Custom Tab Stops
 64:      *
 65:      * @var array
 66:      */
 67:     private $_tabs;
 68: 
 69:     /**
 70:      * Indent by how much
 71:      *
 72:      * @var int
 73:      */
 74:     private $_indent;
 75: 
 76:     /**
 77:      * Hanging by how much
 78:      *
 79:      * @var int
 80:      */
 81:     private $_hanging;
 82: 
 83:     /**
 84:      * New Paragraph Style
 85:      */
 86:     public function __construct()
 87:     {
 88:         $this->_align = null;
 89:         $this->_spaceBefore = null;
 90:         $this->_spaceAfter = null;
 91:         $this->_spacing = null;
 92:         $this->_tabs = null;
 93:         $this->_indent = null;
 94:         $this->_hanging = null;
 95:     }
 96: 
 97:     /**
 98:      * Set Style value
 99:      *
100:      * @param string $key
101:      * @param mixed $value
102:      */
103:     public function setStyleValue($key, $value)
104:     {
105:         if ($key == '_indent') {
106:             $value = $value * 720; // 720 twips per indent
107:         }
108:         if ($key == '_hanging') {
109:             $value = $value * 720;
110:         }
111:         if ($key == '_spacing') {
112:             $value += 240; // because line height of 1 matches 240 twips
113:         }
114:         if ($key === '_tabs') {
115:             $value = new PHPWord_Style_Tabs($value);
116:         }
117:         $this->$key = $value;
118:     }
119: 
120:     /**
121:      * Get Paragraph Alignment
122:      *
123:      * @return string
124:      */
125:     public function getAlign()
126:     {
127:         return $this->_align;
128:     }
129: 
130:     /**
131:      * Set Paragraph Alignment
132:      *
133:      * @param string $pValue
134:      * @return PHPWord_Style_Paragraph
135:      */
136:     public function setAlign($pValue = null)
137:     {
138:         if (strtolower($pValue) == 'justify') {
139:             // justify becames both
140:             $pValue = 'both';
141:         }
142:         $this->_align = $pValue;
143:         return $this;
144:     }
145: 
146:     /**
147:      * Get Space before Paragraph
148:      *
149:      * @return string
150:      */
151:     public function getSpaceBefore()
152:     {
153:         return $this->_spaceBefore;
154:     }
155: 
156:     /**
157:      * Set Space before Paragraph
158:      *
159:      * @param int $pValue
160:      * @return PHPWord_Style_Paragraph
161:      */
162:     public function setSpaceBefore($pValue = null)
163:     {
164:         $this->_spaceBefore = $pValue;
165:         return $this;
166:     }
167: 
168:     /**
169:      * Get Space after Paragraph
170:      *
171:      * @return string
172:      */
173:     public function getSpaceAfter()
174:     {
175:         return $this->_spaceAfter;
176:     }
177: 
178:     /**
179:      * Set Space after Paragraph
180:      *
181:      * @param int $pValue
182:      * @return PHPWord_Style_Paragraph
183:      */
184:     public function setSpaceAfter($pValue = null)
185:     {
186:         $this->_spaceAfter = $pValue;
187:         return $this;
188:     }
189: 
190:     /**
191:      * Get Spacing between breaks
192:      *
193:      * @return int
194:      */
195:     public function getSpacing()
196:     {
197:         return $this->_spacing;
198:     }
199: 
200:     /**
201:      * Set Spacing between breaks
202:      *
203:      * @param int $pValue
204:      * @return PHPWord_Style_Paragraph
205:      */
206:     public function setSpacing($pValue = null)
207:     {
208:         $this->_spacing = $pValue;
209:         return $this;
210:     }
211: 
212:     /**
213:      * Get indentation
214:      *
215:      * @return int
216:      */
217:     public function getIndent()
218:     {
219:         return $this->_indent;
220:     }
221: 
222:     /**
223:      * Set indentation
224:      *
225:      * @param int $pValue
226:      * @return PHPWord_Style_Paragraph
227:      */
228:     public function setIndent($pValue = null)
229:     {
230:         $this->_indent = $pValue;
231:         return $this;
232:     }
233: 
234:     /**
235:      * Set hanging
236:      *
237:      * @param int $pValue
238:      * @return PHPWord_Style_Paragraph
239:      */
240:     public function setHanging($pValue = null)
241:     {
242:         $this->_hanging = $pValue;
243:         return $this;
244:     }
245: 
246:     /**
247:      * Get hanging
248:      *
249:      * @return int
250:      */
251:     public function getHanging()
252:     {
253:         return $this->_hanging;
254:     }
255: 
256:     /**
257:      * Get tabs
258:      *
259:      * @return PHPWord_Style_Tabs
260:      */
261:     public function getTabs()
262:     {
263:         return $this->_tabs;
264:     }
265: }
PHPWord API Docs API documentation generated by ApiGen 2.8.0