0
최근에 docx4j를 사용하고 있으며 Word 문서 (내 서식 파일)에 책갈피를 설정하려고합니다.Docx4j 북마크에 값을 설정하십시오.
는 이미 설명서를 참조하지만 난 대답을 찾을 수없는 : S
나는 버전 2.8.1을 사용하고 있는데 내가 코드를 사용할 수 http://www.docx4java.org/forums/docx-java-f6/bookmarks-and-templates-advice-t681.html (감사, freemink)을 기준으로 책갈피를 얻고있다./
가 나는 또한 CTBookmark를 검색하지만, 여기에 값을 설정할 수있는 방법은 없다 : 내 ptext이 아니라 책갈피 내 북마크 위치에 설정되어있는이 코드
PbookmarkedParagraphInPart = findBookmarkedParagraphInPart(documentPart, "bookmarktest");
// 3. copy the found paragraph to keep styling correct
P copy = (P) XmlUtils.deepCopy(bookmarkedParagraphInPart);
String ptext = "Testing";
// replace the text elements from the copy
List<?> texts = getAllElementFromObject(copy, Text.class);
if (texts.size() > 0) {
Text textToReplace = (Text) texts.get(0);
textToReplace.setValue(ptext);
}
// add the paragraph to the document
bookmarkedParagraphInPart.getContent().add(copy);
.
아무도 도와 줄 수 있습니까?