docx icon indicating copy to clipboard operation
docx copied to clipboard

Numbers in numbering not indented

Open jannikb opened this issue 1 year ago • 5 comments

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.

docx-js-numbering-indentation document.docx

jannikb avatar Aug 30 '23 13:08 jannikb

I noticed the same things.

mmatiasautio avatar Jan 11 '24 15:01 mmatiasautio

Any update on this? Not working for me either.

https://github.com/dolanmiu/docx/issues/2590

lancejpollard avatar Feb 11 '24 20:02 lancejpollard

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)

anti-the-social avatar Feb 13 '24 08:02 anti-the-social

It's not working correctly in MS Word either.

mmatiasautio avatar Feb 13 '24 09:02 mmatiasautio

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.

saveliyvasilev avatar Apr 05 '24 19:04 saveliyvasilev