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:  * Class PHPWord_Style_Font
 30:  */
 31: class PHPWord_Style_Font
 32: {
 33: 
 34:     const UNDERLINE_NONE = 'none';
 35:     const UNDERLINE_DASH = 'dash';
 36:     const UNDERLINE_DASHHEAVY = 'dashHeavy';
 37:     const UNDERLINE_DASHLONG = 'dashLong';
 38:     const UNDERLINE_DASHLONGHEAVY = 'dashLongHeavy';
 39:     const UNDERLINE_DOUBLE = 'dbl';
 40:     const UNDERLINE_DOTHASH = 'dotDash';
 41:     const UNDERLINE_DOTHASHHEAVY = 'dotDashHeavy';
 42:     const UNDERLINE_DOTDOTDASH = 'dotDotDash';
 43:     const UNDERLINE_DOTDOTDASHHEAVY = 'dotDotDashHeavy';
 44:     const UNDERLINE_DOTTED = 'dotted';
 45:     const UNDERLINE_DOTTEDHEAVY = 'dottedHeavy';
 46:     const UNDERLINE_HEAVY = 'heavy';
 47:     const UNDERLINE_SINGLE = 'single';
 48:     const UNDERLINE_WAVY = 'wavy';
 49:     const UNDERLINE_WAVYDOUBLE = 'wavyDbl';
 50:     const UNDERLINE_WAVYHEAVY = 'wavyHeavy';
 51:     const UNDERLINE_WORDS = 'words';
 52: 
 53:     const FGCOLOR_YELLOW = 'yellow';
 54:     const FGCOLOR_LIGHTGREEN = 'green';
 55:     const FGCOLOR_CYAN = 'cyan';
 56:     const FGCOLOR_MAGENTA = 'magenta';
 57:     const FGCOLOR_BLUE = 'blue';
 58:     const FGCOLOR_RED = 'red';
 59:     const FGCOLOR_DARKBLUE = 'darkBlue';
 60:     const FGCOLOR_DARKCYAN = 'darkCyan';
 61:     const FGCOLOR_DARKGREEN = 'darkGreen';
 62:     const FGCOLOR_DARKMAGENTA = 'darkMagenta';
 63:     const FGCOLOR_DARKRED = 'darkRed';
 64:     const FGCOLOR_DARKYELLOW = 'darkYellow';
 65:     const FGCOLOR_DARKGRAY = 'darkGray';
 66:     const FGCOLOR_LIGHTGRAY = 'lightGray';
 67:     const FGCOLOR_BLACK = 'black';
 68: 
 69:     /**
 70:      * Font style type
 71:      *
 72:      * @var string
 73:      */
 74:     private $_type;
 75: 
 76:     /**
 77:      * Paragraph Style
 78:      *
 79:      * @var PHPWord_Style_Paragraph
 80:      */
 81:     private $_paragraphStyle;
 82: 
 83:     private $_size;
 84:     private $_name;
 85:     private $_bold;
 86:     private $_italic;
 87:     private $_superScript;
 88:     private $_subScript;
 89:     private $_underline;
 90:     private $_strikethrough;
 91:     private $_color;
 92:     private $_fgColor;
 93: 
 94:     public function __construct($type = 'text', $styleParagraph = null)
 95:     {
 96:         $this->_type = $type;
 97:         $this->_name = PHPWord::DEFAULT_FONT_NAME;
 98:         $this->_size = PHPWord::DEFAULT_FONT_SIZE;
 99:         $this->_bold = false;
100:         $this->_italic = false;
101:         $this->_superScript = false;
102:         $this->_subScript = false;
103:         $this->_underline = PHPWord_Style_Font::UNDERLINE_NONE;
104:         $this->_strikethrough = false;
105:         $this->_color = '000000';
106:         $this->_fgColor = null;
107: 
108:         if (!is_null($styleParagraph)) {
109:             $paragraph = new PHPWord_Style_Paragraph();
110:             foreach ($styleParagraph as $key => $value) {
111:                 if (substr($key, 0, 1) != '_') {
112:                     $key = '_' . $key;
113:                 }
114:                 $paragraph->setStyleValue($key, $value);
115:             }
116:             $this->_paragraphStyle = $paragraph;
117:         } else {
118:             $this->_paragraphStyle = null;
119:         }
120:     }
121: 
122:     public function getName()
123:     {
124:         return $this->_name;
125:     }
126: 
127:     public function setStyleValue($key, $value)
128:     {
129:         if ($key == '_size') {
130:             $value *= 2;
131:         }
132:         $this->$key = $value;
133:     }
134: 
135:     public function setName($pValue = PHPWord::DEFAULT_FONT_NAME)
136:     {
137:         if ($pValue == '') {
138:             $pValue = PHPWord::DEFAULT_FONT_NAME;
139:         }
140:         $this->_name = $pValue;
141:         return $this;
142:     }
143: 
144:     public function getSize()
145:     {
146:         return $this->_size;
147:     }
148: 
149:     public function setSize($pValue = PHPWord::DEFAULT_FONT_SIZE)
150:     {
151:         if ($pValue == '') {
152:             $pValue = PHPWord::DEFAULT_FONT_SIZE;
153:         }
154:         $this->_size = ($pValue * 2);
155:         return $this;
156:     }
157: 
158:     public function getBold()
159:     {
160:         return $this->_bold;
161:     }
162: 
163:     public function setBold($pValue = false)
164:     {
165:         if ($pValue == '') {
166:             $pValue = false;
167:         }
168:         $this->_bold = $pValue;
169:         return $this;
170:     }
171: 
172:     public function getItalic()
173:     {
174:         return $this->_italic;
175:     }
176: 
177:     public function setItalic($pValue = false)
178:     {
179:         if ($pValue == '') {
180:             $pValue = false;
181:         }
182:         $this->_italic = $pValue;
183:         return $this;
184:     }
185: 
186:     public function getSuperScript()
187:     {
188:         return $this->_superScript;
189:     }
190: 
191:     public function setSuperScript($pValue = false)
192:     {
193:         if ($pValue == '') {
194:             $pValue = false;
195:         }
196:         $this->_superScript = $pValue;
197:         $this->_subScript = !$pValue;
198:         return $this;
199:     }
200: 
201:     public function getSubScript()
202:     {
203:         return $this->_subScript;
204:     }
205: 
206:     public function setSubScript($pValue = false)
207:     {
208:         if ($pValue == '') {
209:             $pValue = false;
210:         }
211:         $this->_subScript = $pValue;
212:         $this->_superScript = !$pValue;
213:         return $this;
214:     }
215: 
216:     public function getUnderline()
217:     {
218:         return $this->_underline;
219:     }
220: 
221:     public function setUnderline($pValue = PHPWord_Style_Font::UNDERLINE_NONE)
222:     {
223:         if ($pValue == '') {
224:             $pValue = PHPWord_Style_Font::UNDERLINE_NONE;
225:         }
226:         $this->_underline = $pValue;
227:         return $this;
228:     }
229: 
230:     public function getStrikethrough()
231:     {
232:         return $this->_strikethrough;
233:     }
234: 
235:     public function setStrikethrough($pValue = false)
236:     {
237:         if ($pValue == '') {
238:             $pValue = false;
239:         }
240:         $this->_strikethrough = $pValue;
241:         return $this;
242:     }
243: 
244:     public function getColor()
245:     {
246:         return $this->_color;
247:     }
248: 
249:     public function setColor($pValue = '000000')
250:     {
251:         $this->_color = $pValue;
252:         return $this;
253:     }
254: 
255:     public function getFgColor()
256:     {
257:         return $this->_fgColor;
258:     }
259: 
260:     public function setFgColor($pValue = null)
261:     {
262:         $this->_fgColor = $pValue;
263:         return $this;
264:     }
265: 
266:     public function getStyleType()
267:     {
268:         return $this->_type;
269:     }
270: 
271:     /**
272:      * Get Paragraph style
273:      *
274:      * @return PHPWord_Style_Paragraph
275:      */
276:     public function getParagraphStyle()
277:     {
278:         return $this->_paragraphStyle;
279:     }
280: }
281: 
PHPWord API Docs API documentation generated by ApiGen 2.8.0