Jc::BOTH); $pBase = array('basedOn' => 'Normal'); $pNew = array('basedOn' => 'Base Style', 'next' => 'Normal'); $rStyle = array('size' => 20); $tStyle = array('bgColor' => 'FF0000', 'cellMargin' => 120, 'borderSize' => 120); $firstRowStyle = array('bgColor' => '0000FF', 'borderSize' => 120, 'borderColor' => '00FF00'); $phpWord->setDefaultParagraphStyle($pStyle); $phpWord->addParagraphStyle('Base Style', $pBase); $phpWord->addParagraphStyle('New Style', $pNew); $phpWord->addFontStyle('New Style', $rStyle, $pStyle); $phpWord->addTableStyle('Table Style', $tStyle, $firstRowStyle); $phpWord->addTitleStyle(1, $rStyle, $pStyle); $doc = TestHelperDOCX::getDocument($phpWord); $file = 'word/styles.xml'; // Normal style generated? $path = '/w:styles/w:style[@w:styleId="Normal"]/w:name'; $element = $doc->getElement($path, $file); $this->assertEquals('Normal', $element->getAttribute('w:val')); // Parent style referenced? $path = '/w:styles/w:style[@w:styleId="New Style"]/w:basedOn'; $element = $doc->getElement($path, $file); $this->assertEquals('Base Style', $element->getAttribute('w:val')); // Next paragraph style correct? $path = '/w:styles/w:style[@w:styleId="New Style"]/w:next'; $element = $doc->getElement($path, $file); $this->assertEquals('Normal', $element->getAttribute('w:val')); } }