docx
docx copied to clipboard
Numbers in numbering not indented
I tried the demo for the bullets points and numbering https://github.com/dolanmiu/docx/blob/master/demo/3-numbering-and-bullet-points.ts. The bullet points seem to work just fine but while the text for the numberings is indented correctly the numbers stay at the beginning of the line. Similiar to #387 I tired versions 7.8.2 and 8.2.2 and opened the Document with MS Office and LibreOffice.
I noticed the same things.
Any update on this? Not working for me either.
https://github.com/dolanmiu/docx/issues/2590
If Word document is fine in MS Word and not fine in Libre, most likely this is an issue you should open in Libre Office, not in here since docxjs is just a constructor for the document.
Its quite known that different editors like Libre / MS Word / Google docs do interpret same file differently. Edge cases do never look same. Its like browser support/behaviour.
Docxjs just gives you constructor to create OOXML format document as an output. (zip file with xml files aka .docx file)
It's not working correctly in MS Word either.
A workaround that worked for me was to setup the config as this:
...
numbering: {
config: [
{
reference: 'number',
levels: [
{
level: 0,
format: LevelFormat.DECIMAL,
text: '%1.',
alignment: AlignmentType.LEFT,
style: {
paragraph: {
indent: { left: 720, hanging: 360 },
},
},
},
{
level: 1,
format: LevelFormat.UPPER_LETTER,
text: '%2.',
alignment: AlignmentType.LEFT,
style: {
paragraph: {
indent: { left: 1440, hanging: 360 },
},
},
},
{
level: 2,
format: LevelFormat.LOWER_ROMAN,
text: '(%3)',
alignment: AlignmentType.LEFT,
style: {
paragraph: {
indent: { left: 2160, hanging: 360 },
},
},
},
{
level: 3,
format: LevelFormat.LOWER_LETTER,
text: '%4)',
alignment: AlignmentType.LEFT,
style: {
paragraph: {
indent: { left: 2880, hanging: 360 },
},
},
},
],
},
],
},
The example given the repo had the same behavior as reported above.