lib/PHPWord/PHPWord/Section.php
public function addTitle($text, $depth = 1) {
		$styles = PHPWord_Style::getStyles();
		if(array_key_exists('Heading_'.$depth, $styles)) {
			$style = 'Heading'.$depth;
		} else {
			$style = null;
		}
		
		$title = new PHPWord_Section_Title($text, $depth, $style);
		
		$data = PHPWord_TOC::addTitle($text, $depth);
		$anchor = $data[0];
		$bookmarkId = $data[1];
		
		$title->setAnchor($anchor);
		$title->setBookmarkId($bookmarkId);
		
		$this->_elementCollection[] = $title;
		return $title;
	}
public function addTitle($text, $depth = 1) {
		$styles = PHPWord_Style::getStyles();
		if(array_key_exists('Heading_'.$depth, $styles)) {
			$style = 'Heading'.$depth;
		} else {
			$style = null;
		}
		
		$title = new PHPWord_Section_Title($text, $depth, $style);
		
		$data = PHPWord_TOC::addTitle($text, $depth);
		$anchor = $data[0];
		$bookmarkId = $data[1];
		
		$title->setAnchor($anchor);
		$title->setBookmarkId($bookmarkId);
		
		$this->_elementCollection[] = $title;
		return $title;
	}
public function addTitle ( $ text , $ depth = 1 ) { $ styles = PHPWord_Style :: getStyles ( ) ; if ( array_key_exists ( 'Heading_' . $ depth , $ styles ) ) { $ style = 'Heading' . $ depth ; } else { $ style = null ; } $ title = new PHPWord_Section_Title ( $ text , $ depth , $ style ) ; $ data = PHPWord_TOC :: addTitle ( $ text , $ depth ) ; $ anchor = $ data [ 0 ] ; $ bookmarkId = $ data [ 1 ] ; $ title -> setAnchor ( $ anchor ) ; $ title -> setBookmarkId ( $ bookmarkId ) ; $ this -> _elementCollection [ ] = $ title ; return $ title ; }
Add a Title Element

@param string $text
@param int $depth
@return PHPWord_Section_Title
Add a Title Element