@Override public void setTextRotation(Double rotation) { AbstractEscherOptRecord opt = getEscherOptRecord(); if (rotation == null) { opt.removeEscherProperty(EscherProperties.TEXT__FONTROTATION); } else { int rot = (int)(Math.round(rotation / 90.) % 4L); setEscherProperty(EscherProperties.TEXT__FONTROTATION, rot); } }
@Override public void setTextDirection(TextDirection orientation) { AbstractEscherOptRecord opt = getEscherOptRecord(); int msotxfl; if (orientation == null) { msotxfl = -1; } else { switch (orientation) { default: case STACKED: // not supported -> remove msotxfl = -1; break; case HORIZONTAL: msotxfl = 0; break; case VERTICAL: msotxfl = 1; break; case VERTICAL_270: // always interpreted as horizontal msotxfl = 2; break; } } setEscherProperty(opt, EscherProperties.TEXT__TEXTFLOW, msotxfl); }
/** * @return id for the text. */ public int getTextId(){ AbstractEscherOptRecord opt = getEscherOptRecord(); EscherSimpleProperty prop = getEscherProperty(opt, EscherProperties.TEXT__TEXTID); return prop == null ? 0 : prop.getPropertyValue(); }
@Override public Double getTextRotation() { // see 2.4.6 MSOCDIR AbstractEscherOptRecord opt = getEscherOptRecord(); EscherSimpleProperty prop = getEscherProperty(opt, EscherProperties.TEXT__FONTROTATION); return (prop == null) ? null : (90. * prop.getPropertyValue()); }
/** * Returns the value indicating word wrap. * * @return the value indicating word wrap. * Must be one of the <code>Wrap*</code> constants defined in this class. * * @see <a href="https://msdn.microsoft.com/en-us/library/dd948168(v=office.12).aspx">MSOWRAPMODE</a> */ public int getWordWrapEx() { AbstractEscherOptRecord opt = getEscherOptRecord(); EscherSimpleProperty prop = getEscherProperty(opt, EscherProperties.TEXT__WRAPTEXT); return prop == null ? WrapSquare : prop.getPropertyValue(); }
@Override public TextDirection getTextDirection() { // see 2.4.5 MSOTXFL AbstractEscherOptRecord opt = getEscherOptRecord(); EscherSimpleProperty prop = getEscherProperty(opt, EscherProperties.TEXT__TEXTFLOW); int msotxfl = (prop == null) ? 0 : prop.getPropertyValue(); switch (msotxfl) { default: case 0: // msotxflHorzN case 4: // msotxflHorzA return TextDirection.HORIZONTAL; case 1: // msotxflTtoBA case 3: // msotxflTtoBN case 5: // msotxflVertN return TextDirection.VERTICAL; case 2: // msotxflBtoT return TextDirection.VERTICAL_270; // TextDirection.STACKED is not supported } }
/** * Returns the distance (in points) between the edge of the text frame * and the edge of the inscribed rectangle of the shape that contains the text. * Default value is 1/20 inch. * * @param propId the id of the inset edge * @return the inset in points */ private double getInset(short propId, double defaultInch) { AbstractEscherOptRecord opt = getEscherOptRecord(); EscherSimpleProperty prop = getEscherProperty(opt, propId); int val = prop == null ? (int)(Units.toEMU(Units.POINT_DPI)*defaultInch) : prop.getPropertyValue(); return Units.toPoints(val); }
AbstractEscherOptRecord opt = getEscherOptRecord(); EscherSimpleProperty prop = getEscherProperty(opt, EscherProperties.TEXT__ANCHORTEXT); HSLFTextAnchor align = HSLFTextAnchor.TOP;