docx-editor

Preserved content

What the editor keeps untouched, and how it behaves while you edit around it.

How preservation works

Untouched package parts and document blocks go back out unchanged, and an element the editor has no model for is kept where it stood while the paragraph around it stays editable. A file that spelled the namespaces under other prefixes goes back out respelled, so its bytes differ where its content does not. An unsupported block, or a table whose structure cannot be modelled, stands as a placeholder. A section break is kept as well; Pages and sections covers what it means while you edit.

Character formatting and styles

Unsupported character properties remain in the file. Supported properties from paragraph and character styles are displayed.

Bookmarks and ranges

Bookmark ranges, permission ranges, and the markers of a moved passage are kept at their positions, invisible and impossible to remove. A selection that runs across one of the markers cannot be replaced, so typing or deleting over it leaves the text as it stands; move the selection clear of the marker to edit around it. Markers between a table's rows or cells also decide which table edits are available.

Fields

A complex field shows its markers and instructions as small boxes that cannot be edited or removed; its cached result stays editable text. A simple field is one box showing its cached result and can be removed whole. Nothing recalculates a field, so a page number or a total stays as it was written.

Tracked changes

A tracked insertion or deletion is shown as a small box carrying its text, which can be selected and removed whole but not edited inside. A table's w:tblGridChange is preserved as it came.

Content controls

A content control around text, a table cell, a table row, or whole paragraphs and tables opens as the content it wraps and goes back out inside the same control, nested as it came. A lock the control carries is honored; Locked content covers locks and group controls. Backspace and Delete stop at the edge of a control around paragraphs or tables, and a control left holding one empty paragraph is removed whole by either key. Selecting everything a control around text holds and typing, composing, or pasting over it writes the new text into the control, keeping its tag and id; deleting it all leaves the control in the file with nothing inside it, and the next text typed there goes back into it. A selection that also takes in text outside the control removes the control with it, which a control locked against deletion refuses. A temporary control is removed by the first edit inside it, and placeholder text is edited like any other text. A control holding only a formatted run with no text shows it as a blank, and text typed into the blank goes into the control, unless the control's lock keeps its contents from being edited; then the text goes beside the control, in the formatting of the text around it, and the blank stays. A control with nothing inside it takes no room on the page and is kept in the file, whether it stands between paragraphs or inside one, where it takes no width between the words either side of it. Backspace and Delete never remove it: between paragraphs they move the caret past it, removing a blank line beside it as they would anywhere else, and inside a paragraph they pass over it and remove the character beyond it, as if it were not there. The control itself is removed only by a selection that covers it, which a control locked against deletion refuses. A control holding nothing that carries a lock also keeps a selection covering it from being replaced or deleted, so typing over such a selection does nothing. A control the editor could not take apart is shown as a box: a plain text, picture, date picker, combo box, drop-down list, or check box control around whole blocks.

Other markup

A symbol, a positional tab, and any other element without a model are shown as small boxes where they stood. documentFidelity and importDocx report preserved nodes in the main body; see what a document loses.

On this page