guideStyles

# Overview

There are several ways to apply content formatting in Word. The first one is inline styling that is applied via various toolbar buttons and dropdowns. This formatting happens “in place”, and it always takes precedence over any other types of formatting.

The more advanced way to format large portions of a document are styles. This kind of formatting is applied to specific areas, like titles, headers, regular paragraphs, lists etc. and it is global, i.e. it is applied to the whole Word document.

The last way to style the document content are default document properties. They are applied via Format options, similarly to some inline styles, with the exception of choosing an option to apply them as the default formatting instead of the inline one.

The Import from Word converter recognizes all these styling methods and applies them by converting all of them into valid inline HTML styling.

# Content formatting

For a current list of all supported features that can be converted correctly by the Import from Word feature, please see dedicated guide.

# Word styles

Styles in Word documents allow keeping your formatting consistent within a document. Instead of applying the bold style to each heading, you can create a style that will include all required formatting and can be reused multiple times. This way, if you need to change the formatting, you only need to change it in the style, and it will be applied to all paragraphs that use that style.

For example, in the following document we applied a couple of different styles that provide the semantic value to the document and keep it clean and consistent:

Word styles.

The Import from Word converter recognizes all these styles and applies them to HTML, ensuring that the document is styled in the same way as in the original Word document. The applied styles follow the same formatting rules as content formatting.

Word styles pane in CKEditor 5.

Styles can be freely modified by the user and Import from Word ensures that they are converted properly, giving you a powerful tool to keep the proper document formatting inside your application.

# Supported features

  • Built-in Word styles, including custom modifications applied to them.
  • User-made styles that use different fonts, paragraphs, borders and numbering formatting.
  • Full support of “toggle properties”, i.e. character formatting properties, such as the bold formatting, that are toggled according to their positions in the style hierarchy.

# Known limitations

  • List styles are not supported.
  • Circular style references are not supported.

# Default styles

Word allows changing the default formatting of documents to style it in a specific way. You can apply the same style to the whole Word document without the need to apply it manually. As an example, you can open the Format menu, choose the Font option and then change some formatting such as font size and font family. After that, choose the “Default…” option and confirm the second dialog:

Word default styles.

The behavior of that Word feature highly impacts how the document will be styled after the conversion. Therefore, instead of applying the default styles always, that behavior is configurable via default_styles configuration option:

const config = {
    default_styles: true
}

By default, that option is disabled, which means that the document conversion will only keep styles explicitly applied by the user. Setting the defalut_styles option to true, will result in applying all styles that are used in a document.

To learn more about the available REST API configuration options for the Import from Word converter, read the Import from Word Cloud Services documentation.

# Supported features

  • Format, font and paragraph default styles that are applied to the whole document.
  • Line height and spacing default styles, that are not explicitly set by a user, but can be inferred from the Word specification.
  • Fonts declared in the document theme.