You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Paragraph::has_next returns true if the current paragraph exists in the document, even if there is no next paragraph. next() then returns an empty paragraph which does not exist.
Since that last paragraph is empty, this issue is unnoticeable when reading a document. The problem occurs when the user tries inserting a paragraph after the last paragraph:
Paragraph last = doc.paragraphs();
while(last.has_next()) last = last.next();
last.insert_paragraph_after("This should appear after the last paragraph!");
Since last is actually a non-existing paragraph referring to an pugi::xml_node without a rode, the last paragraph is not written to the file.
I intend to fix this issue myself. I also want to add methods append_paragraph and append_run to Document. This would allow generating a long document without using a while loop to obtain the last paragraph as in the example above, and then working on a new Paragraph object for every new paragraph; instead, one would only use the Document object the entire time.
The text was updated successfully, but these errors were encountered:
Paragraph::has_next returns true if the current paragraph exists in the document, even if there is no next paragraph. next() then returns an empty paragraph which does not exist.
Since that last paragraph is empty, this issue is unnoticeable when reading a document. The problem occurs when the user tries inserting a paragraph after the last paragraph:
Since
last
is actually a non-existing paragraph referring to an pugi::xml_node without a rode, the last paragraph is not written to the file.I intend to fix this issue myself. I also want to add methods
append_paragraph
andappend_run
toDocument
. This would allow generating a long document without using a while loop to obtain the last paragraph as in the example above, and then working on a new Paragraph object for every new paragraph; instead, one would only use the Document object the entire time.The text was updated successfully, but these errors were encountered: