_properties = new DocumentProperties(); $this->_defaultFontName = PHPWord::DEFAULT_FONT_NAME; $this->_defaultFontSize = PHPWord::DEFAULT_FONT_SIZE; } /** * Get properties * @return PhpOffice\PhpWord\DocumentProperties */ public function getProperties() { return $this->_properties; } /** * Set properties * * @param PhpOffice\PhpWord\DocumentProperties $value * @return PhpOffice\PHPWord */ public function setProperties(DocumentProperties $value) { $this->_properties = $value; return $this; } /** * Create a new Section * * @param PhpOffice\PhpWord\Section\Settings $settings * @return PhpOffice\PhpWord\Section */ public function createSection($settings = null) { $sectionCount = $this->_countSections() + 1; $section = new Section($sectionCount, $settings); $this->_sectionCollection[] = $section; return $section; } /** * Get default Font name * @return string */ public function getDefaultFontName() { return $this->_defaultFontName; } /** * Set default Font name * @param string $pValue */ public function setDefaultFontName($pValue) { $this->_defaultFontName = $pValue; } /** * Get default Font size (in points) * @return string */ public function getDefaultFontSize() { return $this->_defaultFontSize; } /** * Set default Font size (in points) * @param int $pValue */ public function setDefaultFontSize($pValue) { $this->_defaultFontSize = $pValue; } /** * Set default paragraph style definition to styles.xml * * @param array $styles Paragraph style definition */ public function setDefaultParagraphStyle($styles) { Style::setDefaultParagraphStyle($styles); } /** * Adds a paragraph style definition to styles.xml * * @param $styleName string * @param $styles array */ public function addParagraphStyle($styleName, $styles) { Style::addParagraphStyle($styleName, $styles); } /** * Adds a font style definition to styles.xml * * @param $styleName string * @param $styles array */ public function addFontStyle($styleName, $styleFont, $styleParagraph = null) { Style::addFontStyle($styleName, $styleFont, $styleParagraph); } /** * Adds a table style definition to styles.xml * * @param $styleName string * @param $styles array */ public function addTableStyle($styleName, $styleTable, $styleFirstRow = null) { Style::addTableStyle($styleName, $styleTable, $styleFirstRow); } /** * Adds a heading style definition to styles.xml * * @param $titleCount int * @param $styles array */ public function addTitleStyle($titleCount, $styleFont, $styleParagraph = null) { Style::addTitleStyle($titleCount, $styleFont, $styleParagraph); } /** * Adds a hyperlink style to styles.xml * * @param $styleName string * @param $styles array */ public function addLinkStyle($styleName, $styles) { Style::addLinkStyle($styleName, $styles); } /** * Get sections * @return PhpOffice\PhpWord\Section[] */ public function getSections() { return $this->_sectionCollection; } /** * Load a Template File * * @param string $strFilename * @return PhpOffice\PhpWord\Template * @throws Exception */ public function loadTemplate($strFilename) { if (file_exists($strFilename)) { return new Template($strFilename); } throw new Exception("Template file {$strFilename} not found."); } /** * Get section count * @return int */ private function _countSections() { return count($this->_sectionCollection); } }