Subject: | Instantiating a new ODF text document automatically inserts a paragraph element as well |
When a new ODF text document is created, a paragraph is automatically inserted into the new document resulting in a blank line at the top of the document. If one does not desire this behavior, one must get the paragraph object and delete it.
This can be reproduced by executing the helloworld example provided in the docs[1] and then dumping the XML of the resulting content. The resulting XML looks like this:
<office:body>
<office:text>
<office:forms form:apply-design-mode="false" form:automatic-focus="false"/>
<text:sequence-decls>
<text:sequence-decl text:display-outline-level="0" text:name="Illustration"/>
<text:sequence-decl text:display-outline-level="0" text:name="Table"/>
<text:sequence-decl text:display-outline-level="0" text:name="Text"/>
<text:sequence-decl text:display-outline-level="0" text:name="Drawing"/>
</text:sequence-decls>
<text:p text:style-name="Standard"/>
<text:p text:style-name="Standard">Hello World !</text:p>
</office:text>
</office:body>
Notice that whereas the code only appends one paragraph containing the text "Hello World!" the XML clearly shows a paragraph before that added upon creation of the original document.
This behavior is undesirable.
[1] https://metacpan.org/pod/ODF::lpOD#The-%22Hello-Word%22-example