Class SXSSFPicture
- java.lang.Object
-
- org.apache.poi.xssf.streaming.SXSSFPicture
-
public final class SXSSFPicture extends java.lang.Object implements Picture
Streaming version of Picture. Most of the code is a copy of the non-streaming XSSFPicture code. This is necessary as a private method getRowHeightInPixels of that class needs to be changed, which is called by a method call chain nested several levels. The main change is to access the rows in the SXSSF sheet, not the always empty rows in the XSSF sheet when checking the row heights.
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description XSSFAnchorgetAnchor()XSSFClientAnchorgetClientAnchor()CTPicturegetCTPicture()Return the underlying CTPicture bean that holds all properties for this pictureXSSFDrawinggetDrawing()java.awt.DimensiongetImageDimension()Return the dimension of the embedded image in pixelShapegetParent()XSSFPictureDatagetPictureData()Return picture data for this shapeXSSFClientAnchorgetPreferredSize()Calculate the preferred size for this picture.XSSFClientAnchorgetPreferredSize(double scale)Calculate the preferred size for this picture.XSSFClientAnchorgetPreferredSize(double scaleX, double scaleY)Calculate the preferred size for this picture.java.lang.StringgetShapeName()XSSFSheetgetSheet()booleanisNoFill()Whether this shape is not filled with a colorvoidresize()Reset the image to the original size.voidresize(double scale)Reset the image to the original size.voidresize(double scaleX, double scaleY)Resize the image.voidsetFillColor(int red, int green, int blue)Sets the color used to fill this shape using the solid fill pattern.voidsetLineStyleColor(int red, int green, int blue)The color applied to the lines of this shape.voidsetNoFill(boolean noFill)Sets whether this shape is filled or transparent.
-
-
-
Method Detail
-
getCTPicture
@Internal public CTPicture getCTPicture()
Return the underlying CTPicture bean that holds all properties for this picture- Returns:
- the underlying CTPicture bean
-
resize
public void resize()
Reset the image to the original size.Please note, that this method works correctly only for workbooks with the default font size (Calibri 11pt for .xlsx). If the default font is changed the resized image can be streched vertically or horizontally.
- Specified by:
resizein interfacePicture- See Also:
Picture.resize(double, double)
-
resize
public void resize(double scale)
Reset the image to the original size.Please note, that this method works correctly only for workbooks with the default font size (Calibri 11pt for .xlsx). If the default font is changed the resized image can be streched vertically or horizontally.
- Specified by:
resizein interfacePicture- Parameters:
scale- the amount by which image dimensions are multiplied relative to the original size.resize(1.0)sets the original size,resize(0.5)resize to 50% of the original,resize(2.0)resizes to 200% of the original.- See Also:
Picture.resize(double, double)
-
getPreferredSize
public XSSFClientAnchor getPreferredSize()
Calculate the preferred size for this picture.- Specified by:
getPreferredSizein interfacePicture- Returns:
- XSSFClientAnchor with the preferred size for this image
-
getPreferredSize
public XSSFClientAnchor getPreferredSize(double scale)
Calculate the preferred size for this picture.- Parameters:
scale- the amount by which image dimensions are multiplied relative to the original size.- Returns:
- XSSFClientAnchor with the preferred size for this image
-
getPictureData
public XSSFPictureData getPictureData()
Return picture data for this shape- Specified by:
getPictureDatain interfacePicture- Returns:
- picture data for this shape
-
getAnchor
public XSSFAnchor getAnchor()
-
resize
public void resize(double scaleX, double scaleY)Description copied from interface:PictureResize the image.Please note, that this method works correctly only for workbooks with the default font size (Arial 10pt for .xls and Calibri 11pt for .xlsx). If the default font is changed the resized image can be streched vertically or horizontally.
resize(1.0,1.0)keeps the original size,
resize(0.5,0.5)resize to 50% of the original,
resize(2.0,2.0)resizes to 200% of the original.
resize(resizes to the dimension of the embedded image.Double.MAX_VALUE,Double.MAX_VALUE)
-
getPreferredSize
public XSSFClientAnchor getPreferredSize(double scaleX, double scaleY)
Description copied from interface:PictureCalculate the preferred size for this picture.- Specified by:
getPreferredSizein interfacePicture- Parameters:
scaleX- the amount by which image width is multiplied relative to the original width.scaleY- the amount by which image height is multiplied relative to the original height.- Returns:
- ClientAnchor with the preferred size for this image
-
getImageDimension
public java.awt.Dimension getImageDimension()
Description copied from interface:PictureReturn the dimension of the embedded image in pixel- Specified by:
getImageDimensionin interfacePicture- Returns:
- image dimension in pixels
-
getClientAnchor
public XSSFClientAnchor getClientAnchor()
- Specified by:
getClientAnchorin interfacePicture- Returns:
- the anchor that is used by this picture
-
getDrawing
public XSSFDrawing getDrawing()
-
getSheet
public XSSFSheet getSheet()
-
getShapeName
public java.lang.String getShapeName()
- Specified by:
getShapeNamein interfaceShape- Returns:
- the name of this shape
-
getParent
public Shape getParent()
-
isNoFill
public boolean isNoFill()
Description copied from interface:ShapeWhether this shape is not filled with a color
-
setNoFill
public void setNoFill(boolean noFill)
Description copied from interface:ShapeSets whether this shape is filled or transparent.
-
setFillColor
public void setFillColor(int red, int green, int blue)Description copied from interface:ShapeSets the color used to fill this shape using the solid fill pattern.- Specified by:
setFillColorin interfaceShape
-
setLineStyleColor
public void setLineStyleColor(int red, int green, int blue)Description copied from interface:ShapeThe color applied to the lines of this shape.- Specified by:
setLineStyleColorin interfaceShape
-
-