Paragraphs
// open document sample.docx
$doc = new PNDocx("templates/sample.docx");
// get the paragraphs containing {#more}
$p = $doc->p("some");
// set text in the paragraph after some
$p->next()->setText("after some");
// get the paragraphs containing {#more}
$p = $doc->p("more");
// set text in all paragraphs that were found
$p->setText("original");
// clone paragraphs and set text in clones
$p->duplicate()->setText("two times!");
// get the paragraphs containing {#last}
$p = $doc->p("last");
// set text in these paraprahs
$p->setText("The last paragraph");
// remove the paragraphs before all that were found with {#last}
$p->previous()->remove();
// send document to browser
$doc->send();
Show the result
templates/sample.docx