Table of Contents

Method MergeWithPrevious

Namespace
DocWright.Dom.Editing
Assembly
DocWright.Dom.dll

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

document WordDocument

The document that holds the paragraph.

paragraph Paragraph

The 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

document or paragraph is null.

ArgumentException

The paragraph is not in document.

InvalidOperationException

The paragraph is not in a block container.