I am afraid that currently you can not set the formatting properties while adding a new paragraph to a Word document. However, you can update the formatting accordingly later using the following API methods. So you can achieve your requirement in two API calls.
I’m trying the code but I can’t find in the documentation what $index refers to:
/*
* Initializes a new instance of the UpdateParagraphFormatRequest class.
*
* @param string $name The filename of the input document.
* @param int $index Object index.
* @param \Aspose\Words\Model\ParagraphFormatUpdate $paragraph_format_dto Dto for paragraph format update.
* @param string $node_path The path to the node in the document tree.
Am I right in thinking that if I have a single page doc with two paragraphs in it, the first paragraph will have a $node_path of 0.0.1 and the second will have a $node_path of 0.0.2?
What then does $index refer to?
If I want to format the second paragraph so that it has page_break_before = true what should I use for $node_path and $index?
Please note that the node path is the parent node path of paragraphs. For example, node_path can be “sections/0” and index would be paragraph index starting from 0. If you want to update the second paragraph of section 1 then you will use the values node_path is “sections/0” and index is “1”.