@Override public void setBorderDash(BorderEdge edge, LineDash dash) { if (dash == null) { throw new IllegalArgumentException("LineDash need to be specified."); } CTLineProperties ln = setBorderDefaults(edge); if (!ln.isSetPrstDash()) { ln.addNewPrstDash(); } ln.getPrstDash().setVal(STPresetLineDashVal.Enum.forInt(dash.ooxmlId)); }
CTPresetLineDashProperties ctDash = defaultLn.getPrstDash(); if (ctDash != null) { dash = LineDash.values()[ctDash.getVal().intValue() - 1];
/** * @return a preset line dashing scheme to stroke the shape outline */ @SuppressWarnings("WeakerAccess") public LineDash getLineDash() { PropertyFetcher<LineDash> fetcher = new PropertyFetcher<LineDash>() { @Override public boolean fetch(XSLFShape shape) { CTLineProperties ln = getLn(shape, false); if (ln == null || !ln.isSetPrstDash()) { return false; } setValue(LineDash.fromOoxmlId(ln.getPrstDash().getVal().intValue())); return true; } }; fetchShapeProperty(fetcher); LineDash dash = fetcher.getValue(); if (dash == null) { CTLineProperties defaultLn = getDefaultLineProperties(); if (defaultLn != null && defaultLn.isSetPrstDash()) { dash = LineDash.fromOoxmlId(defaultLn.getPrstDash().getVal().intValue()); } } return dash; }
/** * * @param dash a preset line dashing scheme to stroke thr shape outline */ public void setLineDash(LineDash dash) { CTShapeProperties spPr = getSpPr(); if (dash == null) { if (spPr.isSetLn()) spPr.getLn().unsetPrstDash(); } else { CTPresetLineDashProperties val = CTPresetLineDashProperties.Factory .newInstance(); val.setVal(STPresetLineDashVal.Enum.forInt(dash.ordinal() + 1)); CTLineProperties ln = spPr.isSetLn() ? spPr.getLn() : spPr .addNewLn(); ln.setPrstDash(val); } }
/** * * @param dash a preset line dashing scheme to stroke thr shape outline */ @SuppressWarnings("WeakerAccess") public void setLineDash(LineDash dash) { CTLineProperties ln = getLn(this, true); if (ln == null) { return; } if (dash == null) { if (ln.isSetPrstDash()) { ln.unsetPrstDash(); } } else { CTPresetLineDashProperties ldp = ln.isSetPrstDash() ? ln.getPrstDash() : ln.addNewPrstDash(); ldp.setVal(STPresetLineDashVal.Enum.forInt(dash.ooxmlId)); } }
public boolean fetch(XSLFSimpleShape shape) { CTShapeProperties spPr = shape.getSpPr(); CTLineProperties ln = spPr.getLn(); if (ln != null) { CTPresetLineDashProperties ctDash = ln.getPrstDash(); if (ctDash != null) { setValue(LineDash.values()[ctDash.getVal().intValue() - 1]); return true; } } return false; } };
@SuppressWarnings("WeakerAccess") public LineDash getBorderDash(BorderEdge edge) { CTLineProperties ln = getCTLine(edge, false); if (ln == null || ln.isSetNoFill() || !ln.isSetSolidFill() || !ln.isSetPrstDash()) { return null; } return LineDash.fromOoxmlId(ln.getPrstDash().getVal().intValue()); }
@Override public void setBorderDash(BorderEdge edge, LineDash dash) { if (dash == null) { throw new IllegalArgumentException("LineDash need to be specified."); } CTLineProperties ln = setBorderDefaults(edge); if (!ln.isSetPrstDash()) { ln.addNewPrstDash(); } ln.getPrstDash().setVal(STPresetLineDashVal.Enum.forInt(dash.ooxmlId)); }
/** * Sets the line style. * * @param lineStyle */ public void setLineStyle( int lineStyle ) { CTShapeProperties props = getShapeProperties(); CTLineProperties ln = props.isSetLn() ? props.getLn() : props.addNewLn(); CTPresetLineDashProperties dashStyle = CTPresetLineDashProperties.Factory.newInstance(); dashStyle.setVal(STPresetLineDashVal.Enum.forInt(lineStyle+1)); ln.setPrstDash(dashStyle); }
@Override public boolean fetch(XSLFShape shape) { CTLineProperties ln = getLn(shape, false); if (ln == null || !ln.isSetPrstDash()) { return false; } setValue(LineDash.fromOoxmlId(ln.getPrstDash().getVal().intValue())); return true; } };
/** * Sets the line style. * * @param lineStyle */ public void setLineStyle( int lineStyle ) { CTShapeProperties props = getShapeProperties(); CTLineProperties ln = props.isSetLn() ? props.getLn() : props.addNewLn(); CTPresetLineDashProperties dashStyle = CTPresetLineDashProperties.Factory.newInstance(); dashStyle.setVal(STPresetLineDashVal.Enum.forInt(lineStyle+1)); ln.setPrstDash(dashStyle); }
/** * @return a preset line dashing scheme to stroke the shape outline */ @SuppressWarnings("WeakerAccess") public LineDash getLineDash() { PropertyFetcher<LineDash> fetcher = new PropertyFetcher<LineDash>() { @Override public boolean fetch(XSLFShape shape) { CTLineProperties ln = getLn(shape, false); if (ln == null || !ln.isSetPrstDash()) { return false; } setValue(LineDash.fromOoxmlId(ln.getPrstDash().getVal().intValue())); return true; } }; fetchShapeProperty(fetcher); LineDash dash = fetcher.getValue(); if (dash == null) { CTLineProperties defaultLn = getDefaultLineProperties(); if (defaultLn != null && defaultLn.isSetPrstDash()) { dash = LineDash.fromOoxmlId(defaultLn.getPrstDash().getVal().intValue()); } } return dash; }
/** * * @param dash a preset line dashing scheme to stroke thr shape outline */ @SuppressWarnings("WeakerAccess") public void setLineDash(LineDash dash) { CTLineProperties ln = getLn(this, true); if (ln == null) { return; } if (dash == null) { if (ln.isSetPrstDash()) { ln.unsetPrstDash(); } } else { CTPresetLineDashProperties ldp = ln.isSetPrstDash() ? ln.getPrstDash() : ln.addNewPrstDash(); ldp.setVal(STPresetLineDashVal.Enum.forInt(dash.ooxmlId)); } }
@Override public boolean fetch(XSLFShape shape) { CTLineProperties ln = getLn(shape, false); if (ln == null || !ln.isSetPrstDash()) { return false; } setValue(LineDash.fromOoxmlId(ln.getPrstDash().getVal().intValue())); return true; } };
/** * Sets the line style. * * @param lineStyle */ public void setLineStyle( int lineStyle ) { CTShapeProperties props = getShapeProperties(); CTLineProperties ln = props.isSetLn() ? props.getLn() : props.addNewLn(); CTPresetLineDashProperties dashStyle = CTPresetLineDashProperties.Factory.newInstance(); dashStyle.setVal(STPresetLineDashVal.Enum.forInt(lineStyle+1)); ln.setPrstDash(dashStyle); }
@SuppressWarnings("WeakerAccess") public LineDash getBorderDash(BorderEdge edge) { CTLineProperties ln = getCTLine(edge, false); if (ln == null || ln.isSetNoFill() || !ln.isSetSolidFill() || !ln.isSetPrstDash()) { return null; } return LineDash.fromOoxmlId(ln.getPrstDash().getVal().intValue()); }