简体   繁体   中英

How to remove bullets in docx with Apache Poi?

I'm trying to remove bullets in my document, only bullets not paragraphs.

My code is:

public void resultDocument(XWPFDocument document){

 Headings sectionTools = new Headings();

  List<ParagraphBySection> sectionListResult =
    documentToMapComponent.fillParagraphBySection(sectionTools, document);

   for(ParagraphBySection p : sectionListResult){

      for(XWPFParagraph para: p.getParagraphs()){

        if(para.getNumFmt() == "bullet"){

            System.out.println(para.getText());

        }
      }

    }
}

In 'if(para.getNumFmt() =="bullet")' correctly recognizes the text that is bullet, but I have to remove those bullets.

removeAbstractNum

public boolean removeAbstractNum(java.math.BigInteger abstractNumID)

remove an existing abstractNum

Returns:

true if abstractNum with abstractNumID exists in NumberingArray, false if abstractNum with abstractNumID not exists

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM