/** * Constructs a textbox under the drawing. * * @param anchor * the client anchor describes how this group is attached to the * sheet. * @return the newly created textbox. */ public XSSFTextBox createTextbox(XSSFClientAnchor anchor) { long shapeId = newShapeId(); CTTwoCellAnchor ctAnchor = createTwoCellAnchor(anchor); CTShape ctShape = ctAnchor.addNewSp(); ctShape.set(XSSFSimpleShape.prototype()); ctShape.getNvSpPr().getCNvPr().setId(shapeId); XSSFTextBox shape = new XSSFTextBox(this, ctShape); shape.anchor = anchor; return shape; }
/** * Creates a simple shape. This includes such shapes as lines, rectangles, * and ovals. * * @param anchor * the client anchor describes how this group is attached to the * sheet. * @return the newly created shape. */ public XSSFSimpleShape createSimpleShape(XSSFClientAnchor anchor) { long shapeId = newShapeId(); CTTwoCellAnchor ctAnchor = createTwoCellAnchor(anchor); CTShape ctShape = ctAnchor.addNewSp(); ctShape.set(XSSFSimpleShape.prototype()); ctShape.getNvSpPr().getCNvPr().setId(shapeId); ctShape.getSpPr().setXfrm(createXfrm(anchor)); XSSFSimpleShape shape = new XSSFSimpleShape(this, ctShape); shape.anchor = anchor; return shape; }
/** * Creates a picture. * * @param anchor * the client anchor describes how this picture is attached to * the sheet. * @param pictureIndex * the index of the picture in the workbook collection of * pictures, * {@link org.apache.poi.xssf.usermodel.XSSFWorkbook#getAllPictures()} * . * * @return the newly created picture shape. */ public XSSFPicture createPicture(XSSFClientAnchor anchor, int pictureIndex) { PackageRelationship rel = addPictureReference(pictureIndex); long shapeId = newShapeId(); CTTwoCellAnchor ctAnchor = createTwoCellAnchor(anchor); CTPicture ctShape = ctAnchor.addNewPic(); ctShape.set(XSSFPicture.prototype()); ctShape.getNvPicPr().getCNvPr().setId(shapeId); XSSFPicture shape = new XSSFPicture(this, ctShape); shape.anchor = anchor; shape.setPictureReference(rel); ctShape.getSpPr().setXfrm(createXfrm(anchor)); return shape; }
XSSFWorkbook wb = sheet.getWorkbook(); int sheetIndex = wb.getSheetIndex(sheet); long shapeId = (sheetIndex + 1L) * 1024 + newShapeId();
/** * Constructs a textbox under the drawing. * * @param anchor the client anchor describes how this group is attached * to the sheet. * @return the newly created textbox. */ public XSSFTextBox createTextbox(XSSFClientAnchor anchor){ long shapeId = newShapeId(); CTTwoCellAnchor ctAnchor = createTwoCellAnchor(anchor); CTShape ctShape = ctAnchor.addNewSp(); ctShape.set(XSSFSimpleShape.prototype()); ctShape.getNvSpPr().getCNvPr().setId(shapeId); XSSFTextBox shape = new XSSFTextBox(this, ctShape); shape.anchor = anchor; return shape; }
/** * Creates a simple shape. This includes such shapes as lines, rectangles, * and ovals. * * @param anchor the client anchor describes how this group is attached * to the sheet. * @return the newly created shape. */ public XSSFSimpleShape createSimpleShape(XSSFClientAnchor anchor) { long shapeId = newShapeId(); CTTwoCellAnchor ctAnchor = createTwoCellAnchor(anchor); CTShape ctShape = ctAnchor.addNewSp(); ctShape.set(XSSFSimpleShape.prototype()); ctShape.getNvSpPr().getCNvPr().setId(shapeId); XSSFSimpleShape shape = new XSSFSimpleShape(this, ctShape); shape.anchor = anchor; return shape; }
/** * Constructs a textbox under the drawing. * * @param anchor * the client anchor describes how this group is attached to the * sheet. * @return the newly created textbox. */ public XSSFTextBox createTextbox(XSSFClientAnchor anchor) { long shapeId = newShapeId(); CTTwoCellAnchor ctAnchor = createTwoCellAnchor(anchor); CTShape ctShape = ctAnchor.addNewSp(); ctShape.set(XSSFSimpleShape.prototype()); ctShape.getNvSpPr().getCNvPr().setId(shapeId); XSSFTextBox shape = new XSSFTextBox(this, ctShape); shape.anchor = anchor; return shape; }
/** * Creates a picture. * * @param anchor the client anchor describes how this picture is attached to the sheet. * @param pictureIndex the index of the picture in the workbook collection of pictures, * {@link org.apache.poi.xssf.usermodel.XSSFWorkbook#getAllPictures()} . * * @return the newly created picture shape. */ public XSSFPicture createPicture(XSSFClientAnchor anchor, int pictureIndex) { PackageRelationship rel = addPictureReference(pictureIndex); long shapeId = newShapeId(); CTTwoCellAnchor ctAnchor = createTwoCellAnchor(anchor); CTPicture ctShape = ctAnchor.addNewPic(); ctShape.set(XSSFPicture.prototype()); ctShape.getNvPicPr().getCNvPr().setId(shapeId); XSSFPicture shape = new XSSFPicture(this, ctShape); shape.anchor = anchor; shape.setPictureReference(rel); return shape; }
/** * Creates a simple shape. This includes such shapes as lines, rectangles, * and ovals. * * @param anchor * the client anchor describes how this group is attached to the * sheet. * @return the newly created shape. */ public XSSFSimpleShape createSimpleShape(XSSFClientAnchor anchor) { long shapeId = newShapeId(); CTTwoCellAnchor ctAnchor = createTwoCellAnchor(anchor); CTShape ctShape = ctAnchor.addNewSp(); ctShape.set(XSSFSimpleShape.prototype()); ctShape.getNvSpPr().getCNvPr().setId(shapeId); ctShape.getSpPr().setXfrm(createXfrm(anchor)); XSSFSimpleShape shape = new XSSFSimpleShape(this, ctShape); shape.anchor = anchor; return shape; }
/** * Creates a picture. * * @param anchor * the client anchor describes how this picture is attached to * the sheet. * @param pictureIndex * the index of the picture in the workbook collection of * pictures, * {@link org.apache.poi.xssf.usermodel.XSSFWorkbook#getAllPictures()} * . * * @return the newly created picture shape. */ public XSSFPicture createPicture(XSSFClientAnchor anchor, int pictureIndex) { PackageRelationship rel = addPictureReference(pictureIndex); long shapeId = newShapeId(); CTTwoCellAnchor ctAnchor = createTwoCellAnchor(anchor); CTPicture ctShape = ctAnchor.addNewPic(); ctShape.set(XSSFPicture.prototype()); ctShape.getNvPicPr().getCNvPr().setId(shapeId); XSSFPicture shape = new XSSFPicture(this, ctShape); shape.anchor = anchor; shape.setPictureReference(rel); ctShape.getSpPr().setXfrm(createXfrm(anchor)); return shape; }
XSSFWorkbook wb = sheet.getWorkbook(); int sheetIndex = wb.getSheetIndex(sheet); long shapeId = (sheetIndex + 1L) * 1024 + newShapeId();