I am trying to extract entire word document in Java project, go paragraph by paragraph and print the XWPFParagraphs back to another word file. I am able to accomplish my task except the bulleted list from input document is being printed as numbered list in the output document.
This is the code where I am copying the paragraph:
static void copyParagraph(XWPFParagraph source, XWPFParagraph target, XWPFNumbering numbering)
{
target.getCTP().setPPr(source.getCTP().getPPr());
source.getRuns().forEach(run -> {
XWPFRun newR = target.createRun();
newR.setText(run.getText(0));
newR.getCTR().setRPr(run.getCTR().getRPr());
if (!run.getEmbeddedPictures().isEmpty()) {
XWPFPicture picture = run.getEmbeddedPictures().get(0);
try {
FileOutputStream out = new FileOutputStream(Constants.H1_SECTIONS_IMAGE_DIR + picture.getPictureData().getFileName());
out.write(picture.getPictureData().getData());
out.close();
newR.addPicture(new FileInputStream(Constants.H1_SECTIONS_IMAGE_DIR + picture.getPictureData().getFileName()), picture.getPictureData().getPictureType(), picture.getPictureData().getFileName(), Units.toEMU((int) picture.getWidth()), Units.toEMU((int) picture.getDepth()));
} catch (IOException | InvalidFormatException e) {
throw new RuntimeException(e);
}
}
});
}
I am not able to find solution which can keep the same list-type (bullet, numbered, etc) in the output document

