/** * Add a paragraph style * * @param string $styleName * @param array $styles */ public static function addParagraphStyle($styleName, $styles) { require_once __DIR__ . '/Style/Paragraph.php'; if (!array_key_exists($styleName, self::$_styleElements)) { $style = new Document_Word_Writer_Style_Paragraph(); foreach ($styles as $key => $value) { if (substr($key, 0, 1) != '_') { $key = '_' . $key; } $style->setStyleValue($key, $value); } self::$_styleElements[$styleName] = $style; } }
public function __construct($type = 'text', $styleParagraph = null) { $this->_type = $type; $this->_name = 'Arial'; $this->_size = 20; $this->_bold = false; $this->_italic = false; $this->_superScript = false; $this->_subScript = false; $this->_underline = Document_Word_Writer_Style_Font::UNDERLINE_NONE; $this->_strikethrough = false; $this->_color = '000000'; $this->_fgColor = null; if (!is_null($styleParagraph)) { require_once __DIR__ . '/Paragraph.php'; $paragraph = new Document_Word_Writer_Style_Paragraph(); foreach ($styleParagraph as $key => $value) { if (substr($key, 0, 1) != '_') { $key = '_' . $key; } $paragraph->setStyleValue($key, $value); } $this->_paragraphStyle = $paragraph; } else { $this->_paragraphStyle = null; } }