Spire.Doc is a professional Word .NET library specifically designed for developers to create, read, write, convert and print Word document files. Get free and professional technical support for Spire.Doc for .NET, Java, Android, C++, Python.

Sat Feb 06, 2021 2:52 pm

Hi Team,

We need to get the Left Indentation value of Bullet lists (or Numbering Lists) which are in different levels as shown:

• Bullet-1
• Bullet-2
1. Numbering-1
2. Numbering-2
1. Level-1a
1.1. Level-2a
1.1.1. Level-3a
1.1.2. Level-3b
1.2. Level-2b
2. Level-1b

We tried below options to read the Left Indent values, but it gives 36.0 always as result.
System.out.println(p.getStyle().getParagraphFormat().getLeftIndent()); // 36.0
System.out.println(p.getFormat().getLeftIndent()); // 36.0

Note: Please find the attached docx to see the actual indentation appearance.

Please help.

pr20080798
 
Posts: 148
Joined: Wed Jan 20, 2021 1:15 pm

Sun Feb 07, 2021 6:17 am

Hello,

Thanks for your inquiry and sorry for the late reply as weekend.

Please refer to the following code to read the left indent values of lists.
Code: Select all
        Document document = new Document();
        document.loadFromFile("E:\\testdoc\\Bullets\\Bullets.docx");
        for(int i = 0; i < document.getSections().getCount(); i++)
        {
           Section sec = document.getSections().get(i);
            for(int j = 0; j < sec.getBody().getChildObjects().getCount(); j++)
            {
               DocumentObject obj = sec.getBody().getChildObjects().get(j);
                if(obj.getDocumentObjectType() == DocumentObjectType.Paragraph)
                {
                    Paragraph para = (Paragraph)obj;
                    if (para.getListFormat().getCurrentListLevel() != null)
                    {
                       System.out.println(para.getListFormat().getCurrentListLevel().getParagraphFormat().getLeftIndent());
                    }
                }
            }
        }

If you encounter any issues related to our product in the future, just feel free to contact us.

Sincerely,
Marcia
E-iceblue support team
User avatar

Marcia.Zhou
 
Posts: 858
Joined: Wed Nov 04, 2020 2:29 am

Thu Feb 25, 2021 8:19 am

Hello,

Hope you are doing well!

Has the issue been solved now? Could you please give us some feedback at your convenience?

Thanks in advance.

Sincerely,
Marcia
E-iceblue support team
User avatar

Marcia.Zhou
 
Posts: 858
Joined: Wed Nov 04, 2020 2:29 am

Thu Feb 25, 2021 11:09 am

Hi,

Yes, the code works well as part of POC. Thanks a lot for the same.

We will get back if we encounter any issue while reading the indentations.

Thank you.

pr20080798
 
Posts: 148
Joined: Wed Jan 20, 2021 1:15 pm

Fri Feb 26, 2021 1:09 am

Hello,

Glad to hear that your issue has been solved.

If you encounter any issues related to our product in the future, just feel free to contact us.

Have a nice day!

Sincerely,
Marcia
E-iceblue support team
User avatar

Marcia.Zhou
 
Posts: 858
Joined: Wed Nov 04, 2020 2:29 am

Return to Spire.Doc

cron