use of org.openxmlformats.schemas.drawingml.x2006.main.CTLineProperties in project poi by apache.
the class XSLFConnectorShape method prototype.
/**
* @param shapeId 1-based shapeId
*/
static CTConnector prototype(int shapeId) {
CTConnector ct = CTConnector.Factory.newInstance();
CTConnectorNonVisual nvSpPr = ct.addNewNvCxnSpPr();
CTNonVisualDrawingProps cnv = nvSpPr.addNewCNvPr();
cnv.setName("Connector " + shapeId);
cnv.setId(shapeId + 1);
nvSpPr.addNewCNvCxnSpPr();
nvSpPr.addNewNvPr();
CTShapeProperties spPr = ct.addNewSpPr();
CTPresetGeometry2D prst = spPr.addNewPrstGeom();
prst.setPrst(STShapeType.LINE);
prst.addNewAvLst();
/* CTLineProperties ln = */
spPr.addNewLn();
return ct;
}
use of org.openxmlformats.schemas.drawingml.x2006.main.CTLineProperties in project poi by apache.
the class XSLFSimpleShape method getLn.
private static CTLineProperties getLn(XSLFShape shape, boolean create) {
XmlObject pr = shape.getShapeProperties();
if (!(pr instanceof CTShapeProperties)) {
LOG.log(POILogger.WARN, shape.getClass() + " doesn't have line properties");
return null;
}
CTShapeProperties spr = (CTShapeProperties) pr;
return (spr.isSetLn() || !create) ? spr.getLn() : spr.addNewLn();
}
use of org.openxmlformats.schemas.drawingml.x2006.main.CTLineProperties in project poi by apache.
the class XSLFTableCell method setBorderDash.
@Override
public void setBorderDash(BorderEdge edge, LineDash dash) {
if (dash == null) {
throw new IllegalArgumentException("LineDash need to be specified.");
}
CTLineProperties ln = setBorderDefaults(edge);
ln.getPrstDash().setVal(STPresetLineDashVal.Enum.forInt(dash.ooxmlId));
}
use of org.openxmlformats.schemas.drawingml.x2006.main.CTLineProperties in project poi by apache.
the class XSLFTableCell method setBorderColor.
@Override
public void setBorderColor(BorderEdge edge, Color color) {
if (color == null) {
throw new IllegalArgumentException("Colors need to be specified.");
}
CTLineProperties ln = setBorderDefaults(edge);
CTSolidColorFillProperties fill = ln.addNewSolidFill();
XSLFColor c = new XSLFColor(fill, getSheet().getTheme(), fill.getSchemeClr());
c.setColor(color);
}
use of org.openxmlformats.schemas.drawingml.x2006.main.CTLineProperties in project poi by apache.
the class XSLFTableCell method setBorderDefaults.
private CTLineProperties setBorderDefaults(BorderEdge edge) {
CTLineProperties ln = getCTLine(edge, true);
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);
hd.setLen(STLineEndLength.MED);
}
if (!ln.isSetTailEnd()) {
CTLineEndProperties tl = ln.addNewTailEnd();
tl.setType(STLineEndType.NONE);
tl.setW(STLineEndWidth.MED);
tl.setLen(STLineEndLength.MED);
}
return ln;
}
Aggregations