use of org.openxmlformats.schemas.drawingml.x2006.spreadsheetDrawing.CTShapeNonVisual in project poi by apache.
the class XSLFAutoShape method prototype.
/**
* @param shapeId 1-based shapeId
*/
static CTShape prototype(int shapeId) {
CTShape ct = CTShape.Factory.newInstance();
CTShapeNonVisual nvSpPr = ct.addNewNvSpPr();
CTNonVisualDrawingProps cnv = nvSpPr.addNewCNvPr();
cnv.setName("AutoShape " + shapeId);
cnv.setId(shapeId + 1);
nvSpPr.addNewCNvSpPr();
nvSpPr.addNewNvPr();
CTShapeProperties spPr = ct.addNewSpPr();
CTPresetGeometry2D prst = spPr.addNewPrstGeom();
prst.setPrst(STShapeType.RECT);
prst.addNewAvLst();
return ct;
}
use of org.openxmlformats.schemas.drawingml.x2006.spreadsheetDrawing.CTShapeNonVisual in project poi by apache.
the class XSSFSimpleShape method prototype.
/**
* Prototype with the default structure of a new auto-shape.
*/
protected static CTShape prototype() {
if (prototype == null) {
CTShape shape = CTShape.Factory.newInstance();
CTShapeNonVisual nv = shape.addNewNvSpPr();
CTNonVisualDrawingProps nvp = nv.addNewCNvPr();
nvp.setId(1);
nvp.setName("Shape 1");
nv.addNewCNvSpPr();
CTShapeProperties sp = shape.addNewSpPr();
CTTransform2D t2d = sp.addNewXfrm();
CTPositiveSize2D p1 = t2d.addNewExt();
p1.setCx(0);
p1.setCy(0);
CTPoint2D p2 = t2d.addNewOff();
p2.setX(0);
p2.setY(0);
CTPresetGeometry2D geom = sp.addNewPrstGeom();
geom.setPrst(STShapeType.RECT);
geom.addNewAvLst();
CTTextBody body = shape.addNewTxBody();
CTTextBodyProperties bodypr = body.addNewBodyPr();
bodypr.setAnchor(STTextAnchoringType.T);
bodypr.setRtlCol(false);
CTTextParagraph p = body.addNewP();
p.addNewPPr().setAlgn(STTextAlignType.L);
CTTextCharacterProperties endPr = p.addNewEndParaRPr();
endPr.setLang("en-US");
endPr.setSz(1100);
CTSolidColorFillProperties scfpr = endPr.addNewSolidFill();
scfpr.addNewSrgbClr().setVal(new byte[] { 0, 0, 0 });
body.addNewLstStyle();
prototype = shape;
}
return prototype;
}
use of org.openxmlformats.schemas.drawingml.x2006.spreadsheetDrawing.CTShapeNonVisual in project tika by apache.
the class XSSFBExcelExtractorDecorator method extractHyperLinksFromShape.
private void extractHyperLinksFromShape(CTShape ctShape, XHTMLContentHandler xhtml) throws SAXException {
if (ctShape == null)
return;
CTShapeNonVisual nvSpPR = ctShape.getNvSpPr();
if (nvSpPR == null)
return;
CTNonVisualDrawingProps cNvPr = nvSpPR.getCNvPr();
if (cNvPr == null)
return;
CTHyperlink ctHyperlink = cNvPr.getHlinkClick();
if (ctHyperlink == null)
return;
String url = drawingHyperlinks.get(ctHyperlink.getId());
if (url != null) {
xhtml.startElement("a", "href", url);
xhtml.characters(url);
xhtml.endElement("a");
}
CTHyperlink ctHoverHyperlink = cNvPr.getHlinkHover();
if (ctHoverHyperlink == null)
return;
url = drawingHyperlinks.get(ctHoverHyperlink.getId());
if (url != null) {
xhtml.startElement("a", "href", url);
xhtml.characters(url);
xhtml.endElement("a");
}
}
use of org.openxmlformats.schemas.drawingml.x2006.spreadsheetDrawing.CTShapeNonVisual in project tika by apache.
the class XSSFExcelExtractorDecorator method extractHyperLinksFromShape.
private void extractHyperLinksFromShape(CTShape ctShape, XHTMLContentHandler xhtml) throws SAXException {
if (ctShape == null)
return;
CTShapeNonVisual nvSpPR = ctShape.getNvSpPr();
if (nvSpPR == null)
return;
CTNonVisualDrawingProps cNvPr = nvSpPR.getCNvPr();
if (cNvPr == null)
return;
CTHyperlink ctHyperlink = cNvPr.getHlinkClick();
if (ctHyperlink == null)
return;
String url = drawingHyperlinks.get(ctHyperlink.getId());
if (url != null) {
xhtml.startElement("a", "href", url);
xhtml.characters(url);
xhtml.endElement("a");
}
CTHyperlink ctHoverHyperlink = cNvPr.getHlinkHover();
if (ctHoverHyperlink == null)
return;
url = drawingHyperlinks.get(ctHoverHyperlink.getId());
if (url != null) {
xhtml.startElement("a", "href", url);
xhtml.characters(url);
xhtml.endElement("a");
}
}
use of org.openxmlformats.schemas.drawingml.x2006.spreadsheetDrawing.CTShapeNonVisual in project poi by apache.
the class XSLFFreeformShape method prototype.
/**
* @param shapeId 1-based shapeId
*/
static CTShape prototype(int shapeId) {
CTShape ct = CTShape.Factory.newInstance();
CTShapeNonVisual nvSpPr = ct.addNewNvSpPr();
CTNonVisualDrawingProps cnv = nvSpPr.addNewCNvPr();
cnv.setName("Freeform " + shapeId);
cnv.setId(shapeId + 1);
nvSpPr.addNewCNvSpPr();
nvSpPr.addNewNvPr();
CTShapeProperties spPr = ct.addNewSpPr();
CTCustomGeometry2D geom = spPr.addNewCustGeom();
geom.addNewAvLst();
geom.addNewGdLst();
geom.addNewAhLst();
geom.addNewCxnLst();
CTGeomRect rect = geom.addNewRect();
rect.setR("r");
rect.setB("b");
rect.setT("t");
rect.setL("l");
geom.addNewPathLst();
return ct;
}
Aggregations