org.docx4j.model.bookmarks.BookmarksIntegrity Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of docx4j-core Show documentation
Show all versions of docx4j-core Show documentation
docx4j is a library which helps you to work with the Office Open
XML file format as used in docx
documents, pptx presentations, and xlsx spreadsheets.
package org.docx4j.model.bookmarks;
import java.io.IOException;
import java.io.Writer;
import java.math.BigInteger;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import org.docx4j.TraversalUtil;
import org.docx4j.XmlUtils;
import org.docx4j.finders.RangeFinder;
import org.docx4j.openpackaging.parts.WordprocessingML.MainDocumentPart;
import org.docx4j.wml.CTBookmark;
import org.docx4j.wml.CTMarkupRange;
import org.docx4j.wml.ContentAccessor;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* Perform certain bookmark integrity checks (ie check for duplicates, missing starts, ends),
* and optionally, write fixes in-place
* @since 6.1
*/
public class BookmarksIntegrity {
protected static Logger log = LoggerFactory.getLogger(BookmarksIntegrity.class);
public BookmarksIntegrity() {}
private Writer writer;
/**
* To record (human readable) results
* @param writer
*/
public void setWriter(Writer writer) {
this.writer = writer;
}
/**
* @param documentPart
* @param remediate
* @return
* @throws Exception
*/
public BookmarksStatus check(MainDocumentPart documentPart, boolean remediate) throws Exception {
return check(documentPart.getContent(), remediate);
}
/**
* @param paragraphs
* @param remediate
* @return
* @throws IOException
* @throws Exception
*/
public BookmarksStatus check(List
© 2015 - 2025 Weber Informatics LLC | Privacy Policy