public final class XSSFDrawing extends POIXMLDocumentPart implements Drawing<XSSFShape>
POIXMLDocumentPart.RelationPart
Modifier and Type | Field and Description |
---|---|
protected static java.lang.String |
NAMESPACE_A |
protected static java.lang.String |
NAMESPACE_C |
Modifier | Constructor and Description |
---|---|
protected |
XSSFDrawing()
Create a new SpreadsheetML drawing
(创建新的 SpreadsheetML 绘图)
|
|
XSSFDrawing(PackagePart part)
Construct a SpreadsheetML drawing from a package part
(从包部件构造 SpreadsheetML 绘图)
|
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.
(创建一个简单的形状。)
|
XSSFObjectData |
createObjectData(ClientAnchor anchor, int storageId, int pictureIndex)
Adds a new OLE Package Shape
(添加新的 OLE 包形状)
|
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.
(在绘图下构造一个文本框。)
|
java.util.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.
(返回底层 CTDrawing bean,即 SpreadsheetML 绘图部件的根元素。)
|
java.util.List<XSSFShape> |
getShapes() |
java.util.List<XSSFShape> |
getShapes(XSSFShapeGroup groupshape) |
XSSFSheet |
getSheet() |
XSSFChart |
importChart(XSSFChart srcChart)
Imports the chart from the
srcChart into this drawing.
(将图表从 srcChart 导入到此绘图中。)
|
java.util.Iterator<XSSFShape> |
iterator() |
_invokeOnDocumentRead, addRelation, createRelationship, createRelationship, createRelationship, getNextPartNumber, getPackagePart, getParent, getRelationById, getRelationId, getRelationPartById, getRelationParts, getRelations, getTargetPart, isCommitted, onDocumentCreate, onDocumentRead, onDocumentRemove, onSave, prepareForCommit, read, rebase, removeRelation, removeRelation, removeRelation, setCommitted, toString
protected static final java.lang.String NAMESPACE_A
protected static final java.lang.String NAMESPACE_C
protected XSSFDrawing()
XSSFSheet.createDrawingPatriarch()
public XSSFDrawing(PackagePart part) throws java.io.IOException, org.apache.xmlbeans.XmlException
part
- the package part holding the drawing data, the content type must be
application/vnd.openxmlformats-officedocument.drawing+xml
(part - 包含绘图数据的包部分,内容类型必须是 application/vnd.openxmlformats-officedocument.drawing+xml)
java.io.IOException
(java.io.IOException)
org.apache.xmlbeans.XmlException
(org.apache.xmlbeans.XmlException)
@Internal public org.openxmlformats.schemas.drawingml.x2006.spreadsheetDrawing.CTDrawing getCTDrawing()
protected void commit() throws java.io.IOException
POIXMLDocumentPart
Sub-classes should override and add logic to marshal the "model" into Ooxml4J.
For example, the code saving a generic XML entry may look as follows:
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(); }(将内容保存在底层包部分中。默认实现是空的,这意味着包部分保持不变。子类应覆盖并添加逻辑以将“模型”编组到 Ooxml4J。例如,保存通用 XML 条目的代码可能如下所示: protected void commit() throws IOException { PackagePart part = getPackagePart();输出流输出 = part.getOutputStream(); XmlObject bean = getXmlBean(); //保存内存变化的“模型” bean.save(out, DEFAULT_XML_OPTIONS); out.close(); })
commit
in class
POIXMLDocumentPart
java.io.IOException
- a subclass may throw an IOException if the changes can't be committed
(java.io.IOException - 如果无法提交更改,子类可能会抛出 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<XSSFShape>
(界面绘图中的createAnchor
dx1
- the x coordinate in EMU within the first cell.
(dx1 - 第一个单元格内 EMU 中的 x 坐标。)
dy1
- the y coordinate in EMU within the first cell.
(dy1 - 第一个单元格内 EMU 中的 y 坐标。)
dx2
- the x coordinate in EMU within the second cell.
(dx2 - 第二个单元格内 EMU 中的 x 坐标。)
dy2
- the y coordinate in EMU within the second cell.
(dy2 - 第二个单元格内 EMU 中的 y 坐标。)
col1
- the column (0 based) of the first cell.
(col1 - 第一个单元格的列(基于 0)。)
row1
- the row (0 based) of the first cell.
(row1 - 第一个单元格的行(基于 0)。)
col2
- the column (0 based) of the second cell.
(col2 - 第二个单元格的列(基于 0)。)
row2
- the row (0 based) of the second cell.
(row2 - 第二个单元格的行(基于 0)。)
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()
.
(pictureIndex - 图片工作簿集合 XSSFWorkbook.getAllPictures() 中图片的索引。)
public XSSFPicture createPicture(ClientAnchor anchor, int pictureIndex)
Drawing
createPicture
in interface
Drawing<XSSFShape>
(界面绘图中的createPicture
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.
(pictureIndex - 图片工作簿集合中图片的索引。)
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)
anchor
- the client anchor describes how this chart is attached to the sheet.
(锚点 - 客户端锚点描述此图表如何附加到工作表。)
public XSSFChart importChart(XSSFChart srcChart)
srcChart
into this drawing.
(将图表从 srcChart 导入到此绘图中。)
srcChart
- the source chart to be cloned into this drawing.
(srcChart - 要克隆到此绘图中的源图表。)
protected PackageRelationship addPictureReference(int pictureIndex)
pictureIndex
- the index of the picture in the workbook collection of pictures,
XSSFWorkbook.getAllPictures()
.
(pictureIndex - 图片工作簿集合 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<XSSFShape>
(界面绘图中的createCellComment
anchor
- the client anchor describes how this comment is attached to the sheet.
(锚点 - 客户锚点描述如何将此评论附加到工作表。)
public XSSFObjectData createObjectData(ClientAnchor anchor, int storageId, int pictureIndex)
Drawing
createObjectData
in interface
Drawing<XSSFShape>
(界面绘图中的createObjectData
anchor
- the client anchor describes how this picture is attached to the sheet.
(锚点 - 客户锚点描述了这张图片是如何附加到工作表上的。)
storageId
- the storageId returned by
Workbook.addOlePackage(byte[], String, String, String)
(storageId - Workbook.addOlePackage(byte[], String, String, String) 返回的 storageId)
pictureIndex
- the index of the picture (used as preview image) in the workbook collection of pictures.
(pictureIndex - 图片工作簿集合中图片(用作预览图像)的索引。)
public java.util.List<XSSFChart> getCharts()
public java.util.List<XSSFShape> getShapes()
public java.util.List<XSSFShape> getShapes(XSSFShapeGroup groupshape)
public java.util.Iterator<XSSFShape> iterator()
iterator
in interface
java.lang.Iterable<XSSFShape>
(接口 java.lang.Iterable 中的迭代器
public XSSFSheet getSheet()
Copyright 2021 The Apache Software Foundation or its licensors, as applicable.