/** * Sets the value of the given Paragraph TextProp, add if required * @param propName The name of the Paragraph TextProp * @param val The value to set for the TextProp */ public void setCharTextPropVal(String propName, Integer val) { getTextParagraph().setPropVal(characterStyle, propName, val); }
/** * Gets the subscript/superscript option * * @return the percentage of the font size. If the value is positive, it is superscript, otherwise it is subscript */ public int getSuperscript() { TextProp tp = getTextParagraph().getPropVal(characterStyle, "superscript"); return tp == null ? 0 : tp.getValue(); }
@Override public Double getFontSize() { TextProp tp = getTextParagraph().getPropVal(characterStyle, "font.size"); return tp == null ? null : (double)tp.getValue(); }
/** * Gets the font index */ public int getFontIndex() { TextProp tp = getTextParagraph().getPropVal(characterStyle, "font.index"); return tp == null ? -1 : tp.getValue(); }
/** * @return font color as PaintStyle */ @Override public SolidPaint getFontColor() { TextProp tp = getTextParagraph().getPropVal(characterStyle, "font.color"); if (tp == null) { return null; } Color color = HSLFTextParagraph.getColorFromColorIndexStruct(tp.getValue(), parentParagraph.getSheet()); return DrawPaint.createSolidPaint(color); }
@Override public FieldType getFieldType() { HSLFTextShape ts = getTextParagraph().getParentShape(); Placeholder ph = ts.getPlaceholder(); if (ph != null) { switch (ph) { case SLIDE_NUMBER: return FieldType.SLIDE_NUMBER; case DATETIME: return FieldType.DATE_TIME; default: break; } } if (ts.getSheet() instanceof MasterSheet) { TextShape<?,? extends TextParagraph<?,?,? extends TextRun>> ms = ts.getMetroShape(); if (ms == null || ms.getTextParagraphs().isEmpty()) { return null; } List<? extends TextRun> trList = ms.getTextParagraphs().get(0).getTextRuns(); if (trList.isEmpty()) { return null; } return trList.get(0).getFieldType(); } return null; }
@Override public HSLFFontInfo getFontInfo(final FontGroup fontGroup) { FontGroup fg = safeFontGroup(fontGroup); HSLFSheet sheet = parentParagraph.getSheet(); @SuppressWarnings("resource") HSLFSlideShow slideShow = (sheet == null) ? null : sheet.getSlideShow(); if (sheet == null || slideShow == null) { return (cachedFontInfo != null) ? cachedFontInfo[fg.ordinal()] : null; } String propName; switch (fg) { default: case LATIN: propName = "font.index,ansi.font.index"; break; case COMPLEX_SCRIPT: case EAST_ASIAN: propName = "asian.font.index"; break; case SYMBOL: propName = "symbol.font.index"; break; } TextProp tp = getTextParagraph().getPropVal(characterStyle, propName); return (tp != null) ? slideShow.getFont(tp.getValue()) : null; }
cell.setHorizontalCentered(true); } else { rt.getTextParagraph().setBullet(true); rt.setFontSize(12d); rt.getTextParagraph().setTextAlign(TextAlign.LEFT); cell.setHorizontalCentered(false);
int linkId = run.getTextParagraph().getSheet().getSlideShow().addToObjListAtom(exHyper); ExHyperlinkAtom obj = exHyper.getExHyperlinkAtom(); obj.setNumber(linkId); int startIdx = run.getTextParagraph().getStartIdxOfTextRun(run); int endIdx = startIdx + run.getLength(); txinfo.setStartIndex(startIdx);