@Override public boolean isHighlighted() { CTRPr pr = getRunProperties(false); if (pr == null || !pr.isSetHighlight()) { return false; } STHighlightColor.Enum val = pr.getHighlight().getVal(); if (val == null || val == STHighlightColor.NONE) { return false; } return true; } // TODO Provide a wrapper round STHighlightColor, then expose getter/setter
/** * Gets the highlight color for the run * * @return {@link STHighlightColor} for the run. * @since 4.0.0 */ public STHighlightColor.Enum getTextHightlightColor() { CTRPr pr = getRunProperties(true); CTHighlight highlight = pr.isSetHighlight() ? pr.getHighlight() : pr.addNewHighlight(); STHighlightColor color = highlight.xgetVal(); if (color == null) { color = STHighlightColor.Factory.newInstance(); color.set(STHighlightColor.NONE); } return (STHighlightColor.Enum)(color.enumValue()); }
/** * 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}) * @since 4.0.0 */ public void setTextHighlightColor(String colorName) { CTRPr pr = getRunProperties(true); CTHighlight highlight = pr.isSetHighlight() ? pr.getHighlight() : pr.addNewHighlight(); STHighlightColor color = highlight.xgetVal(); if (color == null) { color = STHighlightColor.Factory.newInstance(); } STHighlightColor.Enum val = STHighlightColor.Enum.forString(colorName); if (val != null) { color.setStringValue(val.toString()); highlight.xsetVal(color); } }
@Override public Color getValue( CTRPr rPr, XWPFStylesDocument stylesDocument ) { if ( rPr == null ) { return null; } CTHighlight highlight = rPr.getHighlight(); return getHighlight( highlight ); }
@Override public Color getValue( CTRPr rPr, XWPFStylesDocument stylesDocument ) { if ( rPr == null ) { return null; } CTHighlight highlight = rPr.getHighlight(); return getHighlight( highlight ); }
CTHighlight highlight = rPr.getHighlight(); if ( highlight == null )
CTHighlight highlight = rPr.getHighlight(); if ( highlight == null )
@Override public boolean isHighlighted() { CTRPr pr = getRunProperties(false); if (pr == null || !pr.isSetHighlight()) { return false; } STHighlightColor.Enum val = pr.getHighlight().getVal(); if (val == null || val == STHighlightColor.NONE) { return false; } return true; } // TODO Provide a wrapper round STHighlightColor, then expose getter/setter
/** * Gets the highlight color for the run * * @return {@link STHighlightColor} for the run. * @since 4.0.0 */ public STHighlightColor.Enum getTextHightlightColor() { CTRPr pr = getRunProperties(true); CTHighlight highlight = pr.isSetHighlight() ? pr.getHighlight() : pr.addNewHighlight(); STHighlightColor color = highlight.xgetVal(); if (color == null) { color = STHighlightColor.Factory.newInstance(); color.set(STHighlightColor.NONE); } return (STHighlightColor.Enum)(color.enumValue()); }
boolean hasTexStyles = rPr != null && (rPr.getHighlight() != null || rPr.getStrike() != null || rPr.getDstrike() != null || rPr.getVertAlign() != null ) ; StringBuilder text = new StringBuilder();
boolean hasTexStyles = rPr != null && (rPr.getHighlight() != null || rPr.getStrike() != null || rPr.getDstrike() != null || rPr.getVertAlign() != null ) ; StringBuilder text = new StringBuilder();
/** * 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}) * @since 4.0.0 */ public void setTextHighlightColor(String colorName) { CTRPr pr = getRunProperties(true); CTHighlight highlight = pr.isSetHighlight() ? pr.getHighlight() : pr.addNewHighlight(); STHighlightColor color = highlight.xgetVal(); if (color == null) { color = STHighlightColor.Factory.newInstance(); } STHighlightColor.Enum val = STHighlightColor.Enum.forString(colorName); if (val != null) { color.setStringValue(val.toString()); highlight.xsetVal(color); } }