Example usage for org.apache.poi.xwpf.usermodel XWPFFootnotes getFootnoteById

List of usage examples for org.apache.poi.xwpf.usermodel XWPFFootnotes getFootnoteById

Introduction

In this page you can find the example usage for org.apache.poi.xwpf.usermodel XWPFFootnotes getFootnoteById.

Prototype

public XWPFAbstractFootnoteEndnote getFootnoteById(int id) 

Source Link

Usage

From source file:de.knowwe.include.export.FootnoteExporter.java

License:Open Source License

private BigInteger getFootnoteIDInternal(DocumentBuilder builder, Article article, String footnoteNumber) {
    Pair<Article, String> key = new Pair<>(article, footnoteNumber.trim());
    BigInteger id = footnoteIDs.get(key);
    if (id == null) {
        XWPFFootnotes footnotes = builder.getDocument().createFootnotes();
        // check until the footnote does not exists yet
        lastFootnoteID++;//from   w  w  w .ja  v  a  2  s. c o m
        while (footnotes.getFootnoteById(lastFootnoteID) != null) {
            lastFootnoteID++;
        }
        id = BigInteger.valueOf(lastFootnoteID);
        footnoteIDs.put(key, id);
    }
    return id;
}