Apply Word document styles to maintain consistent formatting across your document. Linked styles preserve the original Word styling system, including style inheritance and formatting rules.
Important: Linked Styles work with Word documents. This demo simulates the visual effect.

Real-World Usage

When a Word document is loaded:
// Styles are automatically imported from styles.xml
const styles = editor.helpers.linkedStyles.getStyles()

// Apply a style by ID
editor.commands.setStyleById('Heading1')

// Or with the style object
const titleStyle = editor.helpers.linkedStyles.getStyleById('Title')
editor.commands.setLinkedStyle(titleStyle)

OOXML Structure

<w:p>
  <w:pPr>
    <w:pStyle w:val="Heading1"/>
  </w:pPr>
  <w:r>
    <w:t>Text with Heading 1 style</w:t>
  </w:r>
</w:p>

Why you’d use this

  • Document Templates - Maintain corporate style guides
  • Consistency - Uniform formatting across large documents
  • Quick Formatting - One-click style application
  • Word Compatibility - Preserves Word’s style system
  • Style Updates - Change all instances by updating the style definition

Commands

setLinkedStyle

Apply a linked style to the selected paragraphs
Clears existing formatting when applying a style
const style = editor.helpers.linkedStyles.getStyleById('Heading1');
setLinkedStyle(style);
Parameters:
style
Object
required
The style object to apply

setStyleById

Apply a linked style by its ID
Looks up the style from loaded Word styles
// Apply a heading style
setStyleById('Heading1')

// Apply a normal style
setStyleById('Normal')
Parameters:
styleId
string
required
The style ID to apply (e.g., ‘Heading1’)

Helpers

getStyles

Get all available linked styles
const styles = editor.helpers.linkedStyles.getStyles();
// Returns all styles from the Word document
Returns: Array Array of linked style objects

getStyleById

Get a specific style by ID
const headingStyle = editor.helpers.linkedStyles.getStyleById('Heading1');
Parameters:
styleId
string
required
The style ID to find
Returns: Object The style object or undefined

Types

LinkedStyle

Style definition from Word document