this is the correct form with eyeball. however, when i display the field. it shows like :
so when i thought i was dealing with the paragraph ‘参考文献’ , i actually was dealing with the whole field code.
but when i add a newline between them. like this :
@Madecho Unfortunately, your requirements are not quite clear. The screenshots are not very informative. Could you please attach your input and expected output document in DOCX format, so they can be compared.
Document doc = new Document("C:\\Temp\\in.docx");
// Move the field and content after it to the next paragraph.
Paragraph current = doc.getFirstSection().getBody().getFirstParagraph();
Field f = current.getRange().getFields().get(0);
Paragraph nexPara = (Paragraph)current.getNextSibling();
while (current.getLastChild() != f.getStart())
nexPara.prependChild(current.getLastChild());
nexPara.prependChild(f.getStart());
doc.save("C:\\Temp\\out.docx");