exclude group: 'xml-apis', module: 'xml-apis'
}
}
-
broken
-
tests
+ javadocs
}
dependencies {
testImplementation 'com.google.guava:guava:30.0-jre'
broken "org.apache.xmlgraphics:batik-script:${batikVersion}"
+
+ javadocs project(':poi')
+ javadocs project(':poi-scratchpad')
}
final String MODULE_NAME = 'org.apache.poi.ooxml'
}
javadoc {
-// fails currently, need to fix the sources
- failOnError = false
-// if(JavaVersion.current().isJava9Compatible()) {
-// options.addBooleanOption('html5', true)
-// }
+ failOnError = true
+ doFirst {
+ options {
+ if (JavaVersion.current().isJava9Compatible()) {
+ addBooleanOption('html5', true)
+ }
+ links 'https://poi.apache.org/apidocs/dev/'
+ links 'https://docs.oracle.com/javase/8/docs/api/'
+ use = true
+ splitIndex = true
+ source = "1.8"
+ classpath += configurations.javadocs.files
+ }
+ }
}
artifacts {
/**
* Internal code - API may change any time!
* <p>
- * The {@link #selectProperty(Class, String)} xquery method has some performance penalties,
+ * The XSLFShape.selectProperty(Class, String) xquery method has some performance penalties,
* which can be workaround by using {@link XmlCursor}. This method also takes into account
* that {@code AlternateContent} tags can occur anywhere on the given path.
* <p>
* <li>searching for a AlternateContent.Choice child</li>
* <li>searching for a AlternateContent.Fallback child</li>
* </ul>
- * Currently POI OOXML is based on the first edition of the ECMA 376 schema, which doesn't
- * allow AlternateContent tags to show up everywhere. The factory flag is
+ * The factory flag is
* a workaround to process files based on a later edition. But it comes with the drawback:
* any change on the returned XmlObject aren't saved back to the underlying document -
* so it's a non updatable clone. If factory is null, a XmlException is
String[] segments = partUri.toASCIIString()
.replaceFirst("^"+PackagingURIHelper.FORWARD_SLASH_CHAR,"")
.split(PackagingURIHelper.FORWARD_SLASH_STRING);
-
+
if (segments.length < 1) {
throw new InvalidFormatException(
"A part name shall not have empty segments [M1.3]: " + partUri.getPath());
) {
continue;
}
-
+
if (c != '%') {
throw new InvalidFormatException(
"A segment shall not hold any characters other than pchar characters. [M1.6]");
- }
-
+ }
+
// We certainly found an encoded character, check for length
// now ( '%' HEXDIGIT HEXDIGIT)
if ((length - i) < 2 || !isHexDigit(segment.charAt(i+1)) || !isHexDigit(segment.charAt(i+2))) {
}
}
}
-
+
/**
* Throws an exception if the specified part name doesn't start with a
* forward slash character '/'. [M1.4]
/**
* Retrieves the extension of the part name if any. If there is no extension
- * returns an empty String. Example : '/document/content.xml' => 'xml'
+ * returns an empty String. Example : '/document/content.xml' => 'xml'
*
* @return The extension of the part name.
*/
// (non-null) > (null)
return 1;
}
-
+
if (str1.equalsIgnoreCase(str2)) {
return 0;
}
private static boolean isDigitOrLetter(char c) {
return (c >= '0' && c <= '9') || (c >= 'A' && c <= 'Z') || (c >= 'a' && c <= 'z');
}
-
+
private static boolean isHexDigit(char c) {
return (c >= '0' && c <= '9') || (c >= 'A' && c <= 'F') || (c >= 'a' && c <= 'f');
}
* This flag violates [M1.4]: A part name shall start with a forward slash ('/') character, but
* allows generating URIs compatible with MS Office and OpenOffice.
* @return A fully relativize part name URI ('word/media/image1.gif',
- * '/word/document.xml' => 'media/image1.gif') else
- * <code>null</code>.
+ * '/word/document.xml' => 'media/image1.gif') else
+ * {@code null}.
*/
public static URI relativizeURI(URI sourceURI, URI targetURI, boolean msCompatible) {
StringBuilder retVal = new StringBuilder();
* @param targetURI
* The target part URI.
* @return A fully relativize part name URI ('word/media/image1.gif',
- * '/word/document.xml' => 'media/image1.gif') else
- * <code>null</code>.
+ * '/word/document.xml' => 'media/image1.gif') else
+ * {@code null}.
*/
public static URI relativizeURI(URI sourceURI, URI targetURI) {
return relativizeURI(sourceURI, targetURI, false);
/**
* Build a part name where the relationship should be stored ((ex
- * /word/document.xml -> /word/_rels/document.xml.rels)
+ * /word/document.xml -> /word/_rels/document.xml.rels)
*
* @param partName
* Source part URI
* percent-encode white spaces and characters above 0x80.
* <p>
* Examples:
- * <blockquote><pre>
+ * <pre>{@code
* 'Apache POI' --> 'Apache%20POI'
* 'Apache\u0410POI' --> 'Apache%04%10POI'
- * </pre></blockquote>
+ * }</pre>
* @param s the string to encode
* @return the encoded string
*/
}
/**
- * Build association extention-> content type (will be stored in
+ * Build association extension-> content type (will be stored in
* [Content_Types].xml) for example ContentType="image/png" Extension="png"
* <p>
* [M2.8]: When adding a new part to a package, the package implementer
throw new IllegalArgumentException("contentType");
}
- return (this.defaultContentType.containsValue(contentType) ||
+ return (this.defaultContentType.containsValue(contentType) ||
(this.overrideContentType != null && this.overrideContentType.containsValue(contentType)));
}
* <p>
* Rule M4.2: A format consumer shall consider the use of the Markup
* Compatibility namespace to be an error.
- * </p><p>
+ * <p>
* Rule M4.3: Producers shall not create a document element that contains
* refinements to the Dublin Core elements, except for the two specified in
- * the schema: <dcterms:created> and <dcterms:modified> Consumers shall
+ * the schema: <dcterms:created> and <dcterms:modified> Consumers shall
* consider a document element that violates this constraint to be an error.
- * </p><p>
+ * <p>
* Rule M4.4: Producers shall not create a document element that contains
* the xml:lang attribute. Consumers shall consider a document element that
* violates this constraint to be an error.
- * </p><p>
+ * <p>
* Rule M4.5: Producers shall not create a document element that contains
- * the xsi:type attribute, except for a <dcterms:created> or
- * <dcterms:modified> element where the xsi:type attribute shall be present
+ * the xsi:type attribute, except for a <dcterms:created> or
+ * <dcterms:modified> element where the xsi:type attribute shall be present
* and shall hold the value dcterms:W3CDTF, where dcterms is the namespace
* prefix of the Dublin Core namespace. Consumers shall consider a document
* element that violates this constraint to be an error.
- * </p>
*/
public void checkElementForOPCCompliance(Element el)
throws InvalidFormatException {
* <p>Note that each SI entry can have multiple T elements, if the
* string is made up of bits with different formatting.
* <p>Example input:
- * <pre>
-<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
-<sst xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main" count="2" uniqueCount="2">
- <si>
- <r>
- <rPr>
- <b />
- <sz val="11" />
- <color theme="1" />
- <rFont val="Calibri" />
- <family val="2" />
- <scheme val="minor" />
- </rPr>
- <t>This:</t>
- </r>
- <r>
- <rPr>
- <sz val="11" />
- <color theme="1" />
- <rFont val="Calibri" />
- <family val="2" />
- <scheme val="minor" />
- </rPr>
- <t xml:space="preserve">Causes Problems</t>
- </r>
- </si>
- <si>
- <t>This does not</t>
- </si>
-</sst>
-* </pre>
+ * <pre>{@code
+ * <?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
+ * <sst xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main" count="2" uniqueCount="2">
+ * <si>
+ * <r>
+ * <rPr>
+ * <b />
+ * <sz val="11" />
+ * <color theme="1" />
+ * <rFont val="Calibri" />
+ * <family val="2" />
+ * <scheme val="minor" />
+ * </rPr>
+ * <t>This:</t>
+ * </r>
+ * <r>
+ * <rPr>
+ * <sz val="11" />
+ * <color theme="1" />
+ * <rFont val="Calibri" />
+ * <family val="2" />
+ * <scheme val="minor" />
+ * </rPr>
+ * <t xml:space="preserve">Causes Problems</t>
+ * </r>
+ * </si>
+ * <si>
+ * <t>This does not</t>
+ * </si>
+ * </sst>
+ * }</pre>
*
*/
public class ReadOnlySharedStringsTable extends DefaultHandler implements SharedStrings {
this.includePhoneticRuns = includePhoneticRuns;
readFrom(part.getInputStream());
}
-
+
/**
* Read this shared strings table from an XML file.
*
* Changes the maximum number of data formats that may be in a style table
*
* @param num the upper limit on number of data formats in the styles table when adding new data formats
- * @throws IllegalArgumentException if <code>num</code> < 0
- * @throws IllegalStateException if <code>num</code> < current number of data formats in the style table.
+ * @throws IllegalArgumentException if {@code num < 0}
+ * @throws IllegalStateException if {@code num < current number of data formats in the style table}.
* Data formats must be explicitly removed before the limit can be decreased.
*/
public void setMaxNumberOfDataFormats(int num) {
* Use this to create new cells within the row and return it.
* <p>
* The cell that is returned is a {@link CellType#BLANK}. The type can be changed
- * either through calling <code>setCellValue</code> or <code>setCellType</code>.
+ * either through calling {@code setCellValue} or {@code setCellType}.
*
* @param column - the column number this cell represents
* @return Cell a high level representation of the created cell.
- * @throws IllegalArgumentException if columnIndex < 0 or greater than the maximum number of supported columns
+ * @throws IllegalArgumentException if columnIndex < 0 or greater than the maximum number of supported columns
* (255 for *.xls, 1048576 for *.xlsx)
*/
@Override
*
* @param column - the column number this cell represents
* @return Cell a high level representation of the created cell.
- * @throws IllegalArgumentException if columnIndex < 0 or greater than a maximum number of supported columns
+ * @throws IllegalArgumentException if columnIndex < 0 or greater than a maximum number of supported columns
* (255 for *.xls, 1048576 for *.xlsx)
*/
@Override
* Set the row number of this row.
*
* @param rowNum the row number (0-based)
- * @throws IllegalArgumentException if rowNum < 0
+ * @throws IllegalArgumentException if rowNum < 0
*/
@Override
public void setRowNum(int rowNum)
* Returns the cell at the given (0 based) index, with the specified {@link org.apache.poi.ss.usermodel.Row.MissingCellPolicy}
*
* @return the cell at the given (0 based) index
- * @throws IllegalArgumentException if cellnum < 0 or the specified MissingCellPolicy is invalid
+ * @throws IllegalArgumentException if cellnum < 0 or the specified MissingCellPolicy is invalid
*/
@Override
public SXSSFCell getCell(int cellnum, MissingCellPolicy policy)
* Style based on a dxf record - e.g. table style element or conditional formatting rule
*/
public class XSSFDxfStyleProvider implements DifferentialStyleProvider {
-
+
private final IndexedColorMap colorMap;
private final BorderFormatting border;
private final FontFormatting font;
private final ExcelNumberFormat number;
private final PatternFormatting fill;
private final int stripeSize;
-
+
/**
* @param dxf
- * @param stripeSize 0 for non-stripe styles, > 1 for stripes
- * @param colorMap
+ * @param stripeSize 0 for non-stripe styles, > 1 for stripes
+ * @param colorMap
*/
public XSSFDxfStyleProvider(CTDxf dxf, int stripeSize, IndexedColorMap colorMap) {
this.stripeSize = stripeSize;
number = null;
fill = null;
} else {
- border = dxf.isSetBorder() ? new XSSFBorderFormatting(dxf.getBorder(), colorMap) : null;
- font = dxf.isSetFont() ? new XSSFFontFormatting(dxf.getFont(), colorMap) : null;
+ border = dxf.isSetBorder() ? new XSSFBorderFormatting(dxf.getBorder(), colorMap) : null;
+ font = dxf.isSetFont() ? new XSSFFontFormatting(dxf.getFont(), colorMap) : null;
if (dxf.isSetNumFmt()) {
CTNumFmt numFmt = dxf.getNumFmt();
number = new ExcelNumberFormat((int) numFmt.getNumFmtId(), numFmt.getFormatCode());
} else {
number = null;
}
- fill = dxf.isSetFill() ? new XSSFPatternFormatting(dxf.getFill(), colorMap) : null;
+ fill = dxf.isSetFill() ? new XSSFPatternFormatting(dxf.getFill(), colorMap) : null;
}
}
public PatternFormatting getPatternFormatting() {
return fill;
}
-
+
public int getStripeSize() {
return stripeSize;
}
/**
*
- * CTRPrElt --> CTFont adapter
+ * CTRPrElt --> CTFont adapter
*/
protected static CTFont toCTFont(CTRPrElt pr){
CTFont ctFont = CTFont.Factory.newInstance();
* </p>
* @param columnIndex - the column number this cell represents
* @return Cell a high level representation of the created cell.
- * @throws IllegalArgumentException if columnIndex < 0 or greater than 16384,
+ * @throws IllegalArgumentException if columnIndex < 0 or greater than 16384,
* the maximum number of columns supported by the SpreadsheetML format (.xlsx)
*/
@Override
* @param columnIndex - the column number this cell represents
* @param type - the cell's data type
* @return XSSFCell a high level representation of the created cell.
- * @throws IllegalArgumentException if the specified cell type is invalid, columnIndex < 0
+ * @throws IllegalArgumentException if the specified cell type is invalid, columnIndex < 0
* or greater than 16384, the maximum number of columns supported by the SpreadsheetML format (.xlsx)
*/
@Override
* Set the row number of this row.
*
* @param rowIndex the row number (0-based)
- * @throws IllegalArgumentException if rowNum < 0 or greater than 1048575
+ * @throws IllegalArgumentException if rowNum < 0 or greater than 1048575
*/
@Override
public void setRowNum(int rowIndex) {
*</p>
*
* This example shows the text "Center Bold Header" on the first line (center
- * section), and the date on the second line (center section). &CCenter
- * &"-,Bold"Bold &"-,Regular"Header_x000A_&D
+ * section), and the date on the second line (center section). &CCenter
+ * &"-,Bold"Bold &"-,Regular"Header_x000A_&D
*
* <b>General Rules:</b> There is no required order in which these codes must
* appear. The first occurrence of the following codes turns the formatting ON,
* the second occurrence turns it OFF again:
*
* <dl>
- * <dt>&L</dt>
+ * <dt>&L</dt>
* <dd>code for "left section" (there are three header / footer locations,
* "left", "center", and "right"). When two or more occurrences of this section
* marker exist, the contents from all markers are concatenated, in the order of
* appearance, and placed into the left section.</dd>
- * <dt>&P</dt>
+ * <dt>&P</dt>
* <dd>code for "current page #"</dd>
- * <dt>&N</dt>
+ * <dt>&N</dt>
* <dd>code for "total pages"</dd>
- * <dt>&font size</dt>
+ * <dt>&font size</dt>
* <dd>code for "text font size", where font size is a font size in points.</dd>
- * <dt>&K</dt>
+ * <dt>&K</dt>
* <dd>code for "text font color" RGB Color is specified as RRGGBB Theme Color
* is specifed as TTSNN where TT is the theme color Id, S is either "+" or "-"
* of the tint/shade value, NN is the tint/shade value.</dd>
- * <dt>&S</dt>
+ * <dt>&S</dt>
* <dd>code for "text strikethrough" on / off</dd>
- * <dt>&X</dt>
+ * <dt>&X</dt>
* <dd>code for "text super script" on / off</dd>
- * <dt>&Y</dt>
+ * <dt>&Y</dt>
* <dd>code for "text subscript" on / off</dd>
- * <dt>&C</dt>
+ * <dt>&C</dt>
* <dd>code for "center section". When two or more occurrences of this section
* marker exist, the contents from all markers are concatenated, in the order of
* appearance, and placed into the center section. SpreadsheetML Reference
* Material - Worksheets 1966</dd>
- * <dt>&D</dt>
+ * <dt>&D</dt>
* <dd>code for "date"</dd>
- * <dt>&T</dt>
+ * <dt>&T</dt>
* <dd>code for "time"</dd>
- * <dt>&G</dt>
+ * <dt>&G</dt>
* <dd>code for "picture as background"</dd>
- * <dt>&U</dt>
+ * <dt>&U</dt>
* <dd>code for "text single underline"</dd>
- * <dt>&E</dt>
+ * <dt>&E</dt>
* <dd>code for "double underline"</dd>
- * <dt>&R</dt>
+ * <dt>&R</dt>
* <dd>code for "right section". When two or more occurrences of this section
* marker exist, the contents from all markers are concatenated, in the order of
* appearance, and placed into the right section.</dd>
- * <dt>&Z</dt>
+ * <dt>&Z</dt>
* <dd>code for "this workbook's file path"</dd>
- * <dt>&F</dt>
+ * <dt>&F</dt>
* <dd>code for "this workbook's file name"</dd>
- * <dt>&A</dt>
+ * <dt>&A</dt>
* <dd>code for "sheet tab name"</dd>
- * <dt>&+</dt>
+ * <dt>&+</dt>
* <dd>code for add to page #.</dd>
- * <dt>&-</dt>
+ * <dt>&-</dt>
* <dd>code for subtract from page #.</dd>
- * <dt>&"font name,font type" - code for "text font name" and "text font type",
+ * <dt>&"font name,font type" - code for "text font name" and "text font type",
* where font name and font type are strings specifying the name and type of the
* font, separated by a comma. When a hyphen appears in font name, it means
* "none specified". Both of font name and font type can be localized
- * values.</dd>
- * <dt>&"-,Bold"</dt>
+ * values.</dt>
+ * <dt>&"-,Bold"</dt>
* <dd>code for "bold font style"</dd>
- * <dt>&B</dt>
+ * <dt>&B</dt>
* <dd>also means "bold font style"</dd>
- * <dt>&"-,Regular"</dt>
+ * <dt>&"-,Regular"</dt>
* <dd>code for "regular font style"</dd>
- * <dt>&"-,Italic"</dt>
+ * <dt>&"-,Italic"</dt>
* <dd>code for "italic font style"</dd>
- * <dt>&I</dt>
+ * <dt>&I</dt>
* <dd>also means "italic font style"</dd>
- * <dt>&"-,Bold Italic"</dt>
+ * <dt>&"-,Bold Italic"</dt>
* <dd>code for "bold italic font style"</dd>
- * <dt>&O</dt>
+ * <dt>&O</dt>
* <dd>code for "outline style"</dd>
- * <dt>&H</dt>
+ * <dt>&H</dt>
* <dd>code for "shadow style"</dd>
* </dl>
*
private CTHeaderFooter headerFooter;
private boolean stripFields;
-
+
/**
* Create an instance of XSSFAbstractHeaderFooter from the supplied XML bean
*
* {@link XWPFTableCell}, {@link XWPFSDTCell}
* <p>
* Schematically something like this:
- * <tr><tc/><tc/><sdt><tc/></sdt></tr>
+ * {@code <tr><tc/><tc/><sdt><tc/></sdt></tr>}
*/
public interface ICell {
}
/**
* Base class for both bottom-of-the-page footnotes {@link XWPFFootnote} and end
- * notes {@link XWPFEndnote}).
+ * notes {@link XWPFEndnote}).
* <p>The only significant difference between footnotes and
* end notes is which part they go on. Footnotes are managed by the Footnotes part
* {@link XWPFFootnotes} and end notes are managed by the Endnotes part {@link XWPFEndnotes}.</p>
*/
public abstract class XWPFAbstractFootnoteEndnote implements Iterable<XWPFParagraph>, IBody {
- private List<XWPFParagraph> paragraphs = new ArrayList<>();
- private List<XWPFTable> tables = new ArrayList<>();
- private List<XWPFPictureData> pictures = new ArrayList<>();
- private List<IBodyElement> bodyElements = new ArrayList<>();
+ private final List<XWPFParagraph> paragraphs = new ArrayList<>();
+ private final List<XWPFTable> tables = new ArrayList<>();
+ private final List<XWPFPictureData> pictures = new ArrayList<>();
+ private final List<IBodyElement> bodyElements = new ArrayList<>();
protected CTFtnEdn ctFtnEdn;
protected XWPFAbstractFootnotesEndnotes footnotes;
protected XWPFDocument document;
* Get the list of {@link XWPFParagraph}s in the footnote.
* @return List of paragraphs
*/
+ @Override
public List<XWPFParagraph> getParagraphs() {
return paragraphs;
}
* Get an iterator over the {@link XWPFParagraph}s in the footnote.
* @return Iterator over the paragraph list.
*/
+ @Override
public Iterator<XWPFParagraph> iterator() {
return paragraphs.iterator();
}
* Get the list of {@link XWPFTable}s in the footnote.
* @return List of tables
*/
+ @Override
public List<XWPFTable> getTables() {
return tables;
}
* Gets the body elements ({@link IBodyElement}) of the footnote.
* @return List of body elements.
*/
+ @Override
public List<IBodyElement> getBodyElements() {
return bodyElements;
}
/**
* Set the underlying CTFtnEdn for the footnote.
- * <p>Use {@link XWPFDocument#createFootnote()} to create new footnotes.</p>
+ * <p>Use {@link XWPFDocument#createFootnote()} to create new footnotes.</p>
* @param footnote The CTFtnEdn object that will underly the footnote.
*/
public void setCTFtnEdn(CTFtnEdn footnote) {
* Gets the {@link XWPFTable} at the specified position from the footnote's table array.
* @param pos in table array
* @return The {@link XWPFTable} at position pos, or null if there is no table at position pos.
- * @see org.apache.poi.xwpf.usermodel.IBody#getTableArray(int)
*/
+ @Override
public XWPFTable getTableArray(int pos) {
if (pos >= 0 && pos < tables.size()) {
return tables.get(pos);
}
/**
- * Inserts an existing {@link XWPFTable) into the arrays bodyElements and tables.
+ * Inserts an existing XWPFTable into the arrays bodyElements and tables.
*
* @param pos Position, in the bodyElements array, to insert the table
- * @param table {@link XWPFTable) to be inserted
- * @see org.apache.poi.xwpf.usermodel.IBody#insertTable(int pos, XWPFTable table)
+ * @param table XWPFTable to be inserted
*/
+ @Override
public void insertTable(int pos, XWPFTable table) {
bodyElements.add(pos, table);
int i = 0;
}
/**
- * if there is a corresponding {@link XWPFTable} of the parameter
+ * if there is a corresponding {@link XWPFTable} of the parameter
* ctTable in the tableList of this header
- * the method will return this table, or null if there is no
+ * the method will return this table, or null if there is no
* corresponding {@link XWPFTable}.
- *
- * @param ctTable
- * @see org.apache.poi.xwpf.usermodel.IBody#getTable(CTTbl ctTable)
*/
+ @Override
public XWPFTable getTable(CTTbl ctTable) {
for (XWPFTable table : tables) {
if (table == null)
* Returns the {@link XWPFParagraph} at position pos in footnote's paragraph array.
* @param pos Array position of the paragraph to get.
* @return the {@link XWPFParagraph} at position pos, or null if there is no paragraph at that position.
- *
- * @see org.apache.poi.xwpf.usermodel.IBody#getParagraphArray(int pos)
*/
+ @Override
public XWPFParagraph getParagraphArray(int pos) {
if(pos >=0 && pos < paragraphs.size()) {
return paragraphs.get(pos);
/**
* get the {@link XWPFTableCell} that belongs to the CTTc cell.
*
- * @param cell
* @return {@link XWPFTableCell} that corresponds to the CTTc cell, if there is one, otherwise null.
- * @see org.apache.poi.xwpf.usermodel.IBody#getTableCell(CTTc cell)
*/
+ @Override
public XWPFTableCell getTableCell(CTTc cell) {
XmlCursor cursor = cell.newCursor();
cursor.toParent();
/**
* Verifies that cursor is on the right position.
*
- * @param cursor
* @return true if the cursor is within a CTFtnEdn element.
*/
private boolean isCursorInFtn(XmlCursor cursor) {
/**
* Insert a table constructed from OOXML table markup.
- * @param cursor
* @return the inserted {@link XWPFTable}
- * @see org.apache.poi.xwpf.usermodel.IBody#insertNewTbl(XmlCursor cursor)
*/
+ @Override
public XWPFTable insertNewTbl(XmlCursor cursor) {
if (isCursorInFtn(cursor)) {
String uri = CTTbl.type.getName().getNamespaceURI();
/**
* Add a new {@link XWPFParagraph} at position of the cursor.
*
- * @param cursor
* @return The inserted {@link XWPFParagraph}
- * @see org.apache.poi.xwpf.usermodel.IBody#insertNewParagraph(XmlCursor cursor)
*/
+ @Override
public XWPFParagraph insertNewParagraph(final XmlCursor cursor) {
if (isCursorInFtn(cursor)) {
String uri = CTP.type.getName().getNamespaceURI();
/**
* Get the {@link XWPFDocument} the footnote is part of.
- * @see org.apache.poi.xwpf.usermodel.IBody#getXWPFDocument()
*/
+ @Override
public XWPFDocument getXWPFDocument() {
return document;
}
/**
* Get the Part to which the footnote belongs, which you need for adding relationships to other parts
* @return {@link POIXMLDocumentPart} that contains the footnote.
- *
- * @see org.apache.poi.xwpf.usermodel.IBody#getPart()
*/
+ @Override
public POIXMLDocumentPart getPart() {
return footnotes;
}
/**
* Get the part type {@link BodyType} of the footnote.
* @return The {@link BodyType} value.
- *
- * @see org.apache.poi.xwpf.usermodel.IBody#getPartType()
*/
+ @Override
public BodyType getPartType() {
return BodyType.FOOTNOTE;
}
paragraphs.add(p);
bodyElements.add(p);
- // If the paragraph is the first paragraph in the footnote,
+ // If the paragraph is the first paragraph in the footnote,
// ensure that it has a footnote reference run.
if (p.equals(getParagraphs().get(0))) {
/**
* Ensure that the specified paragraph has a reference marker for this
* footnote by adding a footnote reference if one is not found.
- * <p>This method is for the first paragraph in the footnote, not
+ * <p>This method is for the first paragraph in the footnote, not
* paragraphs that will refer to the footnote. For references to
- * the footnote, use {@link XWPFParagraph#addFootnoteReference(XWPFFootnote)}.
+ * the footnote, use {@link XWPFParagraph#addFootnoteReference(XWPFAbstractFootnoteEndnote)}.
* </p>
* <p>The first run of the first paragraph in a footnote should
* contain a {@link CTFtnEdnRef} object.</p>
/**
* Appends a new {@link XWPFTable} to this footnote
* @param rows Number of rows to initialize the table with
- * @param cols Number of columns to initialize the table with
+ * @param cols Number of columns to initialize the table with
* @return the new {@link XWPFTable} with the specified number of rows and columns
* @since 4.0.0
*/
* <p>End notes are collected at the end of a document or section rather than
* at the bottom of a page.</p>
* <p>Create a new footnote using {@link XWPFDocument#createEndnote()} or
- * {@link XWPFEndnotes#createFootnote()}.</p>
+ * {@link XWPFEndnotes#createEndnote()}.</p>
* <p>The first body element of a footnote should (or possibly must) be a paragraph
* with the first run containing a CTFtnEdnRef object. The {@link XWPFFootnote#createParagraph()}
* and {@link XWPFFootnote#createTable()} methods do this for you.</p>
* <p>Footnotes have IDs that are unique across all footnotes in the document. You use
* the footnote ID to create a reference to a footnote from within a paragraph.</p>
* <p>To create a reference to a footnote within a paragraph you create a run
- * with a CTFtnEdnRef that specifies the ID of the target paragraph.
+ * with a CTFtnEdnRef that specifies the ID of the target paragraph.
* The {@link XWPFParagraph#addFootnoteReference(XWPFAbstractFootnoteEndnote)}
* method does this for you.</p>
* @since 4.0.0
/**
* Ensure that the specified paragraph has a reference marker for this
* end note by adding a footnote reference if one is not found.
- * <p>This method is for the first paragraph in the footnote, not
+ * <p>This method is for the first paragraph in the footnote, not
* paragraphs that will refer to the footnote. For references to
- * the footnote, use {@link XWPFParagraph#addFootnoteReference(XWPFAbstractFootnoteEndnote))}.
+ * the footnote, use {@link XWPFParagraph#addFootnoteReference(XWPFAbstractFootnoteEndnote)}.
* </p>
* <p>The first run of the first paragraph in a footnote should
* contain a {@link CTFtnEdnRef} object.</p>
* @since 4.0.0
*/
public void ensureFootnoteRef(XWPFParagraph p) {
-
+
XWPFRun r = null;
if (p.getRuns().size() > 0) {
r = p.getRuns().get(0);
ctr.addNewRPr().addNewRStyle().setVal("FootnoteReference");
ctr.addNewEndnoteRef();
}
-
+
}
}
* <p>Footnotes have IDs that are unique across all footnotes in the document. You use
* the footnote ID to create a reference to a footnote from within a paragraph.</p>
* <p>To create a reference to a footnote within a paragraph you create a run
- * with a CTFtnEdnRef that specifies the ID of the target paragraph.
+ * with a CTFtnEdnRef that specifies the ID of the target paragraph.
* The {@link XWPFParagraph#addFootnoteReference(XWPFAbstractFootnoteEndnote)}
* method does this for you.</p>
*/
public class XWPFFootnote extends XWPFAbstractFootnoteEndnote {
-
+
@Internal
public XWPFFootnote(CTFtnEdn note, XWPFAbstractFootnotesEndnotes xFootnotes) {
super(note, xFootnotes);
public XWPFFootnote(XWPFDocument document, CTFtnEdn body) {
super(document, body);
}
-
+
/**
* Ensure that the specified paragraph has a reference marker for this
* footnote by adding a footnote reference if one is not found.
- * <p>This method is for the first paragraph in the footnote, not
+ * <p>This method is for the first paragraph in the footnote, not
* paragraphs that will refer to the footnote. For references to
- * the footnote, use {@link XWPFParagraph#addFootnoteReference(XWPFFootnote)}.
+ * the footnote, use {@link XWPFParagraph#addFootnoteReference(XWPFAbstractFootnoteEndnote)}.
* </p>
* <p>The first run of the first paragraph in a footnote should
* contain a {@link CTFtnEdnRef} object.</p>
* @since 4.0.0
*/
public void ensureFootnoteRef(XWPFParagraph p) {
-
+
XWPFRun r = null;
if (p.getRuns().size() > 0) {
r = p.getRuns().get(0);
ctr.addNewRPr().addNewRStyle().setVal("FootnoteReference");
ctr.addNewFootnoteRef();
}
-
+
}
}
/**
* @return The {@link XWPFDocument} instance, this run belongs to, or
- * <code>null</code> if parent structure (paragraph > document) is not properly set.
+ * {@code null} if parent structure (paragraph > document) is not properly set.
*/
public XWPFDocument getDocument() {
if (parent != null) {
* Whether the bold property shall be applied to all non-complex script
* characters in the contents of this run when displayed in a document
*
- * @return <code>true</code> if the bold property is applied
+ * @return {@code true} if the bold property is applied
*/
@Override
public boolean isBold() {
* direct formatting. When used as part of a style definition, setting this
* property shall toggle the current state of that property as specified up
* to this point in the hierarchy (i.e. applied to not applied, and vice
- * versa). Setting it to <code>false</code> (or an equivalent) shall
+ * versa). Setting it to {@code false} (or an equivalent) shall
* result in the current setting remaining unchanged. However, when used as
* direct formatting, setting this property to true or false shall set the
* absolute state of the resulting property.
* applied to non-complex script characters.
* </p>
*
- * @param value <code>true</code> if the bold property is applied to
+ * @param value {@code true} if the bold property is applied to
* this run
*/
@Override
/**
* Return the string content of this text run
*
- * @return the text of this text run or <code>null</code> if not set
+ * @return the text of this text run or {@code null} if not set
*/
public String getText(int pos) {
return run.sizeOfTArray() == 0 ? null : run.getTArray(pos)
* Whether the italic property should be applied to all non-complex script
* characters in the contents of this run when displayed in a document.
*
- * @return <code>true</code> if the italic property is applied
+ * @return {@code true} if the italic property is applied
*/
@Override
public boolean isItalic() {
* Whether the bold property shall be applied to all non-complex script
* characters in the contents of this run when displayed in a document
* <p>
- * <p>
* This formatting property is a toggle property, which specifies that its
* behavior differs between its use within a style definition and its use as
* direct formatting. When used as part of a style definition, setting this
* property shall toggle the current state of that property as specified up
* to this point in the hierarchy (i.e. applied to not applied, and vice
- * versa). Setting it to <code>false</code> (or an equivalent) shall
+ * versa). Setting it to {@code false} (or an equivalent) shall
* result in the current setting remaining unchanged. However, when used as
* direct formatting, setting this property to true or false shall set the
* absolute state of the resulting property.
- * </p>
* <p>
* If this element is not present, the default value is to leave the
* formatting applied at previous level in the style hierarchy. If this
* element is never applied in the style hierarchy, then bold shall not be
* applied to non-complex script characters.
- * </p>
*
- * @param value <code>true</code> if the italic property is applied to
+ * @param value {@code true} if the italic property is applied to
* this run
*/
@Override
* Get the underline setting for the run.
*
* @return the Underline pattern applied to this run
- * @see (@link UnderlinePatterns}
+ * @see UnderlinePatterns
*/
public UnderlinePatterns getUnderline() {
UnderlinePatterns value = UnderlinePatterns.NONE;
*
* @param value -
* underline type
- * @see {@link UnderlinePatterns} : all possible patterns that could be applied
+ * @see UnderlinePatterns
*/
public void setUnderline(UnderlinePatterns value) {
CTUnderline underline = getCTUnderline(true);
+ assert(underline != null);
underline.setVal(STUnderline.Enum.forInt(value.getValue()));
}
*/
public void setUnderlineColor(String color) {
CTUnderline underline = getCTUnderline(true);
- SimpleValue svColor = null;
+ assert(underline != null);
+ SimpleValue svColor;
if (color.equals("auto")) {
STHexColorAuto hexColor = STHexColorAuto.Factory.newInstance();
hexColor.setEnumValue(STHexColorAuto.Enum.forString(color));
*/
public void setUnderlineThemeColor(String themeColor) {
CTUnderline underline = getCTUnderline(true);
+ assert(underline != null);
STThemeColor.Enum val = STThemeColor.Enum.forString(themeColor);
if (val != null) {
underline.setThemeColor(val);
*/
public String getUnderlineColor() {
CTUnderline underline = getCTUnderline(true);
+ assert(underline != null);
String colorName = "auto";
Object rawValue = underline.getColor();
if (rawValue != null) {
* Specifies that the contents of this run shall be displayed with a single
* horizontal line through the center of the line.
*
- * @return <code>true</code> if the strike property is applied
+ * @return {@code true} if the strike property is applied
*/
@Override
public boolean isStrikeThrough() {
* not be applied to the contents of this run.
* </p>
*
- * @param value <code>true</code> if the strike property is applied to
+ * @param value {@code true} if the strike property is applied to
* this run
*/
@Override
* Specifies that the contents of this run shall be displayed with a double
* horizontal line through the center of the line.
*
- * @return <code>true</code> if the double strike property is applied
+ * @return {@code true} if the double strike property is applied
*/
@Override
public boolean isDoubleStrikeThrough() {
return false;
}
STHighlightColor.Enum val = pr.getHighlightArray(0).getVal();
- if (val == null || val == STHighlightColor.NONE) {
- return false;
- }
- return true;
+ return val != null && val != STHighlightColor.NONE;
}
// TODO Provide a wrapper round STHighlightColor, then expose getter/setter
// for the highlight colour. Ideally also then add to CharacterRun interface
* this method add chart template into document
*
* @param chartRelId relation id of chart in document relation file
- * @throws InvalidFormatException
- * @throws IOException
* @since POI 4.0.0
*/
@Internal
- public CTInline addChart(String chartRelId)
- throws InvalidFormatException, IOException {
+ public CTInline addChart(String chartRelId) throws InvalidFormatException, IOException {
try {
CTInline inline = run.addNewDrawing().addNewInline();
/**
* @see <a href="http://msdn.microsoft.com/en-us/library/ff533743(v=office.12).aspx">[MS-OI29500] Run Fonts</a>
*/
- public static enum FontCharRange {
+ public enum FontCharRange {
ascii /* char 0-127 */,
cs /* complex symbol */,
eastAsia /* east asia */,
/**
* Set the highlight color for the run. Silently does nothing of colorName is not a recognized value.
*
- * @param colorName The name of the color as defined in the ST_HighlightColor simple type ({@link STHightlightColor})
+ * @param colorName The name of the color as defined in the ST_HighlightColor simple type ({@link STHighlightColor})
* @since 4.0.0
*/
public void setTextHighlightColor(String colorName) {
/**
* Emphasis mark.
*
- * @return One of
- * <li>{@link #KCD_NON}
- * <li>{@link #KCD_DOT}
- * <li>{@link #KCD_COMMA}
- * <li>{@link #KCD_CIRCLE}
- * <li>{@link #KCD_UNDER_DOT}
+ * @return One of {@link #KCD_NON},{@link #KCD_DOT},{@link #KCD_COMMA},{@link #KCD_CIRCLE},{@link #KCD_UNDER_DOT}
*/
@Internal
public byte getKcd()
/**
* Emphasis mark.
*
- * @param field_13_kcd
- * One of
- * <li>{@link #KCD_NON}
- * <li>{@link #KCD_DOT}
- * <li>{@link #KCD_COMMA}
- * <li>{@link #KCD_CIRCLE}
- * <li>{@link #KCD_UNDER_DOT}
+ * @param field_13_kcd One of {@link #KCD_NON}, {@link #KCD_DOT}, {@link #KCD_COMMA}, {@link #KCD_CIRCLE}, {@link #KCD_UNDER_DOT}
*/
@Internal
public void setKcd( byte field_13_kcd )
/**
* Superscript/subscript indices.
*
- * @return One of
- * <li>{@link #ISS_NONE}
- * <li>{@link #ISS_SUPERSCRIPTED}
- * <li>{@link #ISS_SUBSCRIPTED}
+ * @return One of {@link #ISS_NONE},{@link #ISS_SUPERSCRIPTED},{@link #ISS_SUBSCRIPTED}
*/
@Internal
public byte getIss()
/**
* Superscript/subscript indices.
*
- * @param field_15_iss
- * One of
- * <li>{@link #ISS_NONE}
- * <li>{@link #ISS_SUPERSCRIPTED}
- * <li>{@link #ISS_SUBSCRIPTED}
+ * @param field_15_iss One of {@link #ISS_NONE},{@link #ISS_SUPERSCRIPTED},{@link #ISS_SUBSCRIPTED}
*/
@Internal
public void setIss( byte field_15_iss )
/**
* Underline code.
*
- * @return One of
- * <li>{@link #KUL_NONE}
- * <li>{@link #KUL_SINGLE}
- * <li>{@link #KUL_BY_WORD}
- * <li>{@link #KUL_DOUBLE}
- * <li>{@link #KUL_DOTTED}
- * <li>{@link #KUL_HIDDEN}
- * <li>{@link #KUL_THICK}
- * <li>{@link #KUL_DASH}
- * <li>{@link #KUL_DOT}
- * <li>{@link #KUL_DOT_DASH}
- * <li>{@link #KUL_DOT_DOT_DASH}
- * <li>{@link #KUL_WAVE}
- * <li>{@link #KUL_DOTTED_HEAVY}
- * <li>{@link #KUL_DASHED_HEAVY}
- * <li>{@link #KUL_DOT_DASH_HEAVY}
- * <li>{@link #KUL_DOT_DOT_DASH_HEAVY}
- * <li>{@link #KUL_WAVE_HEAVY}
- * <li>{@link #KUL_DASH_LONG}
- * <li>{@link #KUL_WAVE_DOUBLE}
- * <li>{@link #KUL_DASH_LONG_HEAVY}
+ * @return One of {@link #KUL_NONE},{@link #KUL_SINGLE},{@link #KUL_BY_WORD},{@link #KUL_DOUBLE},
+ * {@link #KUL_DOTTED},{@link #KUL_HIDDEN},{@link #KUL_THICK},{@link #KUL_DASH},{@link #KUL_DOT},
+ * {@link #KUL_DOT_DASH},{@link #KUL_DOT_DOT_DASH},{@link #KUL_WAVE},{@link #KUL_DOTTED_HEAVY},
+ * {@link #KUL_DASHED_HEAVY},{@link #KUL_DOT_DASH_HEAVY},{@link #KUL_DOT_DOT_DASH_HEAVY},
+ * {@link #KUL_WAVE_HEAVY},{@link #KUL_DASH_LONG},{@link #KUL_WAVE_DOUBLE},{@link #KUL_DASH_LONG_HEAVY}
*/
@Internal
public byte getKul()
/**
* Underline code.
*
- * @param field_19_kul
- * One of
- * <li>{@link #KUL_NONE}
- * <li>{@link #KUL_SINGLE}
- * <li>{@link #KUL_BY_WORD}
- * <li>{@link #KUL_DOUBLE}
- * <li>{@link #KUL_DOTTED}
- * <li>{@link #KUL_HIDDEN}
- * <li>{@link #KUL_THICK}
- * <li>{@link #KUL_DASH}
- * <li>{@link #KUL_DOT}
- * <li>{@link #KUL_DOT_DASH}
- * <li>{@link #KUL_DOT_DOT_DASH}
- * <li>{@link #KUL_WAVE}
- * <li>{@link #KUL_DOTTED_HEAVY}
- * <li>{@link #KUL_DASHED_HEAVY}
- * <li>{@link #KUL_DOT_DASH_HEAVY}
- * <li>{@link #KUL_DOT_DOT_DASH_HEAVY}
- * <li>{@link #KUL_WAVE_HEAVY}
- * <li>{@link #KUL_DASH_LONG}
- * <li>{@link #KUL_WAVE_DOUBLE}
- * <li>{@link #KUL_DASH_LONG_HEAVY}
+ * @param field_19_kul One of,{@link #KUL_NONE},{@link #KUL_SINGLE},{@link #KUL_BY_WORD},{@link #KUL_DOUBLE},
+ * {@link #KUL_DOTTED},{@link #KUL_HIDDEN},{@link #KUL_THICK},{@link #KUL_DASH},{@link #KUL_DOT},
+ * {@link #KUL_DOT_DASH},{@link #KUL_DOT_DOT_DASH},{@link #KUL_WAVE},{@link #KUL_DOTTED_HEAVY},
+ * {@link #KUL_DASHED_HEAVY},{@link #KUL_DOT_DASH_HEAVY},{@link #KUL_DOT_DOT_DASH_HEAVY},
+ * {@link #KUL_WAVE_HEAVY},{@link #KUL_DASH_LONG},{@link #KUL_WAVE_DOUBLE},{@link #KUL_DASH_LONG_HEAVY}
*/
@Internal
public void setKul( byte field_19_kul )
/**
* Text animation.
*
- * @return One of
- * <li>{@link #SFXTTEXT_NO}
- * <li>{@link #SFXTTEXT_LAS_VEGAS_LIGHTS}
- * <li>{@link #SFXTTEXT_BACKGROUND_BLINK}
- * <li>{@link #SFXTTEXT_SPARKLE_TEXT}
- * <li>{@link #SFXTTEXT_MARCHING_ANTS}
- * <li>{@link #SFXTTEXT_MARCHING_RED_ANTS}
- * <li>{@link #SFXTTEXT_SHIMMER}
+ * @return One of {@link #SFXTTEXT_NO},{@link #SFXTTEXT_LAS_VEGAS_LIGHTS},{@link #SFXTTEXT_BACKGROUND_BLINK},
+ * {@link #SFXTTEXT_SPARKLE_TEXT},{@link #SFXTTEXT_MARCHING_ANTS},{@link #SFXTTEXT_MARCHING_RED_ANTS},
+ * {@link #SFXTTEXT_SHIMMER}
*/
@Internal
public byte getSfxtText()
/**
* Text animation.
*
- * @param field_26_sfxtText
- * One of
- * <li>{@link #SFXTTEXT_NO}
- * <li>{@link #SFXTTEXT_LAS_VEGAS_LIGHTS}
- * <li>{@link #SFXTTEXT_BACKGROUND_BLINK}
- * <li>{@link #SFXTTEXT_SPARKLE_TEXT}
- * <li>{@link #SFXTTEXT_MARCHING_ANTS}
- * <li>{@link #SFXTTEXT_MARCHING_RED_ANTS}
- * <li>{@link #SFXTTEXT_SHIMMER}
+ * @param field_26_sfxtText One of {@link #SFXTTEXT_NO},{@link #SFXTTEXT_LAS_VEGAS_LIGHTS},{@link #SFXTTEXT_BACKGROUND_BLINK},{@link #SFXTTEXT_SPARKLE_TEXT},{@link #SFXTTEXT_MARCHING_ANTS},{@link #SFXTTEXT_MARCHING_RED_ANTS},{@link #SFXTTEXT_SHIMMER}
*/
@Internal
public void setSfxtText( byte field_26_sfxtText )
/**
* Line BReak code for xchCRJ.
*
- * @return One of
- * <li>{@link #LBRCRJ_NONE}
- * <li>{@link #LBRCRJ_LEFT}
- * <li>{@link #LBRCRJ_RIGHT}
- * <li>{@link #LBRCRJ_BOTH}
+ * @return One of {@link #LBRCRJ_NONE},{@link #LBRCRJ_LEFT},{@link #LBRCRJ_RIGHT},{@link #LBRCRJ_BOTH}
*/
@Internal
public byte getLbrCRJ()
/**
* Line BReak code for xchCRJ.
*
- * @param field_64_lbrCRJ
- * One of
- * <li>{@link #LBRCRJ_NONE}
- * <li>{@link #LBRCRJ_LEFT}
- * <li>{@link #LBRCRJ_RIGHT}
- * <li>{@link #LBRCRJ_BOTH}
+ * @param field_64_lbrCRJ One of {@link #LBRCRJ_NONE},{@link #LBRCRJ_LEFT},{@link #LBRCRJ_RIGHT},{@link #LBRCRJ_BOTH}
*/
@Internal
public void setLbrCRJ( byte field_64_lbrCRJ )