public final class XSSFDrawing extends POIXMLDocumentPart implements Drawing
Modifier and Type | Field and Description |
---|---|
protected static String |
NAMESPACE_A |
protected static String |
NAMESPACE_C |
DEFAULT_XML_OPTIONS
Modifier | Constructor and Description |
---|---|
protected |
XSSFDrawing()
Create a new SpreadsheetML drawing
|
protected |
XSSFDrawing(PackagePart part,
PackageRelationship rel)
Construct a SpreadsheetML drawing from a package part
|
Modifier and Type | Method and Description |
---|---|
protected PackageRelationship |
addPictureReference(int pictureIndex)
Add the indexed picture to this drawing relations
|
protected void |
commit()
Save the content in the underlying package part.
|
XSSFClientAnchor |
createAnchor(int dx1,
int dy1,
int dx2,
int dy2,
int col1,
int row1,
int col2,
int row2)
Creates a new client anchor and sets the top-left and bottom-right
coordinates of the anchor.
|
XSSFComment |
createCellComment(ClientAnchor anchor)
Creates a comment.
|
XSSFChart |
createChart(ClientAnchor anchor)
Creates a chart.
|
XSSFChart |
createChart(XSSFClientAnchor anchor)
Creates a chart.
|
XSSFConnector |
createConnector(XSSFClientAnchor anchor)
Creates a simple shape.
|
XSSFShapeGroup |
createGroup(XSSFClientAnchor anchor)
Creates a simple shape.
|
XSSFPicture |
createPicture(ClientAnchor anchor,
int pictureIndex)
Creates a picture.
|
XSSFPicture |
createPicture(XSSFClientAnchor anchor,
int pictureIndex)
Creates a picture.
|
XSSFSimpleShape |
createSimpleShape(XSSFClientAnchor anchor)
Creates a simple shape.
|
XSSFTextBox |
createTextbox(XSSFClientAnchor anchor)
Constructs a textbox under the drawing.
|
void |
deleteChart(ZssChartX chartX)
Remove an existing chart
|
void |
deletePicture(Picture picture)
Remove an existing picture
|
List<XSSFChart> |
getCharts()
Returns all charts in this drawing.
|
org.openxmlformats.schemas.drawingml.x2006.spreadsheetDrawing.CTDrawing |
getCTDrawing()
Return the underlying CTDrawing bean, the root element of the SpreadsheetML Drawing part.
|
List<XSSFShape> |
getShapes() |
boolean |
isEmpty() |
void |
moveChart(ZssChartX chartX,
ClientAnchor anchor) |
void |
movePicture(Picture pic,
ClientAnchor anchor) |
addRelation, clearMemoryPackagePart, createRelationship, createRelationship, createRelationship, getPackagePart, getPackageRelationship, getParent, getRelationById, getRelationCounter, getRelationId, getRelations, getTargetPart, onDocumentCreate, onDocumentRead, onDocumentRemove, onSave, read, rebase, removeRelation, removeRelation, toString
protected static final String NAMESPACE_A
protected static final String NAMESPACE_C
protected XSSFDrawing()
XSSFSheet.createDrawingPatriarch()
protected XSSFDrawing(PackagePart part, PackageRelationship rel) throws IOException, org.apache.xmlbeans.XmlException
part
- the package part holding the drawing data,
the content type must be application/vnd.openxmlformats-officedocument.drawing+xml
rel
- the package relationship holding this drawing,
the relationship type must be http://schemas.openxmlformats.org/officeDocument/2006/relationships/drawingIOException
org.apache.xmlbeans.XmlException
@Internal public org.openxmlformats.schemas.drawingml.x2006.spreadsheetDrawing.CTDrawing getCTDrawing()
protected void commit() throws IOException
POIXMLDocumentPart
protected void commit() throws IOException {
PackagePart part = getPackagePart();
OutputStream out = part.getOutputStream();
XmlObject bean = getXmlBean(); //the "model" which holds changes in memory
bean.save(out, DEFAULT_XML_OPTIONS);
out.close();
}
commit
in class POIXMLDocumentPart
IOException
public XSSFClientAnchor createAnchor(int dx1, int dy1, int dx2, int dy2, int col1, int row1, int col2, int row2)
Drawing
createAnchor
in interface Drawing
dx1
- the x coordinate in EMU within the first cell.dy1
- the y coordinate in EMU within the first cell.dx2
- the x coordinate in EMU within the second cell.dy2
- the y coordinate in EMU within the second cell.col1
- the column (0 based) of the first cell.row1
- the row (0 based) of the first cell.col2
- the column (0 based) of the second cell.row2
- the row (0 based) of the second cell.public XSSFTextBox createTextbox(XSSFClientAnchor anchor)
anchor
- the client anchor describes how this group is attached
to the sheet.public XSSFPicture createPicture(XSSFClientAnchor anchor, int pictureIndex)
anchor
- the client anchor describes how this picture is attached to the sheet.pictureIndex
- the index of the picture in the workbook collection of pictures,
XSSFWorkbook.getAllPictures()
.public XSSFPicture createPicture(ClientAnchor anchor, int pictureIndex)
Drawing
createPicture
in interface Drawing
anchor
- the client anchor describes how this picture is
attached to the sheet.pictureIndex
- the index of the picture in the workbook collection
of pictures.public XSSFChart createChart(XSSFClientAnchor anchor)
anchor
- the client anchor describes how this chart is attached to
the sheet.createChart(ClientAnchor)
public XSSFChart createChart(ClientAnchor anchor)
Drawing
createChart
in interface Drawing
anchor
- the client anchor describes how this chart is attached to
the sheet.protected PackageRelationship addPictureReference(int pictureIndex)
pictureIndex
- the index of the picture in the workbook collection of pictures,
XSSFWorkbook.getAllPictures()
.public XSSFSimpleShape createSimpleShape(XSSFClientAnchor anchor)
anchor
- the client anchor describes how this group is attached
to the sheet.public XSSFConnector createConnector(XSSFClientAnchor anchor)
anchor
- the client anchor describes how this group is attached
to the sheet.public XSSFShapeGroup createGroup(XSSFClientAnchor anchor)
anchor
- the client anchor describes how this group is attached
to the sheet.public XSSFComment createCellComment(ClientAnchor anchor)
createCellComment
in interface Drawing
anchor
- the client anchor describes how this comment is attached
to the sheet.public void deletePicture(Picture picture)
Drawing
deletePicture
in interface Drawing
picture
- the picture to be removedpublic void movePicture(Picture pic, ClientAnchor anchor)
movePicture
in interface Drawing
public void moveChart(ZssChartX chartX, ClientAnchor anchor)
public void deleteChart(ZssChartX chartX)
Drawing
deleteChart
in interface Drawing
chartX
- the chart to be removedCopyright © 2020. All rights reserved.