/** * Get the width type for the table, as an {@link STTblWidth.Enum} value. * A table width can be specified as an absolute measurement (an integer * number of twips), a percentage, or the value "AUTO". * * @return The width type. * @since 4.0.0 */ public TableWidthType getWidthType() { return XWPFTable.getWidthType(getTcWidth()); }
/** * Get the width type for the table, as an {@link STTblWidth.Enum} value. * A table width can be specified as an absolute measurement (an integer * number of twips), a percentage, or the value "AUTO". * * @return The width type. * @since 4.0.0 */ public TableWidthType getWidthType() { return getWidthType(getTblPr().getTblW()); }
/** * Set the width type if different from current width type * @param widthType The new width type * @param ctWidth CTTblWidth to set the type on * @since 4.0.0 */ protected static void setWidthType(TableWidthType widthType, CTTblWidth ctWidth) { TableWidthType currentType = getWidthType(ctWidth); if (!currentType.equals(widthType)) { STTblWidth.Enum stWidthType = widthType.getSTWidthType(); ctWidth.setType(stWidthType); switch (stWidthType.intValue()) { case STTblWidth.INT_PCT: setWidthPercentage(ctWidth, DEFAULT_PERCENTAGE_WIDTH); break; default: ctWidth.setW(BigInteger.ZERO); } } } }
/** * Get the width type for the table, as an {@link STTblWidth.Enum} value. * A table width can be specified as an absolute measurement (an integer * number of twips), a percentage, or the value "AUTO". * * @return The width type. * @since 4.0.0 */ public TableWidthType getWidthType() { return XWPFTable.getWidthType(getTcWidth()); }
/** * Get the width type for the table, as an {@link STTblWidth.Enum} value. * A table width can be specified as an absolute measurement (an integer * number of twips), a percentage, or the value "AUTO". * * @return The width type. * @since 4.0.0 */ public TableWidthType getWidthType() { return getWidthType(getTblPr().getTblW()); }
/** * Set the width type if different from current width type * @param widthType The new width type * @param ctWidth CTTblWidth to set the type on * @since 4.0.0 */ protected static void setWidthType(TableWidthType widthType, CTTblWidth ctWidth) { TableWidthType currentType = getWidthType(ctWidth); if (!currentType.equals(widthType)) { STTblWidth.Enum stWidthType = widthType.getSTWidthType(); ctWidth.setType(stWidthType); switch (stWidthType.intValue()) { case STTblWidth.INT_PCT: setWidthPercentage(ctWidth, DEFAULT_PERCENTAGE_WIDTH); break; default: ctWidth.setW(BigInteger.ZERO); } } } }