/** * Turn separate even-and-odd headings on or off * * @param enable <code>true</code> to turn on separate even and odd headings, * <code>false</code> to turn off even and odd headings. */ public void setEvenAndOddHeadings(boolean enable) { CTOnOff onOff = CTOnOff.Factory.newInstance(); onOff.setVal(enable ? STOnOff.TRUE : STOnOff.FALSE); ctSettings.setEvenAndOddHeaders(onOff); }
/** * Returns Ilvl of the numeric style for this paragraph. * Returns null if this paragraph does not have numeric style. * * @return Ilvl as BigInteger */ public BigInteger getNumIlvl() { if (paragraph.getPPr() != null) { if (paragraph.getPPr().getNumPr() != null) { if (paragraph.getPPr().getNumPr().getIlvl() != null) { return paragraph.getPPr().getNumPr().getIlvl().getVal(); } } } return null; }
/** * Set the style ID for the run. * * @param styleId ID (not name) of the style to set for the run, e.g. "BoldItalic" (not "Bold Italic"). */ public void setStyle(String styleId) { CTRPr pr = getCTR().getRPr(); if (null == pr) { pr = getCTR().addNewRPr(); } CTString style = pr.getRStyle() != null ? pr.getRStyle() : pr.addNewRStyle(); style.setVal(styleId); }
/** * Get cell color. Note that this method only returns the "fill" value. * * @return RGB string of cell color */ public String getColor() { String color = null; CTTcPr tcpr = ctTc.getTcPr(); if (tcpr != null) { CTShd ctshd = tcpr.getShd(); if (ctshd != null) { color = ctshd.xgetFill().getStringValue(); } } return color; }
/** * Get text color. The returned value is a string in the hex form "RRGGBB". */ public String getColor() { String color = null; if (run.isSetRPr()) { CTRPr pr = getRunProperties(false); if (pr != null && pr.isSetColor()) { CTColor clr = pr.getColor(); color = clr.xgetVal().getStringValue(); } } return color; }
/** * Get the cell properties for the cell. * @return The cell properties * @since 4.0.0 */ protected CTTcPr getTcPr() { return ctTc.isSetTcPr() ? ctTc.getTcPr() : ctTc.addNewTcPr(); }
private void setHeaderReference(Enum type, XWPFHeaderFooter wrapper) { CTHdrFtrRef ref = doc.getDocument().getBody().getSectPr().addNewHeaderReference(); ref.setType(type); ref.setId(doc.getRelationId(wrapper)); }
private void setFooterReference(Enum type, XWPFHeaderFooter wrapper) { CTHdrFtrRef ref = doc.getDocument().getBody().getSectPr().addNewFooterReference(); ref.setType(type); ref.setId(doc.getRelationId(wrapper)); }
/** * Return the string content of this text run * * @return the text of this text run or <code>null</code> if not set */ public String getText(int pos) { return run.sizeOfTArray() == 0 ? null : run.getTArray(pos) .getStringValue(); }
/** * Returns CTTblPr object for table. If force parameter is true, will * create the element if necessary. If force parameter is false, returns * null when CTTblPr element is missing. * * @param force - force creation of CTTblPr element if necessary */ private CTTblPr getTblPr(boolean force) { return (ctTbl.getTblPr() != null) ? ctTbl.getTblPr() : (force ? ctTbl.addNewTblPr() : null); }
public String getBasisStyleID() { if (ctStyle.getBasedOn() != null) return ctStyle.getBasedOn().getVal(); else return null; }
boolean isUpdateFields() { return ctSettings.isSetUpdateFields() && ctSettings.getUpdateFields().getVal() == STOnOff.TRUE; }
/** * Turn mirrored margins on or off * * @param enable <code>true</code> to turn on mirrored margins, * <code>false</code> to turn off mirrored marginss. */ public void setMirrorMargins(boolean enable) { CTOnOff onOff = CTOnOff.Factory.newInstance(); onOff.setVal(enable ? STOnOff.TRUE : STOnOff.FALSE); ctSettings.setMirrorMargins(onOff); }
private CTDocProtect safeGetDocumentProtection() { CTDocProtect documentProtection = ctSettings.getDocumentProtection(); if (documentProtection == null) { documentProtection = CTDocProtect.Factory.newInstance(); ctSettings.setDocumentProtection(documentProtection); } return ctSettings.getDocumentProtection(); }
/** * Returns the ID of the hyperlink, if one is set. */ public String getHyperlinkId() { return hyperlink.getId(); }
/** * @return number of rows in table */ public int getNumberOfRows() { return ctTbl.sizeOfTrArray(); }
/** * Check if mirrored margins is turned on * * @return True if mirrored margins is turned on. */ public boolean getMirrorMargins() { return ctSettings.isSetMirrorMargins(); }