if (ln.isSetNoFill()) { ln.unsetNoFill(); if (!ln.isSetPrstDash()) { ln.addNewPrstDash().setVal(STPresetLineDashVal.SOLID); if (!ln.isSetCmpd()) { ln.setCmpd(STCompoundLine.SNG); if (!ln.isSetAlgn()) { ln.setAlgn(STPenAlignment.CTR); if (!ln.isSetCap()) { ln.setCap(STLineCap.FLAT); if (!ln.isSetRound()) { ln.addNewRound(); if (!ln.isSetHeadEnd()) { CTLineEndProperties hd = ln.addNewHeadEnd(); hd.setType(STLineEndType.NONE); hd.setW(STLineEndWidth.MED); if (!ln.isSetTailEnd()) { CTLineEndProperties tl = ln.addNewTailEnd(); tl.setType(STLineEndType.NONE); tl.setW(STLineEndWidth.MED);
if (lnPr.isSetW()) { lnPr.unsetW(); if (!lnPr.isSetNoFill()) { lnPr.addNewNoFill(); if (lnPr.isSetSolidFill()) { lnPr.unsetSolidFill(); if (lnPr.isSetGradFill()) { lnPr.unsetGradFill(); if (lnPr.isSetPattFill()) { lnPr.unsetPattFill(); if (lnPr.isSetNoFill()) { lnPr.unsetNoFill(); lnPr.setW(Units.toEMU(width));
/** * @param color the color to paint the shape outline. * A <code>null</code> value turns off the shape outline. */ public void setLineColor(Color color) { CTLineProperties ln = getLn(this, true); if (ln == null) { return; } if (ln.isSetSolidFill()) { ln.unsetSolidFill(); } if (ln.isSetGradFill()) { ln.unsetGradFill(); } if (ln.isSetPattFill()) { ln.unsetPattFill(); } if (ln.isSetNoFill()) { ln.unsetNoFill(); } if (color == null) { ln.addNewNoFill(); } else { CTSolidColorFillProperties fill = ln.addNewSolidFill(); XSLFColor col = new XSLFColor(fill, getSheet().getTheme(), fill.getSchemeClr()); col.setColor(color); } }
public XDDFPresetLineDash getPresetDash() { if (props.isSetPrstDash()) { return new XDDFPresetLineDash(props.getPrstDash()); } else { return null; } }
public XDDFLineEndProperties getHeadEnd() { if (props.isSetHeadEnd()) { return new XDDFLineEndProperties(props.getHeadEnd()); } else { return null; } }
private void setLineColor(CTLineProperties ln, Color color){ if(color == null){ ln.addNewNoFill(); if(ln.isSetSolidFill()) ln.unsetSolidFill(); } else { if(ln.isSetNoFill()) ln.unsetNoFill(); if(!ln.isSetPrstDash()) ln.addNewPrstDash().setVal(STPresetLineDashVal.SOLID); ln.setCmpd(STCompoundLine.SNG); ln.setAlgn(STPenAlignment.CTR); ln.setCap(STLineCap.FLAT); ln.addNewRound(); CTLineEndProperties hd = ln.addNewHeadEnd(); hd.setType(STLineEndType.NONE); hd.setW(STLineEndWidth.MED); hd.setLen(STLineEndLength.MED); CTLineEndProperties tl = ln.addNewTailEnd(); tl.setType(STLineEndType.NONE); tl.setW(STLineEndWidth.MED); tl.setLen(STLineEndLength.MED); CTSRgbColor rgb = CTSRgbColor.Factory.newInstance(); rgb.setVal(new byte[]{(byte)color.getRed(), (byte)color.getGreen(), (byte)color.getBlue()}); ln.addNewSolidFill().setSrgbClr(rgb); } }
/** * Specifies the line end width in relation to the line width. */ @SuppressWarnings("WeakerAccess") public void setLineHeadLength(DecorationSize style) { CTLineProperties ln = getLn(this, true); if (ln == null) { return; } CTLineEndProperties lnEnd = ln.isSetHeadEnd() ? ln.getHeadEnd() : ln.addNewHeadEnd(); if (style == null) { if (lnEnd.isSetLen()) { lnEnd.unsetLen(); } } else { lnEnd.setLen(STLineEndLength.Enum.forInt(style.ooxmlId)); } }
/** * Specifies the line end decoration, such as a triangle or arrowhead. */ @SuppressWarnings("WeakerAccess") public void setLineTailDecoration(DecorationShape style) { CTLineProperties ln = getLn(this, true); if (ln == null) { return; } CTLineEndProperties lnEnd = ln.isSetTailEnd() ? ln.getTailEnd() : ln.addNewTailEnd(); if (style == null) { if (lnEnd.isSetType()) { lnEnd.unsetType(); } } else { lnEnd.setType(STLineEndType.Enum.forInt(style.ooxmlId)); } }
public XDDFFillProperties getFillProperties() { if (props.isSetGradFill()) { return new XDDFGradientFillProperties(props.getGradFill()); } else if (props.isSetNoFill()) { return new XDDFNoFillProperties(props.getNoFill()); } else if (props.isSetPattFill()) { return new XDDFPatternFillProperties(props.getPattFill()); } else if (props.isSetSolidFill()) { return new XDDFSolidFillProperties(props.getSolidFill()); } else { return null; } }
@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()); }
/** * * @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)); } }
@SuppressWarnings("WeakerAccess") public Color getBorderColor(BorderEdge edge) { CTLineProperties ln = getCTLine(edge, false); if (ln == null || ln.isSetNoFill() || !ln.isSetSolidFill()) { return null; } CTSolidColorFillProperties fill = ln.getSolidFill(); XSLFColor c = new XSLFColor(fill, getSheet().getTheme(), fill.getSchemeClr()); return c.getColor(); }
@Override public void setLineStyleColor( int red, int green, int blue ) { CTShapeProperties props = getShapeProperties(); CTLineProperties ln = props.isSetLn() ? props.getLn() : props.addNewLn(); CTSolidColorFillProperties fill = ln.isSetSolidFill() ? ln.getSolidFill() : ln.addNewSolidFill(); CTSRgbColor rgb = CTSRgbColor.Factory.newInstance(); rgb.setVal(new byte[]{(byte)red, (byte)green, (byte)blue}); fill.setSrgbClr(rgb); }
@SuppressWarnings("WeakerAccess") public LineCap getBorderCap(BorderEdge edge) { CTLineProperties ln = getCTLine(edge, false); if (ln == null || ln.isSetNoFill() || !ln.isSetSolidFill() || !ln.isSetCap()) { return null; } return LineCap.fromOoxmlId(ln.getCap().intValue()); }
/** * @param color the color to paint the shape outline. * A <code>null</code> value turns off the shape outline. */ public void setLineColor(Color color) { CTShapeProperties spPr = getSpPr(); if (color == null) { if (spPr.isSetLn() && spPr.getLn().isSetSolidFill()) spPr.getLn().unsetSolidFill(); } else { CTLineProperties ln = spPr.isSetLn() ? spPr.getLn() : spPr .addNewLn(); CTSRgbColor rgb = CTSRgbColor.Factory.newInstance(); rgb.setVal(new byte[]{(byte) color.getRed(), (byte) color.getGreen(), (byte) color.getBlue()}); CTSolidColorFillProperties fill = ln.isSetSolidFill() ? ln .getSolidFill() : ln.addNewSolidFill(); fill.setSrgbClr(rgb); if(fill.isSetHslClr()) fill.unsetHslClr(); if(fill.isSetPrstClr()) fill.unsetPrstClr(); if(fill.isSetSchemeClr()) fill.unsetSchemeClr(); if(fill.isSetScrgbClr()) fill.unsetScrgbClr(); if(fill.isSetSysClr()) fill.unsetSysClr(); } }
@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)); }
@Override public CTNoFillProperties addNewNoFill() { return props.addNewNoFill(); }
@Override public CTSolidColorFillProperties addNewSolidFill() { return props.addNewSolidFill(); }
@Override public CTSolidColorFillProperties getSolidFill() { return props.getSolidFill(); }