API reference
Public methods and properties of the UniversalWriteElement class
(the <universal-write> element), grouped by area.
Built-in chrome (toolbar & status bar)
The component can render its own top toolbar and bottom status bar — no external chrome to wire. They are set via attributes (or the matching properties) and load Material on demand, so the default costs nothing.
| Attribute / property | Type | Description |
|---|---|---|
topbar | boolean attribute | Top bar with menus, the Navigation Pane (Ctrl+F), rulers and gridlines (View › Show), find & replace, comments beside the page, open/save (File System Access or the host), autosave, recent files, Protected View, compare, theme, focus/read modes, context menu and drag & drop. |
toolbar | compact · ribbon | Style of the top bar: compact (default — the document title above the File/Edit/View/Insert/Format/Tools/Help menus, plus one toolbar row that collapses by priority) or ribbon (tabs, groups with dialog launchers and contextual tabs). |
theme | auto (default) · light · dark · black | Light or dark UI. auto — or no attribute — follows the CSS color-scheme the element inherits from the page (@universal-material’s u-light/u-dark classes set it; light dark follows the OS; none = light). light/dark force it; black also darkens the page. See Light and dark. |
accent | blue · teal · green · amber · red · purple · neutral | Accent of the element’s own Material palette (used instead of the page’s --u-color-* tokens). |
storage-key | string | Remembers this instance's bar choices (toolbar style, theme, comments, autosave) in localStorage; falls back to id, otherwise session-only. |
noautosave · nounloadprompt | boolean attributes | Turn off autosave / the leave-page prompt. Handling the cancelable uw-save-request / uw-open-request events (preventDefault()) hands saving and opening to the host. |
bottombar | boolean attribute | Bottom status bar: page/word count, view switch, zoom. |
author | string | Name recorded on tracked changes and new comments. Without it the bars use the host's user name (host.userName(); Electron: the OS user) or ask once and remember the answer. |
hidden-commands · hiddenCommands | ids (comma- or space-separated) / string[] | Commands, menus, groups, tabs and bar controls to hide everywhere: bars, menus, context menu and shortcuts — like CKEditor’s toolbar.removeItems. Example: hidden-commands="file title save print hf comment tracking". |
formatting-policy · formattingPolicy | template-document / FormattingPolicy | null | What the user may format (styles, lists, character formats, fonts, spacing, page…). Outside the policy, commands disappear everywhere, the API ignores them and paste converts them; existing content is kept. The property, once set, wins over the attribute. See Formatting policy. |
nofiledrop · fileDropDisabled | boolean | The editor never opens or inserts dropped files; the cancelable uw-file-drop still fires. See Dropped files. |
<universal-write topbar bottombar></universal-write>
<universal-write topbar toolbar="ribbon" bottombar></universal-write>
// or at runtime, via properties
editor.topbar = true; // boolean
editor.bottombar = true; // boolean
editor.setAttribute('toolbar', 'ribbon');
// optional: what only the host app can do (e.g. an Electron shell)
editor.host = {
openFile: () => bridge.open(), // { name, bytes, motw? } | null
saveFile: (bytes, { name, format, saveAs }) => bridge.save(bytes, name),
setDirty: (dirty, name) => bridge.setDirty(dirty, name),
windowControlsOverlay: true, // frameless window
};
Commands whose editor API does not exist yet stay hidden, so new editor features appear in the bars as soon as their method exists.
The bars are themed with Material Design 3 (theme and accent color are scoped to
the element; tune them with --uw-font, --uw-background, the
--uo-* variables or ::part()) and follow light/dark mode,
and their controls reflect the current selection (active buttons, current style,
font, size, and color).
Light and dark
The element follows the CSS color-scheme of its context (inherited
from the page, across the shadow DOM): every color of the bars, menus, dialogs, popovers,
rulers, panes, status bar and desk is a --u-color-* token or a
light-dark() color, so switching is pure CSS and live. It never looks for
u-dark/u-light classes — only at the resulting
color-scheme. Without theme/accent, the bars use the
page’s --u-color-* tokens when it defines them, otherwise the accent palette.
The page stays white in dark mode (like Word and Google Docs); theme="black" or
setDarkPage(true) darkens it too.
| Member | Description |
|---|---|
effectiveTheme: 'light' | 'dark' | The UI theme in effect (getter). uw-theme-change ({ theme }) fires when it changes. |
--uw-background | One background for the desk, bars, rulers and panes (like Google Docs/Drive; only the page differs). Default --u-color-surface-container-low. --uw-desk (desk) and --uo-bar-bg (bars) still override their part. |
--uo-bar-container | The rounded toolbar pill (and the ribbon body): a light accent tone over the background (--u-color-surface-container; -high in dark). |
Side panel (slot="side")
Light DOM children with slot="side" (or slot="side-start") show below
the bars (title, menus, notice, toolbar, ruler) and beside the pages, like Google Docs’ comments pane: the
toolbar keeps the full width and the pages shrink and re-center. The host owns the panel — its own
component in the light DOM, so the page’s styles apply — and sets its width and visibility; an empty or
hidden slot takes no space. The panel sticks below the bars, as tall as the space between them, and scrolls by
itself; with pages wider than the space left (high zoom) it stays at the visible edge over them.
Clicks, keys, the wheel and dropped files in the panel are the host’s: the editor does not take the focus,
move the caret, open its context menu, zoom or turn pages there, and fires no uw-file-drop; only the
app shortcuts (open, save, print, find) still work, as from a field of the bar. Events still bubble to the page.
The panel is left out of printing and inherits the element’s color-scheme.
| Member | Description |
|---|---|
slot="side" · slot="side-start" | Panel after (right) or before (left) the pages. |
::part(side) · ::part(side-start) | The wrappers (sticky, scrolling). |
uw-side-resize | { start, end }: the panels' widths (px) changed — 0 when empty or hidden. |
<universal-write topbar>
<app-document-data slot="side" style="width: 320px"></app-document-data>
</universal-write>
Notice band
setNotice(el, { tone }) shows a band of the host’s own between the
title/menu row and the tools — in the compact bar before the toolbar row, in the ribbon before
the tabs — like Google Docs’ and Drive’s storage warnings (someone else is editing,
read-only, storage almost full). The element moves into the bar, so it inherits the bar’s theme
(light/dark, accent, one background color, font) and the bar kit’s
buttons fit in it. It stays in read mode, survives switching toolbar and the UI language,
is announced by screen readers (role="status") and only shows with topbar.
| Member | Description |
|---|---|
setNotice(el: HTMLElement | null, { tone?: 'info' | 'warning' | 'error' }) | Shows (or, with null, removes) the band. tone: info (default, a tint of the accent), warning, error. |
notice: HTMLElement | null | The current notice element (getter). |
::part(notice) · --uo-notice-bg · --uo-notice-color | Styling of the band; --uo-notice-warning-bg/-color and --uo-notice-error-bg/-color for the other tones. |
const ui = await loadBarKit('pt');
const band = document.createElement('div');
band.style.cssText = 'display:flex;align-items:center;gap:12px;flex:1';
band.append(
ui.createBarIcon('warning', { size: 18 }),
Object.assign(document.createElement('span'), { textContent: 'Maria Souza está editando este documento.', style: 'flex:1' }),
ui.createBarButton({ label: 'Tentar de novo', variant: 'text', size: 'small', onClick: retry }),
);
editor.setNotice(band, { tone: 'warning' });
editor.setNotice(null); // remove
Formatting policy
For documents whose look comes from a template (styles, fonts, spacing, borders and page
setup are the template's job), the host gives the editor a formatting policy, like Quill's formats
whitelist. What the policy leaves out disappears from the bars, menus, context menu, galleries, dialogs and
shortcuts (the hidden-commands mechanism), the editing API ignores it and paste converts or drops
it. Content already in the document is never touched: loading and saving do not filter.
import { TEMPLATE_DOCUMENT_POLICY } from '@universal-office/write';
editor.formattingPolicy = TEMPLATE_DOCUMENT_POLICY; // or <universal-write formatting-policy="template-document">
editor.formattingPolicy = { ...TEMPLATE_DOCUMENT_POLICY, tables: false };
editor.formattingPolicy = null; // no policy
| Field (optional; missing = allowed) | Type | Controls |
|---|---|---|
paragraphStyles | string[] | Paragraph styles the user may apply, by id or internal English name, ignoring case and spaces (Normal, Title, Subtitle, Heading1 = "heading 1"; Portuguese ids such as Ttulo1 match by name). The style gallery, menus and the Styles pane list only these. |
characterStyles | string[] | Character styles allowed (none when paragraphStyles is set and this is not). |
lists | { kinds: ('bullet' | 'decimal')[], levels?: 1–9 } | Only the Bullets/Numbering buttons with the default formats; libraries, document/template lists, multilevel lists and Define New… disappear; levels stop at levels. |
character | CharacterFormat[] | bold, italic, underline, underlineStyles, strike, doubleStrike, superscript, subscript, color, highlight, link, caps, hidden, charSpacing, textEffects. |
font · fontSize | boolean | Font family · size (Grow/Shrink, Font dialog). |
alignment · indentation | boolean · true | 'steps' | false | Alignment · all indents, only Increase/Decrease Indent, or none. |
spacing · borders · shading · tabs | boolean | Line/paragraph spacing and pagination · paragraph borders and horizontal line · paragraph shading · tab stops. |
styleEditing · formatPainter | boolean | Create/modify/rename/delete styles · Format Painter. |
pageSetup · pageBackground · headersFooters | boolean | Margins, orientation, size, ruler, line numbers, hyphenation · page color, watermark, page borders · headers, footers, page numbers. |
columns · pageBreaks · sectionBreaks | boolean | Columns · page/column breaks and Blank Page · section breaks. |
tables · images · imageFormatting · shapes | boolean | Insert tables · insert pictures (paste and drop too) · picture styles, borders, effects, crop, wrapping, position · shapes, text boxes, cover pages. |
TEMPLATE_DOCUMENT_POLICY (formatting-policy="template-document") behaves like a lightweight
rich-text editor (such as Quill) for documents whose look comes from a template: styles Normal, Heading 1–3, Title and Subtitle; bulleted and numbered lists in 9
levels; bold, italic, underline, strikethrough, font color, highlight and links; alignment and Increase/Decrease
Indent; pictures, tables, columns and page breaks. Everything else (fonts, sizes, superscript, spacing, borders,
shading, page setup, headers and footers, shapes, style editing, Format Painter) belongs to the template.
Paste follows the policy for every source (the editor's own copy, HTML from browsers and Word,
plain text): a style that is not allowed becomes the nearest allowed one (Heading 5–9 → the deepest allowed
heading; Title → Heading 1 when Title is not allowed; anything else → Normal); character and paragraph
formats outside the policy are dropped; lists of any format (including Word's mso-list paragraphs)
become bulleted or numbered lists within the allowed levels; tables stay tables or, with tables: false,
their cells become paragraphs; pictures and shapes that are not allowed are dropped; unknown tags keep their text,
as in Word. Plugin inlines copied inside the editor paste as inlines; from anywhere else, as their fallback text.
| Member | Description |
|---|---|
formattingPolicy: FormattingPolicy | null | The policy in effect (the attribute's preset until the property is set). |
TEMPLATE_DOCUMENT_POLICY · FORMATTING_POLICY_PRESETS | The preset (frozen) and the presets by attribute name (exports of the package). |
Dropped files
Every file dropped on the element first fires the cancelable uw-file-drop
(detail: { files, clientX, clientY }), before the editor handles it; preventDefault()
hands the files to the host. Not canceled, dropped pictures are inserted at the drop point (editable document,
policy with images) and, with topbar, a dropped .docx/.odt/.doc opens. With
nofiledrop the editor never opens or inserts dropped files; the event still fires and the browser
never navigates to them.
editor.addEventListener('uw-file-drop', async (e) => {
const file = e.detail.files[0];
if (!/\.docx$/i.test(file.name)) return; // let the editor handle it
e.preventDefault();
if (await confirmReplace(file.name)) editor.load(new Uint8Array(await file.arrayBuffer()));
});
Document (load, save, export)
| Method | Description |
|---|---|
load(bytes, format?, opts?) | Loads a document. format: 'auto' (default — detects .docx vs .odt from the bytes; Word 97–2003 .doc is detected and converted), 'docx', or 'odt'. The bytes come from the host, so the document opens editable; opts.protected: true opens it in Protected View (the src attribute and File › Open keep deciding by Mark-of-the-Web / Trusted Documents). |
save(format?, opts?): Promise<Uint8Array | string> | Saves/exports the document. format: 'auto' (default — the format it was loaded as), 'docx', 'odt', 'pdf', 'html', 'markdown', 'xps'. Returns bytes for binary formats and a string for html/markdown. opts: { images?: boolean, title? }. |
newDocument() | Creates an empty, editable A4 document with Word’s blank-document styles, theme and settings (Normal, headings, quotes…; built-in styles are written on first use). |
initialize(options) | Initializes with fonts/document as bytes (offline mode). Called automatically on connect unless manual-init is set; calling it again does nothing. Returns Promise<void>. |
getFontEmbedding() · setFontEmbedding(settings) | Fonts in the saved .docx: { embed, subset, skipCommonFonts }. Default: off. uw-font-embedding reports what was embedded. |
requestSystemFonts(): Promise<boolean> | Asks for Local Font Access (Chromium) so installed fonts can be measured and embedded. Call from a user gesture. |
listAvailableFonts(): Promise<string[]> · knownFontFamilies() | Font families the editor can use / has loaded (for a font picker). |
exportPdf() · exportXps() · exportHtml(title?, opts?) · exportMarkdown(title?, opts?) · exportOdt(opts?) | Lower-level exporters behind save(). |
print() | Opens the print dialog with pages in Print mode. |
Document state
| Method | Description |
|---|---|
isProtected(): boolean | true if in Protected View. |
enableEditing() | Leaves Protected View and unlocks editing. |
isEmpty(): boolean | No visible content in the body: no text (other than spaces), table, picture, shape, plugin inline or note. Text boxes count by their content. |
isDirty(): boolean / setDirty(dirty) | Changed since the document was loaded or since setDirty(false) (like TinyMCE’s isDirty()/setDirty()). Every change counts — edits, undo/redo, Update Field/Table of Contents (which do not fire uw-change) and options saved in the file, such as font embedding. Undo does not make it clean again; the bars’ Save marks it clean. uw-dirty-change reports the transitions. |
getLinks(): DocumentLink[] | Hyperlinks of the body in document order: { address } (external) or { anchor } (bookmark), plus the visible text (neighbor runs with the same target are joined). |
getCustomInlines(type?): CustomInline[] | Plugin inlines of the body in document order ({ type, data, fallbackText }), all of them or of one type — e.g. to tell which linked items a document uses. |
repaint() | Repaints the pages without a new layout — call it when state read by a plugin renderer changes (e.g. a link whose target was removed). |
hasExternalFields(): boolean | true if the document has fields (TOC, PAGE, DATE, etc.). |
currentPage(): number | Page visible at the center of the viewport (1-based). |
stats() | Returns { pages, words, chars, paragraph, page }. |
selectedText(): string | Plain text of the selection (paragraphs separated by \n). |
getSelectionState() | Caret props and UI state: { run, para, view, marks }. |
selectAll() / focusEditor() | Selects everything / gives keyboard focus to the editor. |
undo() / redo() | Undoes / redoes the last action. |
View and zoom
| Method | Description |
|---|---|
setView(v) / getView() | View mode: 'print' | 'web' | 'draft' | 'read' | 'outline'. |
setZoom(z, anchorY?) / getZoom() | Zoom from 0.1 to 5 (10%–500%). |
toggleMarks(): boolean | Shows/hides paragraph marks; returns the new state. |
setDarkPage(dark) | Dark page: inverts the luminance of page colors (theme="black" turns it on). The light/dark UI alone keeps the page white. |
Text formatting (runs)
| Method | Description |
|---|---|
toggleRunProp(key) | Toggles 'bold' | 'italic' | 'underline' | 'strike' | 'allCaps' | 'smallCaps'. |
toggleVertAlign(kind) | Toggles 'superscript' | 'subscript'. |
setFontSize(pt) / growFont(delta) | Sets size in points / grows-shrinks in steps. |
setFontFamily(name) | Sets the family (e.g. 'Calibri', 'Aptos'). |
setColor(hex?) | Text color (e.g. '1A73E8'); undefined resets to default. |
setHighlight(name?) | Highlight: 'yellow' | 'green' | 'cyan' | 'magenta' or undefined. |
setCharSpacing(twips?) | Character spacing, in twips. |
setLink(url?) | Applies/removes a hyperlink on the selection. |
changeCase(mode) | Converts the selection: 'upper' | 'lower'. |
clearFormatting() | Removes all direct formatting from the selection. |
copyFormat() / painterActive() | Format painter: activates / checks whether it is active. |
Paragraph formatting
| Method | Description |
|---|---|
setAlignment(a) | 'left' | 'center' | 'right' | 'both' (justified). |
applyStyle(styleId?) | Applies a paragraph, character or linked style — see Styles. No argument = Normal. |
toggleList(kind) | Toggles a 'bullet' | 'decimal' list. |
indent(delta) | Grows/shrinks the left indent (1 | -1; step of 720 twips = 0.5"). |
setSpecialIndent(kind) | 'none' | 'firstLine' | 'hanging'. |
setIndentRight(twips?) | Right indent. |
getParagraphIndents() / setParagraphIndents({ left?, right?, firstLine? }) | Effective indents of the caret's paragraph / absolute indents for every selected paragraph (twips from the paragraph's frame; firstLine < 0 = hanging) — what the ruler and the Paragraph dialog use. Only what differs from the style is written. See Ruler. |
getTabStops() / setTabStops(tabs, only?) | Tab stops of the paragraph (style and list included) and the default tab stop / the effective tab stops of the selected paragraphs. See Ruler. |
setLineSpacing(line) | Line spacing in twentieths of a point (240 = 1.0; 360 = 1.5). |
setSpaceBefore(twips?) / setSpaceAfter(twips?) | Space before/after the paragraph. |
setShading(hex?) | Paragraph background color. |
toggleBorder() | Toggles paragraph borders. |
Units: the API uses the format's native units — twips (1/20 of a point) for layout measures and points for font size. Conversions to pixels happen only at render time.
Styles
The document’s styles.xml is edited in place: each operation rewrites only the
w:style elements it touches and leaves the rest byte for byte. New and modified styles are
written the way Word writes them (a new paragraph style is linked, with a …Char
twin; its id is the name without accents or spaces; a built-in style used for the first time gets Word’s
full definition). Built-in names follow the UI language (heading 1 → “Heading 1” /
“Título 1”). With topbar, the ribbon’s Styles group is a thumbnail gallery,
its launcher opens the Styles pane, and Format › Styles (compact bar) has the pane, the Style Inspector
and the Create/Modify Style dialog.
| Method | Description |
|---|---|
listStyles(filter?): StyleInfo[] | Styles in Word’s order (priority, then name): { id, name, rawName, kind, builtIn, defined, quick, hidden, priority, inUse, isDefault, basedOn?, next?, link?, autoUpdate }. kind: 'paragraph' | 'character' | 'linked'. filter: 'gallery' | 'recommended' (default) | 'inUse' | 'document' | 'all'; latent built-ins are included with the id they will get. |
styleFormatting(id): StyleLook | null | Effective formatting (document defaults → based-on chain → style): fontFamily, sizePt, bold, italic, underline, strike, allCaps, smallCaps, color, charSpacingTwips, alignment, spaceBeforeTwips, spaceAfterTwips, lineTwentieths, indentLeftTwips, indentRightTwips, indentFirstLineTwips, shadingHex, borderTop, borderBottom. |
applyStyle(id?) | Paragraph style: replaces it and clears direct paragraph formatting plus character formatting that is uniform across the paragraph (partial formatting, such as one bold word, stays). Character style: on the selection — or the word at the caret — removing its direct formatting. Linked style on part of one paragraph: its character twin. |
createStyle(opts): string | null | { name, type?, basedOn?, next?, quick?, autoUpdate?, format?, fromSelection?, apply? }. Defaults: linked, in the gallery, based on the current paragraph style, formatted like the selection’s first character and paragraph, applied to the selection. Returns the new id, or null when the name is taken. |
modifyStyle(id, opts): boolean | { name?, basedOn?, next?, quick?, autoUpdate?, format? }. format (StyleFormat): a value sets it on the style, null inherits again. Re-lays out the whole document in one undo step. |
updateStyleFromSelection(id?): boolean | “Update to Match Selection”: the current paragraph’s direct formatting moves into the style (default: the paragraph’s style). |
renameStyle(id, name) · deleteStyle(id) · setStyleInGallery(id, on) | A renamed custom style gets a new id and the document follows; a built-in gets an alias. Deleting a custom style returns its text to Normal; built-ins cannot be deleted. Gallery membership is w:qFormat. |
inspectStyle() | Style Inspector: { paragraph: { id, name, direct }, text: { id, name, direct } } — the styles and the direct formatting at the caret. |
clearParagraphStyle() · clearParagraphFormatting() · clearCharacterStyle() · clearCharacterFormatting() | The Inspector’s erasers. At the caret, character operations act on the word. |
currentStyles() · selectionStyleFormat() · stylesVersion() | Paragraph/character style ids at the caret; the selection’s direct formatting as a StyleFormat; a counter that changes with the style sheet (uw-styles-change fires too). |
Enter at the end of a paragraph whose style has a next style (Heading 1 → Normal) starts the new paragraph in that style, without direct formatting.
Inserting content
| Method | Description |
|---|---|
insertPageBreak() | Inserts a page break (Ctrl+Enter) in a paragraph of its own: in the middle of a paragraph it is split and the break goes between the halves; a selection is replaced; the caret goes to the start of the next paragraph. Not available in headers/footers, text boxes or table cells. |
insertColumnBreak() | Inserts a column break (Ctrl+Shift+Enter). In the middle of a paragraph it splits it and the break opens the next one; a selection is replaced. |
insertSectionBreak(type?) | Inserts a section break at the caret (with a selection: at its start, keeping the text). type — 'nextPage' (default) | 'continuous' | 'evenPage' | 'oddPage' | 'nextColumn' — is how the section after the break starts. The paragraph is split; the new section before the caret is a copy of the current one and takes its headers and footers (the section after stays linked to it). Not available in headers/footers, text boxes or table cells. |
insertField(kind) | Inserts a 'PAGE' | 'NUMPAGES' | 'DATE' field. |
insertImage(data, ext): Promise<void> | Inserts an image ('png' | 'jpeg' | 'gif'). |
insertCustomInline(type, data, opts?) | Inserts an atomic plugin inline (see Plugins). |
Tables
Tables follow Word’s rules (measured against Word): what each operation does to widths, merges,
borders and styles, and what it writes to the file. Every operation is one undo step, works in nested and
floating tables and is refused in Protected View. A table read from the file keeps its original XML for
everything the operation did not touch (rows, cells, content controls and bookmarks inside it). With
topbar: Insert › Table, Format › Table, Tools › Sort (compact bar), the
contextual Table Design and Table Layout tabs (ribbon) and the context menu.
| Method | Description |
|---|---|
insertTable(rows, cols, opts?) | { autofit?: 'fixed' | 'content' | 'window', colWidthTwips? }. New tables get the Table Grid style, like Word. |
convertTextToTable(opts?) · textToTableGuess(separator?, cols?) · convertTableToText(separator?) | Separators: 'paragraph' | 'tab' | 'semicolon' | 'comma' | { char }. textToTableGuess returns what the Convert dialog proposes: { separator, cols, rows }. |
quickTables() · insertQuickTable(id): Promise<boolean> | Quick Tables with their own content in the UI language: 'calendar' (this month), 'tabular', 'matrix', 'subheads', 'double'. |
insertRowAbove() · insertRowBelow() · insertColumnLeft() · insertColumnRight() | As many rows/columns as are selected. A new column takes the width from its neighbor and the table keeps its width, like Word. |
insertCells(shift) · deleteCells(shift) · deleteRow() · deleteColumn() · deleteTable() | insertCells('right' | 'down' | 'row' | 'column'), deleteCells('left' | 'up' | 'row' | 'column'). |
mergeCells() · splitCell(cols, rows, mergeFirst?) · splitTable() | Merging keeps the non-empty paragraphs in reading order; splitting distributes them like Word. |
selectCell() · selectRow() · selectColumn() · selectTable() | Selects the part of the table at the caret. editingTableCell(): is the caret in a cell? |
getTableState(): TableState | null | { rows, cols, rect, cells, nested, canMerge, style?, look, vAlign, textDirection, headerRow, rowHeight?, colWidth, shading?, tblPr, trPr, tcPr, styleBorders?, availTwips } at the caret. |
setRowHeight(twips, rule?) · setColumnWidth(twips) · distributeRows() · distributeColumns() · autoFitTable(mode) | rule: 'atLeast' (default) | 'exact'; mode: 'content' | 'window' | 'fixed'. |
setTableCellMargins(margins, spacingTwips?, autoResize?) | Default cell margins of the table ({ top, left, bottom, right }, twips), cell spacing and “automatically resize to fit contents”. |
setTableProperties(p) | The Table Properties dialog in one undo step. table: width ({ w, type: 'dxa' | 'pct' } or null), align, indentTwips, wrap: 'none' | 'around', position (floating table: tblpPr), overlap, title, description (Alt Text). row: height, allowBreak, header. column: width. cell: width, vAlign, margins, wrap, fitText. |
setCellAlignment(h, v) · setTextDirection(dir) · toggleRepeatHeaderRows() | h: 'left' | 'center' | 'right' | 'both'; v: 'top' | 'center' | 'bottom'; dir: 'lrTb' | 'tbRl' | 'btLr'. Header rows repeat at the top of each page, also in floating and nested tables. |
tableStyleList() · tableStyleListNow() | TableStyleInfo[]: { name, label: { en, pt, es }, group: 'custom' | 'plain' | 'grid' | 'list', id? } (the async one loads the built-in catalog). |
setTableStyle(name | null): Promise<void> · setTableStyleOptions(o) | A built-in is added to the file on first use with Word’s definition (colors from the document theme). Options: { headerRow, totalRow, bandedRows, firstColumn, lastColumn, bandedColumns } (w:tblLook). |
renderTableStyleThumb(canvas, name, look?) · renderTableStyleXmlThumb(canvas, xml, look?) | Thumbnail of a style painted by the layout engine (the gallery and the style dialog use them). |
tableStyleXml(nameOrId) · tableStyleBases() · newTableStyleId(name) · saveTableStyle(xml, opts?) | New/Modify Table Style: the style’s w:style ({ id, xml, inDoc }), the styles it can be based on, a free id for a name (Word’s rule) and saving it ({ apply?, basedOnName? }). The dialog edits each condition — whole table, header row, total row, first/last column, banded rows/columns, corner cells — with font, borders, fill and alignment. |
setCellBorders(kind, spec?) · setTableBorderSides(sides, applyTo?) | kind: 'all' | 'outside' | 'inside' | 'insideH' | 'insideV' | 'top' | 'bottom' | 'left' | 'right' | 'tl2br' | 'tr2bl' | 'none', with the pen or spec ({ val, sz, color, space }). sides: a BorderSpec or null per side, for the cells or the whole table. |
getBorderPen() · setBorderPen(p) | Style, width and color used by the border buttons, Draw Table and the Border Painter (uw-borderpen). |
setCellShading(color, pattern?, applyTo?) | color: hex, { themeColor, tint?, shade? } or null; pattern: { val, color } (pct10…, horzStripe…, painted with Word’s coverage); applyTo: 'cell' | 'table'. |
setParagraphBorders(sides) · getParagraphBorders() | Paragraph borders from the Borders and Shading dialog. |
getPageBorders() · setPageBorders(pb, applyTo?) | Page border: { offsetFrom?: 'page' | 'text', display?: 'allPages' | 'firstPage' | 'notFirstPage', zOrder?, top?, left?, bottom?, right? } or null; applyTo: 'document' (default) | 'section'. |
setTableTool(tool) · getTableTool() | 'draw' (draw a table or a cell divider), 'eraser' (erasing a divider merges the cells), 'painter' (paints borders with the pen) or null; Esc turns it off (uw-tabletool). With the mouse: drag a column or row border to resize, the move handle to float the table, the corner handle to resize it. |
showTableGridlines(on) · tableGridlinesShown() | Dashed gridlines on screen for tables without borders (never in PDF or print). |
sortInfo(separator?) · sort(req): boolean | sortInfo: { kind: 'table' | 'paragraphs', columns: { text, guess }[], header, mergeError }. sort({ keys: { column, type: 'text' | 'number' | 'date', desc? }[], header?, caseSensitive?, separator? }) sorts the table rows (or the selected rows, or paragraphs); text compares like Word’s word sort; tables with merged cells are refused (uw-sort-error). |
suggestFormula() · previewFormula(formula, numberFormat?) · insertFormula(formula?, numberFormat?) | A { =… } field: SUM, AVERAGE, COUNT, MAX, MIN, PRODUCT, ABS, INT, MOD, ROUND, SIGN, IF, AND, OR, NOT, TRUE, FALSE, DEFINED; references A1, B2:C4, ABOVE, BELOW, LEFT, RIGHT; number format \# "#.##0,00". The suggestion is Word’s (=SUM(ABOVE) or =SUM(LEFT)); results and errors match Word pt-BR. |
updateFields(): number | Recalculates the formula fields (F9); returns how many changed. |
pasteCells(mode?) · hasCellsClip() | Pastes copied cells: 'overwrite' (default), 'rows' (as new rows), 'nest' (as a nested table), 'text' (text only). copy()/cut() of cells and tables put tab-separated text and HTML on the system clipboard; HTML tables pasted from elsewhere become tables. |
insertSpreadsheet() · editEmbeddedObject(run) · canEmbedSpreadsheet() | Embedded Excel spreadsheet edited in <universal-sheet> (double-click to edit) and saved like Word: w:object with a preview and the workbook in word/embeddings. |
sheetLoader | Property: () => Promise that loads the Sheet product for the spreadsheet object, e.g. editor.sheetLoader = () => import('@universal-office/sheet'). |
Pictures
Pictures follow Word’s rules (measured against Word): the XML each operation writes, the wrap and
position it keeps, how effects and adjustments are drawn on the page and in the PDF. Every operation is one
undo step and edits only the picture’s own XML. With the mouse: round handles resize (corners keep the
aspect ratio when it is locked, Shift inverts, Ctrl from the center), the handle above rotates (Shift: 15°
steps), dragging moves (an inline picture moves in the text), arrows nudge a floating picture, Delete removes
it. With topbar: the contextual Picture Format tab (Adjust · Picture
Styles · Accessibility · Arrange · Size), the compact bar’s Picture group, Format
› Picture, the context menu, the Format Picture, Alt Text and Selection panes and the Layout and
Compress Pictures dialogs.
| Method | Description |
|---|---|
selectedImage(): ImageState | null | { inline, wrap, widthPt, heightPt, rotation, altText, decorative, naturalPt, lockAspect, moveWithText, format } — format is the parsed picture (wrap, position, crop, geometry, line, effects, 3-D, a:blip adjustments). selectedImagePreview(w, h) returns the original pixels for gallery previews; deleteSelectedImage(). |
setImageWrap(kind) | 'inline' | 'square' | 'tight' | 'through' | 'topAndBottom' | 'behind' | 'front'. From inline the picture stays where it was (offset from the column and the paragraph). Tight/Through on a picture with transparency generate its contour like Word; text then wraps along the contour line by line. |
setImagePosition(preset) · setImageMoveWithText(on) · setImageLockAnchor(on) | Position gallery: 'inline' or '<top|center|bottom>-<left|center|right>' (Square wrap, aligned to the margin). Move with Text / Fix Position on Page keep the picture in place. |
setImageLayout(o) | The Layout dialog in one step: { wrap, wrapText, distPt, posH, posV, lockAnchor, allowOverlap, layoutInCell, widthPt, heightPt, relWidth, relHeight, lockAspect, rotation, moveWithText }; positions by alignment, absolute offset or percentage, relative to margin, page, column, character, paragraph or line. |
startEditWrapPoints() · endEditWrapPoints() · editingWrapPoints() | Edit Wrap Points: drag a point, Ctrl+click an edge to add one, Ctrl+click a point to remove it (edited="1"). Square becomes Tight, like Word. |
arrangeImage(op) · alignImage(kind, relativeTo?) · imageAlignTo | Order: 'front' | 'back' | 'forward' | 'backward' | 'frontOfText' | 'behindText'. Align: 'left' | 'center' | 'right' | 'top' | 'middle' | 'bottom' relative to 'margin' (default) or 'page'. |
setImageSize({ widthPt, heightPt }) · setImageRotation(deg) · rotateImage(±90) · flipImage('h' | 'v') | Size, rotation and flips; the effect margin (wp:effectExtent) is recalculated like Word. |
selectionPaneItems() · selectPaneItem(key) · renamePaneItem(key, name) · setPaneItemHidden(key | null, hidden) | Selection Pane: the floating pictures from front to back. A hidden floating picture is not drawn and text does not wrap around it (an inline one stays, like Word). |
startImageCrop() · endImageCrop() · croppingImage() | Crop mode: black crop handles on the frame, the whole picture dimmed around it; drag inside to move the picture in the frame. Esc, Enter or a click outside ends it. |
setImageCrop({ l, t, r, b }) · cropImageFillFit('fill' | 'fit') · cropImageToAspect(w, h) · cropImageToShape(prst) | Free crop in fractions of the whole picture (negative = margin), Fill/Fit, aspect ratio, and Crop to Shape with any DrawingML preset. |
setImageBorder({ color, weightPt, dash }) · setImageEffect(kind, preset | null) · setImageFormat(o) | Picture Border and Picture Effects ('shadow' | 'reflection' | 'glow' | 'softEdge' | 'bevel' | 'rotation', Word’s presets); setImageFormat({ line, shadow, reflection, glow, softEdge, threeD }) sets exact values (the Format Picture pane). resolveDmlColor(color) resolves a DrawingML color with the document theme. |
setImageAdjust({ sharpen, bright, contrast, saturation, temperature }): Promise | Corrections and Color (Office 2010 adjustments): the picture is processed like Word (models measured against the image Word writes) and the original is kept in the a14:imgLayer. |
setImageRecolor(preset | color) · setImageTransparency(percent) · setImageTransparentColor(hex | null) · startTransparentColorPick() | Recolor (grayscale, sepia, washout, black and white, theme dark/light variations, More Variations), picture transparency and Set Transparent Color (the next click on the picture picks it). |
changeImage(bytes, ext) · changeImageFromFile() · changeImageFromClipboard() · resetImage(size?) · compressImages({ ppi, deleteCropped, all }) | Change Picture keeps the formatting and the width; Reset Picture (and Size); Compress Pictures resamples to the resolution and can drop cropped areas. |
setImageAltText({ text, title, decorative }) | Alt text on wp:docPr and pic:cNvPr; Mark as decorative. |
Shadows, reflection, glow, soft edges and bevels are drawn with models measured against Word, on the canvas and in the PDF (each effect as an RGBA image with a soft mask, like Word). Not included: Remove Background, Artistic Effects (kept when present in the file), Picture Layout, online pictures and icons; 3-D rotation is kept and saved but drawn flat.
Shapes and text boxes
Text boxes and shapes follow Word’s rules (measured against Word): the XML each operation writes
(wps:wsp inside mc:AlternateContent with the VML fallback rebuilt like Word), linked
text boxes and the text flowing between them, vertical text and the theme’s shape styles. Click inside a
text box to edit its text (one undo stack with the document, like Word); click its border to select the shape:
round handles resize, the handle above rotates, dragging moves; Esc in the text selects the shape, typing with
the shape selected adds to its text, Delete removes it, Ctrl+C / Ctrl+V copy it. A document in compatibility
mode (Word 2007 or earlier) and a text box that came only as VML stay VML when saved, like Word. With
topbar: the contextual Shape Format tab (Insert Shapes · Shape Styles
· Text · Accessibility · Arrange · Size), Insert › Text Box (gallery and Draw
Text Box), the compact bar’s Shape group, Format › Shape, the context menu and the Format Shape
pane.
| Method | Description |
|---|---|
insertTextbox(id?) · textboxTemplates() | Text Box gallery (our own designs): the box is anchored to the paragraph of the cursor and its sample text is selected, so typing replaces it. |
drawTextbox(vertical?) · drawingTextbox() · cancelDrawTextbox() | Draw (Vertical) Text Box: the next drag on the page draws it, positioned from the column and the paragraph; a click makes a 1×1 inch box. |
selectedShape(): ShapeState | null | { kind, inline, wrap, widthPt, heightPt, rotation, flipH, flipV, lockAspect, moveWithText, lockAnchor, name, altText, decorative, geometry, styleIndex, text, link, editingText, format } — the selected shape, text box or group (or the text box being edited). editSelectedTextbox(), deleteSelectedShape(). |
setShapeStyle(n) · setShapeFill(fill) · setShapePictureFill(bytes, ext, tile?) · setShapeOutline(o) | Shape Styles gallery (1–77, as Word writes each one), Shape Fill (a color, a gradient — shapeGradientVariations() —, a pattern, picture or texture; null = No Fill) and Shape Outline ({ color | null, weightPt, dash, compound }; No Outline keeps the previous line in a14:hiddenLine). |
setShapeEffect(kind, preset | null) · setShapeFormat(o) · changeShape(prst) | Shape Effects (the same presets as the pictures), exact values (the Format Shape pane) and Change Shape (the text goes into the shape’s text rectangle). |
setTextboxOptions({ marginsPt, anchor, direction, wrap, autofit, upright }) | Internal margins, Align Text ('t' | 'ctr' | 'b'), Text Direction ('horz' | 'vert' | 'vert270' | 'eaVert' | …), Wrap text in shape, Resize shape to fit text, Do not rotate text. |
createTextboxLink() · linkingTextbox() · cancelTextboxLink() · linkTextboxTo(key) · breakTextboxLink() | Create Link: the next click on an empty text box continues the text there (a box with text is refused, uw-blocked). Break Link: the following boxes leave the chain and the text stays in the ones before. |
setShapeWrap · setShapePosition · setShapeMoveWithText · setShapeLockAnchor · setShapeLayout · arrangeShape · alignShape · setShapeSize · setShapeRotation · rotateShape · flipShape · setShapeAltText | Arrange and Size, as for pictures. The Selection Pane (selectionPaneItems() …) lists pictures, text boxes, shapes and groups. |
setAsDefaultTextbox() | Set as Default Text Box: fill, outline, effects and text options go into the theme (a:objectDefaults/a:txDef, like Word) and are used by the next drawn boxes. |
saveSelectionToTextboxGallery(name?) · removeTextboxGalleryItem(id) | Save Selection to Text Box Gallery: the selected box (format, size, position and text) becomes an item of the gallery’s General section. The host keeps them (host.loadTextboxGallery() / saveTextboxGallery(json), like Word’s user building blocks); without one, the origin’s localStorage. |
Not included: WordArt styles, inserting new shapes, Edit Points and grouping (separate work items), Word’s own Text Box gallery designs and textures; 3-D rotation is kept and saved but drawn flat.
Home tab: font, lists, clipboard, text effects, editing
What the Home tab of the built-in bars does, as public methods. The behavior was measured in Word (Office 365, pt-BR) — the XML each command writes and how the page is drawn.
Font
| Method | Description |
|---|---|
setFontFormat(f) | Several character properties at once: { fontFamily, sizePt, bold, italic, underline, underlineColor, color, strike, doubleStrike, superscript, subscript, allCaps, smallCaps, hidden, scalePct, spacingTwips, positionHalfPt, kernMinHalfPt } (the Font dialog). |
setUnderline(style) / toggleUnderline(style?) / setUnderlineColor(c) | The 17 underline styles of Word ('single' | 'words' | 'double' | 'thick' | 'dotted' | 'wave' | …), drawn as Word draws them; color as hex or theme color. |
setColor(c) | Hex ('C00000') or a theme color { themeColor: 'accent1', tint?, shade? }. |
changeCase(mode) | 'upper' | 'lower' | 'sentence' | 'title' | 'toggle' | 'next' (Shift+F3 cycles). |
setDefaultFont(f) | Font › Set As Default: writes the document defaults. |
copyFormat(sticky?) / cancelFormatPainter() | Format Painter; sticky = double-click (stays on until Esc). |
paragraphBorderPreset(kind) / setParagraphBorders(sides) / insertHorizontalLine() | The Borders button and Horizontal Line. |
Lists
| Method | Description |
|---|---|
applyListLibrary(kind, index) / applyMultilevelLibrary(index) | Bullet, numbering and multilevel libraries (the items of Word); null = None. |
listInfo() / documentLists() / listLibrary(kind) | The caret's list, the lists of the document, the library items. |
setListLevel(ilvl) / changeListLevel(delta) | Change List Level (Tab / Shift+Tab at the start of an item). |
restartNumbering(start?) / continueNumbering() / setNumberingValue(o) | Restart at 1, Continue Numbering, Set Numbering Value. |
defineListLevel(o) | Define New Bullet / Number Format: { bullet?, picture?, numFmt?, lvlText?, start?, align?, font?, bold?, italic?, sizePt?, color? }. picture: { data, ext, name? } writes a picture bullet (w:numPicBullet), drawn at the level's size − 2 pt. |
defineMultilevelList(levels, o?) / createListStyle(name, levels) / applyListStyle(id) / modifyListStyle(id, levels) | Multilevel lists linked to headings and list styles. |
Clipboard and paste options
| Method | Description |
|---|---|
paste(mode?) / repaste(mode, list?) / pasteOptions() | Keep Source Formatting ('keep'), Merge ('merge'), Picture, Keep Text Only ('text'); lists: Continue / New List. The floating "(Ctrl)" button uses these. |
pasteSpecial(format, { link? }) / pasteSpecialFormats() | Paste Special ('rtf' | 'text' | 'html' | 'unicode' | 'picture' | 'image') and Paste Link (a LINK field to the source, when the host gives the file path). |
clipboardItems() / pasteClipboardItem(id) / pasteAllClipboardItems() / removeClipboardItem(id) / clearClipboardItems() / onClipboardChange(f) | The Clipboard pane (the last 24 items, shared by the editors of the page). |
Text effects and typography
| Method | Description |
|---|---|
textEffects() / setTextEffects(patch) | The w14 effects of the selection: fill (solid, gradient, none), outline, shadow, reflection, glow; null removes one. w14:alpha is transparency (60% → 60000). |
applyTextEffectPreset(index) | The gallery of the Text Effects button (null = clear). |
setTextGradient({ angleDeg, light }) | Font Color › Gradient. |
setOpenType(patch) | { ligatures, numForm, numSpacing, stylisticSets, cntxtAlts } — laid out with the font's GSUB (ligatures, old-style/tabular figures, stylistic sets). |
Find, replace, go to and selection
| Method | Description |
|---|---|
findNextMatch(q, o?) | Selects the next occurrence; o.direction 'all' | 'down' | 'up' (wrapped = continued from the start). q: { text, matchCase, wholeWord, wildcards, soundsLike, allForms, prefix, suffix, ignorePunct, ignoreSpace, format } — Word's special characters (^p ^t ^l ^m ^? ^# ^$ ^w …) and wildcards (? * @ {n;m} < > [ ] ( )). |
replaceMatch(q, text, o?) / replaceAllMatches(q, text, o?) | Replace / Replace All (one undo step). Without match case the new text follows the case of the found one; it takes the formatting of the first found character plus o.replaceFormat; ^&, ^c and \1 (wildcards) in the new text. |
countMatches(q) / highlightMatches(q) / clearSearch() | Reading Highlight (screen only, never in the PDF). |
selectAllMatches(q, { within? }) | Find In › Main Document / Current Selection: all occurrences as a non-contiguous selection. |
goTo(what, target?) | Go To: 'page' | 'section' | 'line' | 'bookmark' | 'comment' | 'footnote' | 'endnote' | 'field' | 'table' | 'graphic' | 'equation' | 'object' | 'heading'; target = number, '+2'/'-1' or a name. |
getSelectionRanges() / setSelectionRanges(ranges) | Non-contiguous selection (Ctrl+drag; Ctrl+click = sentence): character and paragraph formatting apply to every range; Delete and Cut remove them all. |
selectSimilarFormatting() | Select › Select Text with Similar Formatting. |
setSelectObjectsMode(on) / selectPaneItems(keys) / selectedObjectCount() / alignObjects(kind) | Select Objects (lasso over the page, Shift/Ctrl+click), several drawing objects moved, deleted and aligned/distributed together. |
Clipboard, find and replace
| Method | Description |
|---|---|
copy() / cut() / paste() | Async; keep a rich clipboard internally. |
pastePlain() | Pastes as plain text, without formatting. |
findNext(needle): boolean | Selects the next occurrence (case-insensitive); true if found. With Word's options (wildcards, special characters, formatting) see Find, replace, go to and selection. For the Navigation Pane search (all matches, options, highlight) see search(). |
replaceAll(needle, replacement): number | Replaces all occurrences; returns the count. |
Navigation Pane, ruler and gridlines
With topbar, View › Show turns on the Navigation Pane (also Ctrl+F),
the Ruler and the Gridlines, as in Word. The pane has a search box and three
tabs: Headings (the tree of the body's headings — click to go, collapse/expand, drag a heading to
move its whole section, right-click to promote/demote, add, delete or select), Pages (thumbnails) and
Results (the matches with the text around them). The heading tree is built like Word's (checked on real
documents): the built-in Heading styles count by name even without w:outlineLvl, list numbers and All
Caps show as in Word, headings in tables and empty ones are left out.
The ruler shows the margins, the section's columns, the table cells, the paragraph's indents and tab stops
(centimeters with lang="pt" or lang="es", inches otherwise): drag to change them (0.25 cm or 1/16" steps;
Alt = free), click to set a tab, drag a tab off to remove it, double-click for Page Setup, Paragraph or Tabs.
Dragging writes what Word writes: only the attributes that differ from the style, tab stops in position order and
w:val="clear" for a style's tab that was removed. Gridlines draw the document's drawing grid (9 pt
from the margins by default) on screen only.
| Method | Description |
|---|---|
getRulerInfo(): RulerInfo | null | Geometry at the caret, in twips and page coordinates: { page, pageWidthTwips, pageHeightTwips, margins, columns: { x, w }[], frame: { x0, x1 }, indents: { left, right, firstLine }, tabs, defaultTabTwips, where: 'body' | 'cell' | 'header' | 'footer' | 'textbox', table: { cols: { x, boundary }[], current, rows: { top, bottom, row }[] } | null, lineTop, readOnly }. frame is the paragraph's column, cell text area, header/footer or text box; indents and tabs are measured from it. null in Read Mode and Outline. |
setParagraphIndents({ left?, right?, firstLine? }) | Absolute indents for every selected paragraph, one undo step. An attribute equal to the inherited one is removed (Word drops w:ind when nothing is left). |
getTabStops() | { tabs: { pos, align: 'left' | 'center' | 'right' | 'decimal' | 'bar', leader?: 'dot' | 'hyphen' | 'underscore' | 'heavy' | 'middleDot' }[], defaultTabTwips } — the effective tab stops of the caret's paragraph. |
setTabStops(tabs, only?) | Sets the effective tab stops of the selected paragraphs. only: { add?, remove? } adds/removes just those positions in each paragraph (what the ruler does with several paragraphs selected). |
getDefaultTabStop() / setDefaultTabStop(twips) | The document's default tab stop (w:defaultTabStop in settings.xml; 708 in a new document). |
resizeTableColumn(boundary, deltaTwips) / resizeTableRow(row, deltaTwips) | Moves a column boundary (grid boundary; 0 = left edge) or a row's bottom in the table at the caret, like dragging its border. |
getHeadings(): HeadingInfo[] | { index, level, text, para, page } for each heading of the body. currentHeading() = the heading whose section holds the caret. |
goToHeading(i) / selectHeading(i) | Puts the caret at the heading (scrolled to the top) / selects the heading and its content. |
moveHeading(i, before): boolean | Moves the heading's section (up to the next heading of the same or a higher level, tables included) in front of heading before (getHeadings().length = end of the document). One undo step. |
promoteHeading(i) / demoteHeading(i) | Heading n ± 1 for the heading and its subheadings. |
insertHeading(i, where) / deleteHeading(i) | New heading 'before' or 'after' (same level) or 'sub'heading (level + 1, at the end of the section) / deletes the heading with its content. |
search(text, opts?): SearchResult[] | Finds in the body and the tables. opts: { matchCase?, wholeWord?, highlight? }. Each result: { index, start, end, before, match, after, page, heading, inTable }. Matches are highlighted on screen (never in PDF or print). |
goToSearchResult(i) / clearSearch() | Selects a result (entering the table cell when needed) / clears the search and the highlight. |
layoutPageCount() / paintPageThumbnail(page, canvas, cssWidth) / goToPage(page) | Pages of the Print Layout, a page drawn into a canvas (the Pages tab) and scrolling to a page. |
showGridlines(on) / gridlinesShown() | The document grid on the pages (View › Gridlines). Not saved in the file. |
Header and footer
With topbar, editing a header or footer shows the Header & Footer tab of the ribbon
(the compact bar has the same under Insert › Headers & footers): galleries of built-in designs for the
header, the footer and page numbers (top or bottom of the page, page margin, current position), Date & Time,
Document Info, Go to Header/Footer, Previous/Next, Link to Previous, Different First Page, Different Odd & Even
Pages, Show Document Text, the distances from the page edge and Insert Alignment Tab. Each page shows the name of its
part (“First Page Header -Section 2-”) and “Same as Previous” when it comes from the previous
section. What is written follows Word: unlinking copies the inherited part into a new part of the section (pictures
included), linking removes the section's part from the file, page numbers from the galleries are kept in the block
Remove Page Numbers finds, Update automatically inserts a TIME field. Text, headers/footers and
these options share one undo history; saving keeps the header or footer in editing.
| Method | Description |
|---|---|
enterHeaderFooter(kind, activePage?) | Enters editing of a page's 'header' | 'footer'. |
exitHeaderFooter() | Leaves editing and returns to the document body. |
editingHeaderFooter() | Returns 'header' | 'footer' | null. |
getHeaderFooterOptions(): HeaderFooterOptions | null | Options of the section at the caret (or of the page being edited): { section, sectionCount, page, part: { kind, type: 'default' | 'first' | 'even' } | null, differentFirstPage, differentOddEven, headerDistance, footerDistance, linkToPrevious, documentTextShown } (distances in twips). |
setDifferentFirstPage(on) / setDifferentOddEven(on) | Different First Page (w:titlePg, per section) / Different Odd & Even Pages (w:evenAndOddHeaders, for the document). One undo step; in editing, the caret moves to the part the page now shows. |
setHeaderFooterDistance({ header?, footer? }) | Distance of the header from the top and of the footer from the bottom of the page (twips), for the section. |
setLinkToPrevious(on, kind?) | Link to Previous for the part being edited (sections after the first). |
goToHeaderFooter(kind?) / nextHeaderFooter() / previousHeaderFooter() | Go to Header/Footer; Next/Previous in Word's order (per section: first page, even page, then the other pages). |
showDocumentText(on) / documentTextShown() | Show Document Text while editing a header or footer (screen only). |
headerFooterTemplates(gallery) / insertHeaderFooterTemplate(gallery, id) | Designs of a gallery ('header' | 'footer' | 'pageTop' | 'pageBottom' | 'pageMargin' | 'pageCurrent') as { id, name }[] and inserting one: header, footer and top/bottom/margin page numbers replace the content of the part shown on the page; 'pageCurrent' inserts at the caret. |
paintHeaderFooterTemplate(gallery, id, canvas, cssWidth): boolean | Draws the thumbnail of a design with the layout engine. |
removeHeaderFooter(kind) / removePageNumbers() | Remove Header/Footer (empties the part of the page at the caret) / Remove Page Numbers (gallery page numbers of that page's header and footer). |
getPageNumberFormat() / setPageNumberFormat({ format?, chapter?, start? }) | Format Page Numbers of the section: format (decimal, numberInDash, lowerLetter, upperLetter, lowerRoman, upperRoman), chapter: { level, separator } | null (the number of the last heading of that level on or before the page, e.g. 1-3) and start (null = continue from the previous section). |
dateTimeFormats(lang?) / insertDateTime(pattern, update?, lang?) | Date & Time formats of the language ({ pattern, sample }[]) and insertion (update = a TIME field). |
insertDocumentInfo(kind, fileName?) | Author, document title, file name or file path as fields (AUTHOR, TITLE, FILENAME). |
insertAlignmentTab(alignment, relativeTo?, leader?) | Alignment tab (w:ptab): 'left' | 'center' | 'right', relative to the 'margin' or the 'indent'. |
Page fields and a cover page
The page fields follow Word (measured in Word 365 with a cover page — Different First Page and numbering
starting at 0 — and three more pages): on the page after the cover PAGE is 1,
NUMPAGES is 4 (every page, the cover included) and SECTIONPAGES counts the
pages of the page's own section (4 with one section, 3 with the cover in a section of
its own). The total without the cover is a formula field:
Page { PAGE } of { = { NUMPAGES } - 1 } → “Page 1 of 3” (in Word: Ctrl+F9 for the
braces, = , Ctrl+F9 again for NUMPAGES, - 1, F9).
The layout engine (screen, PDF, viewer, .NET) recalculates formula fields as Word does when it paginates: in
headers and footers always, in the body only when the code has a nested field. The evaluation is small and safe:
numbers (pt-BR notation), + - * /, parentheses and sign over PAGE, NUMPAGES,
SECTIONPAGES, SECTION and nested formulas; the result as Word shows it (up to two
decimals), with \# "00" or \* roman/ROMAN/alphabetic/Arabic.
Anything else keeps the cached result. The model keeps the nested code in Run.fieldCode
(" = { NUMPAGES } - 1 ") and saving writes the nested fields back.
Cover pages from Word's gallery. When the body has a cover page from Word's gallery (Insert
› Cover Page: a content control with w:docPartGallery “Cover Pages”)
and the first section starts numbering at 0 (w:pgNumType w:start="0", which Word
writes with that cover), Word's NUMPAGES already leaves the cover out (3 in the example
above, so { = { NUMPAGES } - 1 } gives 2). The engine does the same, and only then:
without the gallery control, with any other start (or start="0" only in a later section),
NUMPAGES counts every page, and SECTIONPAGES never leaves the cover out. The editor's own
Insert › Cover Page turns on Different First Page but does not start the numbering at 0.
Page design (watermark, page color, cover page)
With topbar, the ribbon's Design tab has the Page Background group
(the compact bar: Format › Page background): the Watermark gallery (Confidential, Do Not Copy,
Draft, Sample, ASAP, Urgent, diagonal and horizontal, in the UI language) with Custom Watermark (picture with scale and
washout; text with language, font, size, color, semitransparent, diagonal or horizontal) and Remove Watermark;
Page Color with the theme palette, standard colors, No Color, More Colors and Fill
Effects (gradient with one or two colors or our own presets and the six shading styles, texture, the 48
patterns, picture); and Page Borders. Insert › Pages adds Cover Page (our own designs, filled
from the document properties or with placeholders) and Blank Page. What is written follows Word: the
watermark is VML in the first paragraph of the three headers of the section (Word recognizes and removes it), the page
color is w:background (+ v:background for the effects) with
w:displayBackgroundShape, the cover page is a w:sdt “Cover Pages” at the start
ending in a page break, with Different First Page. The page color and fill show on screen, always go into the PDF and
stay out of printing, as in Word.
| Method | Description |
|---|---|
pageBackground(): PageBackgroundInfo | null | The page color: { color?, themeColor?, tint?, shade?, fill?, shown } (fill is the v:fill: type 'gradient' | 'gradientRadial' | 'pattern' | 'tile' | 'frame', colors, angle, focus…); null = No Color. |
setPageColor(color) | 'RRGGBB', { themeColor, tint?, shade? } (themeColor as in w:themeColor; tint/shade 0–1) or null (No Color). One undo step. |
setPageFill(fill: PageFillInput | null) | Fill Effects: { type: 'gradient', colors: 'one', color, degree, style, variant } (degree 0 dark – 1 light), { type: 'gradient', colors: 'two', color, color2, style, variant }, { type: 'gradient', colors: 'preset', preset, style, variant }, { type: 'pattern', pattern, color, background } or { type: 'texture' | 'picture', data, ext, name }; style: 'horizontal' | 'vertical' | 'diagonalUp' | 'diagonalDown' | 'fromCorner' | 'fromCenter'. |
pageFillOptions() | Gradient presets, variants per style and the 48 patterns (DrawingML preset names) with names in the UI language. |
watermark(): WatermarkInfo | null | The watermark of the section at the caret: text (text, font, size, color, semitransparent, layout) or picture (washout), with its box in points. |
watermarkGallery() / watermarkTexts() | Gallery items ({ id, label, categoryLabel, … }) and the text list of the Custom Watermark dialog, in the UI language. |
setWatermark(spec: WatermarkSpec | string) | A gallery id ('confidential1', 'draft2'…) or { kind: 'text', text, font, sizePt?, color, semitransparent, layout, lang? } / { kind: 'picture', data, ext, title, scale?, washout } (no sizePt/scale = Auto). Replaces the current one in the three headers of the section; one undo step. |
removeWatermark() | Remove Watermark, from every section. |
coverPages() / hasCoverPage() | The cover page designs ({ id, name }[]) and whether the document has one. |
insertCoverPage(id) / removeCoverPage(): boolean | Insert a cover page at the start (replacing the current one; the title placeholder comes selected) / Remove Current Cover Page. |
paintWatermarkTemplate(id, canvas, cssWidth) / paintCoverTemplate(id, canvas, cssWidth) | Draw a gallery thumbnail (a whole page) with the layout engine. |
insertBlankPage() | Blank Page: page break, an empty paragraph with the caret and another page break, splitting the paragraph at the caret. |
Text layout (hyphenation, line numbers, indent and spacing)
With topbar, the ribbon's Layout tab has the Line Numbers and
Hyphenation menus (Page Setup group) and the Indent / Spacing boxes
(Paragraph group: left/right indent in cm with lang="pt"/"es" or inches, spacing before/after in pt with
Auto below 0; type any unit, Enter applies, Esc restores); the compact bar has both menus under Tools.
Hyphenation: None, Automatic, Manual (word by word, inserting optional hyphens) and Hyphenation Options (hyphenate
automatically, words in CAPS, zone, consecutive hyphens limit). Line Numbers: None, Continuous, Restart Each Page,
Restart Each Section, Suppress for Current Paragraph and Line Numbering Options (Page Setup › Layout ›
Line Numbers: start at, from text, count by, numbering). The Paragraph dialog has a Line and Page Breaks tab
and Page Setup has Margins, Paper and Layout tabs. Ctrl+- types an optional hyphen and
Ctrl+Shift+- a nonbreaking hyphen. Everything is written the way Word writes it; line numbers are drawn on screen, in
the PDF and in print with the Line Number style.
| Method | Description |
|---|---|
getHyphenation(): HyphenationInfo | { auto, caps, zoneTwips, limit } (limit 0 = no limit). |
setHyphenation(mode: 'none' | 'auto') / setHyphenationOptions(o: Partial<HyphenationInfo>) | The menu / the Hyphenation Options dialog; one undo step. w:autoHyphenation, w:consecutiveHyphenLimit, w:hyphenationZone, w:doNotHyphenateCaps in settings.xml (None removes the element; optional hyphens stay). |
nextManualHyphenation(): Promise<ManualHyphenation | null> | Next word that automatic hyphenation would break at the end of a line (in the selection, or the whole document), selected: { word, lang, points, suggested, limit } — break points as letters before the hyphen; limit is the last one before the margin. null when done. |
applyManualHyphenation(letters) / skipManualHyphenation() / endManualHyphenation() | Yes (an optional hyphen, w:softHyphen; one undo step), No, and end. |
getLineNumbering() | { mode: 'none' | 'continuous' | 'page' | 'section', startAt, countBy, distanceTwips, mixed } for the sections the selection touches (distanceTwips 0 = Auto). |
setLineNumbering(mode) | The Line Numbers menu, on the sections the selection touches (start, count by and distance stay). |
setLineNumberingOptions(o: LineNumberingOptions, applyTo?) | The Line Numbers dialog: { on, startAt, countBy, distanceTwips, restart: 'page' | 'section' | 'continuous' }; applyTo as in setPageSetup. Writes w:lnNumType like Word (w:start = start at − 1). |
toggleLineNumberSuppression() / lineNumbersSuppressed(): boolean | Suppress for Current Paragraph (w:suppressLineNumbers). |
getParagraphFlow(): ParagraphFlow | null / setParagraphFlow(f) | Line and Page Breaks: widowControl, keepNext, keepLines, pageBreakBefore, suppressLineNumbers, suppressAutoHyphens, textboxTightWrap (effective values, null = mixed). Only what differs from the style is written; turning off what the style turns on writes w:val="0". |
getParagraphLayout(): ParagraphLayoutInfo | null / setParagraphLayout(v) | The Indent/Spacing boxes: { left, right, before, after } in twips (before/after may be 'auto', null = mixed); a value equal to the style's is not written. |
setSectionStart(type, applyTo?) / setVerticalAlignment(v, applyTo?) | Section start (w:type) and vertical alignment 'top' | 'center' | 'both' | 'bottom' (w:vAlign). |
Footnotes and endnotes
Notes are edited in place: clicking the note area (bottom of the page, or the endnotes after the text) enters the note; Esc or a click in the text goes back. Text and notes share one undo history. Deleting a reference deletes its note; the first Backspace right after a reference only selects it; pasting a copied reference creates a new note with a copy of the text. With Track Changes on, a new note is an insertion and a deleted reference keeps its note until the deletion is accepted; revisions inside notes appear in getRevisions() (story: 'footnote' | 'endnote') and in Accept/Reject All. Ctrl+Alt+F / Ctrl+Alt+D insert a footnote / endnote.
| Method | Description |
|---|---|
insertFootnote(opts?): number | nullinsertEndnote(opts?): number | null | Inserts a note at the end of the selection (nothing is deleted) and moves the caret into it; { mark?: string } is a custom mark instead of the number. Not available in headers/footers, text boxes, inside a note or in a plain text, date, combo box or drop-down content control. Returns the note id. |
canInsertNote(): boolean | Whether a note can be inserted at the caret. |
editingNote() | The note being edited — { kind: 'footnote' | 'endnote', id } | null. |
noteCount(kind): number | How many notes of the kind the text references. |
nextNote(kind = 'footnote', dir = 1): boolean | Next (1) or previous (-1) note: in the text the caret goes before the reference; inside the notes, to the start of the next note. |
showNotes(kind?): boolean | In the text, opens the note of the reference at the caret (or the next one); inside a note, goes back to its reference. |
openNote(kind, id) · goToNoteRef(kind, id) | Edits a note (caret at the end) · puts the caret right after its reference. |
getNoteOptions(kind) | Options of the caret's section: { position, numberFormat, startAt, restart, columns? }. position: 'pageBottom' | 'beneathText' (footnotes) or 'docEnd' | 'sectEnd' (endnotes); numberFormat: 'decimal' | 'lowerLetter' | 'upperLetter' | 'lowerRoman' | 'upperRoman' | 'chicago'; restart: 'continuous' | 'eachSect' | 'eachPage' (per page: footnotes only); columns: footnote area columns, 0 = as the section. |
setNoteOptions(kind, options, scope = 'document') | Changes the options for the whole document or for 'section' (the caret's section), the way Word writes them (section properties and document settings). With numbering restarted per section or page the start is 1. |
convertNotes(mode, only?): number | 'toEndnotes' | 'toFootnotes' | 'swap', or only the note { kind, id }; the content takes the other kind's note styles. Returns how many notes changed. |
Links and references
Bookmarks, cross-references, captions, the table of figures, the table of contents and hyperlinks are written the way Word writes them (bookmark XML and ids, hidden _Ref/_Toc bookmarks, complex REF/PAGEREF/NOTEREF fields, SEQ/STYLEREF captions, multi-paragraph TOC fields). Bookmarks follow edits like Word's: typing at the start of a bookmark goes inside it, at the end it stays out; deleting the whole bookmarked text deletes it; cut and paste moves it, copy does not duplicate it. The layout engine computes REF (exact bookmarked text, \n \r \w \d, \p above/below), NOTEREF, STYLEREF (\s, \n) and SEQ \s n the way Word does when it prints or exports. F9 updates the fields in the selection (Ctrl+A, F9: all); Ctrl+click follows a cross-reference inserted as a hyperlink.
| Method | Description |
|---|---|
insertBookmark(name): boolean | Adds a bookmark on the selection (a point bookmark at the caret). A repeated name (case-insensitive) moves it. false for an invalid name: a letter, then letters, digits or _, up to 40. |
deleteBookmark(name) · goToBookmark(name) | Deletes the bookmark (the text stays) · selects it. |
getBookmarks({ hidden?, sort? }) | { name, hidden, text }[]; sort: 'name' | 'location'; hidden includes _Ref, _Toc… Also hasBookmark(name), validBookmarkName(name). |
showBookmarks(on?) · bookmarksShown() | Gray brackets around the bookmarks (an I-beam for a point bookmark) — on screen only, never in the PDF or print; hidden bookmarks are not shown. |
getCrossReferenceItems(type, label?) | { id, text }[] for 'numbered' | 'heading' | 'bookmark' | 'footnote' | 'endnote' | 'caption' (captions of label). crossReferenceKinds(type) lists what can be inserted for the type. |
insertCrossReference(opts): boolean | { type, label?, item, kind, hyperlink = true, position?, separator? }; kind: 'text' | 'page' | 'number' | 'numberNoContext' | 'numberFullContext' | 'position' | 'noteNumber' | 'noteNumberFormatted' | 'captionEntire' | 'captionLabel' | 'captionText'. Creates a hidden _Ref bookmark on the target (reused by the next reference to it); position adds "above/below". |
insertCaption(opts): boolean | { label, title?, position?, excludeLabel?, numbering? } — above or below the selected picture or table, otherwise at the caret (the paragraph takes the Caption style). Renumbers the following captions of the label. |
getCaptionLabels() · addCaptionLabel(name) · deleteCaptionLabel(name) | Built-in labels (Figure, Table, Equation — in the UI language), new labels and the ones the document uses. |
getCaptionNumbering(label) · setCaptionNumbering(label, n) | { format: 'ARABIC' | 'alphabetic' | 'ALPHABETIC' | 'roman' | 'ROMAN', chapter?: { level, separator: 'hyphen' | 'period' | 'colon' | 'emDash' | 'enDash' } }; chapter numbers use STYLEREF n \s and SEQ … \s n. |
getAutoCaption() · setAutoCaption(auto) | { table?: { label, position } } — captions inserted tables. captionSettings (get/set) holds labels, numbering and AutoCaption (the bars keep it per machine). |
insertTableOfFigures(opts): boolean | { label, includeLabel?, pageNumbers?, rightAlign?, leader?, hyperlinks?, format? } → TOC \h \z \c "Label" with hidden _Toc bookmarks on the captions and the Table of Figures style; with the caret in a table of figures it is replaced. format: 'template' | 'classic' | 'distinctive' | 'centered' | 'formal' | 'simple'. |
updateTableOfFigures() · getTableOfFiguresOptions() | Updates the table of figures at the caret (or all) · its options. |
updateFields(scope = 'all', toc = 'all'): number | 'selection' (F9) or 'all': TOCs, table formulas and the cached results of REF, PAGEREF, NOTEREF, SEQ, STYLEREF; toc: 'pages' updates only the page numbers of the tables of contents. Returns how many changed. |
insertHyperlink(opts): boolean | { address?, anchor?, tip?, text? } — web address, file or mailto:, or a place in the document (anchor: a bookmark, '_top', or 'p:<paragraph>' for a heading, which gets a hidden _Toc bookmark); tip is the ScreenTip. On an existing link it edits it. |
canInsertField(): boolean | false inside a plain-text, date, combo box or drop-down list content control: Word refuses fields and hyperlinks there, so cross-references, captions at the caret, tables of figures and hyperlinks do nothing there. |
getLink() · getLinkTargets() · removeLink() | The link at the caret { address?, anchor?, tip?, text } · headings and bookmarks for "Place in this document" · removes the link and its Hyperlink style (the text stays). |
Table of contents
Tables of contents are TOC fields written the way Word writes them: entries in the TOC 1–9 styles with a right tab and leader, each one a hyperlink to a hidden _Toc bookmark on its heading with a PAGEREF page number. The gallery tables sit in a content control (w:sdt with docPartGallery="Table of Contents" and docPartUnique) with a TOC Heading paragraph — one per document, so a new one replaces it. With the caret inside, the control shows its frame and a tab with the gallery menu and Update Table… (screen only). The bars ask, like Word, whether to update only the page numbers or the entire table (the Update Table button, the control's tab and F9).
| Method | Description |
|---|---|
tocTemplates() · insertTocTemplate(id): boolean | { id, name }[]: 'auto1' ("Contents"), 'auto2' ("Table of Contents") — TOC \o "1-3" \h \z \u — and 'manual' (typed entries with placeholders and a right-aligned leader tab). Inserts it at the caret (an empty paragraph gives way to it) or replaces the gallery table already in the document. paintTocTemplate(id, canvas, cssWidth) draws the thumbnail. |
insertTableOfContents(options, replace?): boolean | { pageNumbers?, rightAlign?, leader?, hyperlinks?, format?, levels?, useStyles?, styles?, outlineLevels?, fields?, fieldId? } → \o "1-N", \n, \p " ", \h, \z, \t "Style;level", \u, \f [id]. format: 'template' | 'classic' | 'distinctive' | 'fancy' | 'modern' | 'formal' | 'simple' (rewrites the TOC 1–9 styles). replace: true replaces the table at the caret (or the first), false inserts another; omitted, the one at the caret is replaced. |
getTableOfContentsOptions() | The options of the table at the caret (or the first), with the tab leader. |
updateToc(mode = 'all'): boolean | 'pages' updates only the page numbers (text typed in the entries stays, the _Toc bookmarks are kept); 'all' rebuilds the entries. The table at the caret, or every TOC field. |
removeTableOfContents(): boolean | Removes the content control with its heading, or the field, and the _Toc bookmarks only its entries used. The table at the caret, or the first. |
getTocLevel() · setTocLevel(level) | Add Text: 0 = Do Not Show in Table of Contents, 1–9. Level N applies Heading N to a Normal or heading paragraph; Do Not Show turns a heading back into Normal; in other styles only the outline level changes. |
markTocEntry({ text, identifier = 'C', level = 1 }): boolean | Mark Table of Contents Entry (Alt+Shift+O; Option+Shift+O on a Mac): a TC "text" \f C \l "N" field at the end of the selection. A table built with fields lists them (\f id, \l "a-b"; TC … \n without the page number). tocEntrySuggestion() is the selected text. |
hasTableOfContents() · inTableOfContents() | The document has a table of contents · the caret is in one. |
Comments
| Method | Description |
|---|---|
addComment(text, author = this.author): number | null | Comments the current selection; returns the ID (or null if the selection is empty). |
removeComment(id) | Removes the comment. |
getComments() | Lists { id, author?, text }[]. |
goToComment(id) | Navigates to and selects the commented range. |
commentAnchorPx(id) | Anchor position in pixels — { topPx, heightPx, page } | null — for drawing UI alongside. |
Track changes
With tracking on, typing, deleting, Enter and formatting become revisions with
author and date, written as Word writes them (w:ins, w:del,
w:rPrChange, w:pPrChange, paragraph marks). The state is saved in the
.docx (w:trackRevisions). PDF export and printing follow the markup mode on screen.
| Method / property | Description |
|---|---|
toggleTrackChanges(on?) · isTrackingChanges() | Turns Track Changes on/off (without an argument: toggles). |
author · hasAuthor() | Name recorded on revisions and new comments: the author attribute, the property, or "Author"/"Autor". hasAuthor() tells whether one was given (the built-in bars ask otherwise). |
acceptChange({ moveNext = true }) · rejectChange(…) | Accepts/rejects the revisions in the selection, or the one at the cursor, then selects the next one (like Word's Accept and Reject buttons). Returns whether something changed. |
acceptAllChanges({ shown?, stopTracking? }) · rejectAllChanges(…) | All revisions — body, tables, headers and footers — or only those shown (Show Markup types and people). Returns how many were resolved. One undo step. |
nextChange() · previousChange() | Selects the next/previous revision (wraps around). false if there is none. |
getRevisions() | { kind: 'insert' | 'delete' | 'format' | 'paraFormat', author, date?, dateUtc?, text, description?, mark?, move?, story, color }[] in document order. description is the balloon text ("Formatted: Font: Bold"). |
acceptRevisionAt(i) · rejectRevisionAt(i) · selectRevision(i) | Acts on the i-th item of getRevisions(). |
revisionAtCaret() | The revision under the cursor with its index, or null. |
revisionAuthors() · authorColor(name) | Authors with revisions; the RRGGBB color of an author's markup (Word's palette, in order of appearance). |
setMarkupMode('simple' | 'all' | 'none' | 'original') · getMarkupMode() | Display for Review: Simple Markup (final text, red change bars), All Markup (default), No Markup, Original. |
setMarkupOptions({ insertionsDeletions, formatting, comments, balloons, authors }) · getMarkupOptions() | Show Markup: types, balloons ('revisions' · 'inline' · 'mixed') and specific people (null = everyone). |
TOC, navigation and page setup
| Method | Description |
|---|---|
updateToc(mode = 'all'): boolean | Updates the table of contents at the caret (or every TOC field) the way Word does — see Table of contents; true if the document had a TOC. |
navigateTo(link): boolean | Navigates to '#bookmarkName' or '#para:N'; true if found. |
setPageSetup(opts) | { orientation?: 'portrait' | 'landscape', size?: 'A4' | 'Letter', margins?: 'normal' | 'narrow' | 'wide', customMargins?: { top, right, bottom, left }, sectionStart?, verticalAlignment?, lineNumbering?, applyTo?: 'section' | 'document' | 'forward' | 'selection' } (custom margins in twips; the Layout tab's section start, vertical alignment and line numbers in the same undo step). Applies to the section(s) the selection touches; 'forward' inserts a next-page section break at the caret and 'selection' one before and one after the selection. Changing the orientation rotates the margins. |
setColumns(spec) | Columns of the caret's section. A preset — 'one' | 'two' | 'three' | 'left' | 'right' — applies only to the selected text when there is a selection (continuous breaks before and after it). Or { count, spaceTwips?, widths?: { widthTwips, spaceTwips }[], sep?, applyTo?, startNewColumn? }: widths for unequal columns, sep for a line between them, applyTo as in setPageSetup ('forward' and 'selection' insert continuous breaks; startNewColumn with 'forward' starts the new section in the next column). Columns are at least 720 twips wide; the spacing shrinks when they would not fit. |
getSection() | The caret's section: { index, count, type, orientation, pageWidthTwips, pageHeightTwips, margins, columns: { count, spaceTwips, sep, equalWidth, widths, preset, max, contentWidthTwips }, verticalAlignment, lineNumbering }. |
Plugins
| Method | Description |
|---|---|
use(plugin) | Installs a plugin on this instance. |
unuse(id): boolean | Removes a plugin by ID. |
pluginIds(): string[] | IDs of the installed plugins. |
UniversalWriteElement.register(plugin) (static) | Installs a plugin on every instance, like Quill.register: connected instances get it right away, new ones on connect. The same id again replaces it. A conflict in one instance is reported with console.warn and never stops the element from connecting. |
UniversalWriteElement.unregister(id): boolean (static) | Removes it from the registry and from the instances that got it from there (a plugin installed with use() stays). |
Plugin interface details (inline renderers, bar contributions) and a full example in Plugins.