Skip to content

StyleSheet

Jason [ND] edited this page Jun 29, 2019 · 5 revisions

NDAPI.getStyleSheet gives you access to the styles, fonts, and lists known to the editing session.

For example:

        const styleSheet=NDAPI.getStyleSheet(function(styleSheet) {
            console.log(JSON.stringify(styleSheet, null, 4));
        });

returns a JSON object with the following structure:

{
    "styles": {
    },
    "fonts": {
        "known": {
        },
        "full": {},
        "doc": {
        }
    },
    "lists": {
    }
}

Styles

The styles object contains each style defined in the docx.

For example:

        "C922": {
            "id": "C922",
            "type": 2,
            "name": "Normal",
            "default": true
        }

The id is what is used in the document to refer to this style.

The name is the human readable name you'd display in a user interface.

Here the values for the type key:

1 = character style
2 = paragraph style
3 = table style
4 = list style

A Word document can contain 1 default paragraph style and 1 default character style. The default key specifies whether this style is the default style for this type.

Fonts

[to be completed]

Lists

The lists object contains resolved concrete list definitions. That is, w:num definitions with their corresponding w:abstractNum values inserted.

See [ ] for more details.

Clone this wiki locally