Method MergeWithPrevious
MergeWithPrevious(WordDocument, Paragraph)
Joins a paragraph to the one before it in the same container, as Backspace at its start does. The first paragraph of a container, and a paragraph that follows a table, have nothing to join: the record is empty.
public static DocumentEdit MergeWithPrevious(this WordDocument document, Paragraph paragraph)
Parameters
documentWordDocumentThe document that holds the paragraph.
paragraphParagraphThe paragraph to join to the previous one.
Returns
- DocumentEdit
The edit; After is the join point.
Remarks
At the start of a section after the first, the section break goes first, as Word's Backspace removes it (SectionEditingExtensions).
Exceptions
- ArgumentNullException
documentorparagraphis null.- ArgumentException
The paragraph is not in
document.- InvalidOperationException
The paragraph is not in a block container.