Forum


Replies: 7   Views: 250
Can't pass 'pstyle' from one wordfragment to another

Posted by Siegfried  · 12-08-2019 - 09:27

Thank you admin for your reply,

but how do i know if a importet style like

$docx->importStyles($this->templateName, 'merge', array('Heading3'));

is actually a paragraph-style oder a character-style?

How can I import a style like 'Heading3' (see above), and use it as a character-style like:

$wordfragment = new WordFragment($docx);
$text = array();
$text[] = array(
  'text' => 'Sample Text',
  'rStyle' => 'Heading3',
);
$wordfragment->addText($text);

I don't want to create a new Style from scratch, I like to use a pre-defined style from a word-template, so the user can change this style without changing the code...

 

... ok, I see it in the parseStyle-document if it is a pStyle or a rStyle...

So ... is it right, that if I would import some styles, only could use pStyles as pStyles and rStyles as rStyles... in my example I have to create a rStyle in my word-template which afterwards could be reused as a rStyle?