- Code: Select all
<w:bookmarkStart w:id="0" w:name="_GoBack"/>
<w:bookmarkEnd w:id="0"/>
It appears anytime i make a change in the template, in the place of the last change.
This code:
- Code: Select all
MainDocumentPart main = docx.getMainDocumentPart();
List<Object> bmList = getAllElementFromObject(main, CTBookmark.class);
CTBookmark bm = (CTBookmark) bmList.get(0);
System.out.println(bm.getName());
gives me "_GoBack", so i'm sure that the bookmark is found correctly. But strangely if i do this:
- Code: Select all
getAllElementFromObject(main, CTBookmark.class).remove(0);
the bookmark doesn't get deleted. To check, this code:
- Code: Select all
System.out.println(getAllElementFromObject(main, CTBookmark.class).size());
getAllElementFromObject(main, CTBookmark.class).remove(0);
System.out.println(getAllElementFromObject(main, CTBookmark.class).size());
returns
- Code: Select all
1
1
Should i use some other approach to delete a bookmark in docx4j?
This question is also posted at stackoverflow: http://stackoverflow.com/questions/30937551/how-can-i-delete-a-bookmark-using-docx4j