Could you help me to do that? I want change bookmark’s style / font size / spaceAfter
Case ↓
private void drawOverview(Document doc, DocumentBuilder builder, String bookMarkName, MapList dataMapList)
throws Exception {
String overview = "";
for (int ii = 0; ii < dataMapList.size(); ii++) {
overview += dataMapList.get(ii) + "\n";
}
Bookmark bookmark = doc.getRange().getBookmarks().get(bookMarkName);
BookmarkInfoPrinter bookmarkVisitor = new BookmarkInfoPrinter();
Run run = new Run(doc);
if (bookmark != null) {
bookmark.setText(overview);
bookmark.getBookmarkStart().accept(bookmarkVisitor);
run.getFont().setSize(10.0);
run.getFont().setName("Arial");
bookmark.getBookmarkEnd().accept(bookmarkVisitor);
run.accept(bookmarkVisitor);
}
}
public static class BookmarkInfoPrinter extends DocumentVisitor {
public int visitBookmarkStart(BookmarkStart bookmarkStart) throws Exception {
logger.debug("****" + bookmarkStart.getName() + " ,"+ bookmarkStart.getBookmark().getText());
return VisitorAction.CONTINUE;
}
public int visitBookmarkEnd(BookmarkEnd bookmarkEnd) {
logger.debug("****"+ bookmarkEnd.getName());
return VisitorAction.CONTINUE;
}
}