dolanmiu / docx

Easily generate and modify .docx files with JS/TS with a nice declarative API. Works for Node and on the Browser.

Home Page:https://docx.js.org/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Adding different numbering within the same line of paragraph

mwashambw opened this issue · comments

I have been reading documentation about numbering, passed through all closed, opened issues and discussions but I have not figured out the way of attaining my disired output.

I want to create a document that look like following

  1. (a) Some random text
    (b) another text here

  2. (a) Some random text
    (b) another text here

  3. (a) (i) Some random text \n Bellow should be (ii) with indatation and hanging as (i)

    (b) (i) Some random text \n Bellow should be (ii) with indatation and hanging as (i)

It seem it require a feature of one paragraph having another paragraph but each with different numbering.
Is there any feature to implement this numbering ? OR is there any work round?

Hi!

Could you explain how do you do that using Word?

I have never done this in Word my self, but I have seen many documents that look like that.

Well, its all about text: "%1" and what you put there for different levels. All the formatting is up to you.
https://docx.js.org/#/usage/numbering?id=using-ordered-lists-in-docx
If you provide some example document we can extract that format from there

Okay, thanks 🙏 for your response.
This is an example of the document part is that have that arrangement
Screenshot_20231127-064922~2

I just took screenshot for the part and it was already in PDF format.

Unfortunately, I cannot help with pdf or images.
.docx is .zip with .xml files and there we can get exact format
So .docx file required

Ok, this is the docx file with the same arrangement,
example_124722.docx

This example doesn't have any numberings, the things you see are only paragraphs, spaces and tab stop combined :)

So to attain that arrangement I need to play With spaces and tab stop? Or is there any other work round?

You are correct.
I don't think there is workaround.
The only approach I could've thought didn't work:
lvl1: <w:lvlText w:val="%1."/>
lvl2: <w:lvlText w:val="%1 (%2)"/>
lvl3: <w:lvlText w:val="(%2)"/>
Leads to:
image

Not something to complain about docxjs library, but rather Word (OOXML standard) that is not flexible enough for your case.

I get the point.Thank you very much for your time

Don't forget to close an issue once your problem is resolved :)