-
Notifications
You must be signed in to change notification settings - Fork 0
List numbering
In a docx document, list numbering is controlled by a paragraph property "numPr". As JSON, for example:
"numPr":{
"numId":"E476",
"ilvl":0,
"startAt":0
}
numId points to a concrete list (w:num) defined in the docx file's numbering definitions part. In turn, that concrete list points to an abstract list (w:abstractNum).
See officeopenxml.com for more.
The way to think about it is that at any point in the document, each of the abstract lists has counted to some value. In other words, as you move further down the document, each time an abstract list is used (via a concrete list), its counter is incremented (eg 1.1 to 1.2, or 2.8 to 3.1).
The concrete list is used to control how that value is displayed.
See the lists object in the getStylesheet callback (see the StyleSheet page)
For convenience and simplicity, the lists object contains the concrete lists, fully resolved against the relevant abstract list. That is, w:num definitions with their corresponding w:abstractNum values inserted.
In WordprocessingML a list has up to 9 levels. Each list object contains a lvl object containing an array giving the values for these 9 levels. Here is a typical lvl array entry:
{
"start": 1,
"numFmt": 0,
"lvlText": "%1)",
"suff": 0,
"lvlJc": 0
}
The values follow the corresponding OpenXML definitions.
For lvlText, please see http://officeopenxml.com/WPnumberingLevelText.php
For numFmt, here are what the numeric values mean:
0 decimal
1 upperRoman
2 lowerRoman
3 upperLetter
4 lowerLetter
23 bullet
(For the complete list, please see [MS-OSHARED], section 2.2.1.3 MSONFC)
For lvlJc, here are what the numeric values mean:
0 left
1 right
2 center
A paragraph is numbered if it has paragraph property "numPr". As JSON, for example:
"numPr":{
"numId":"E476",
"ilvl":0,
"startAt":0
}
To see the corresponding list definition, use getStylesheet to get the list object by Id. See further StyleSheet