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 XSSFAnchor
getAnchor()
XSSFClientAnchor
getClientAnchor()
CTPicture
getCTPicture()
Return the underlying CTPicture bean that holds all properties for this pictureXSSFDrawing
getDrawing()
java.awt.Dimension
getImageDimension()
Return the dimension of the embedded image in pixelShape
getParent()
XSSFPictureData
getPictureData()
Return picture data for this shapeXSSFClientAnchor
getPreferredSize()
Calculate the preferred size for this picture.XSSFClientAnchor
getPreferredSize(double scale)
Calculate the preferred size for this picture.XSSFClientAnchor
getPreferredSize(double scaleX, double scaleY)
Calculate the preferred size for this picture.java.lang.String
getShapeName()
XSSFSheet
getSheet()
boolean
isNoFill()
Whether this shape is not filled with a colorvoid
resize()
Reset the image to the original size.void
resize(double scale)
Reset the image to the original size.void
resize(double scaleX, double scaleY)
Resize the image.void
setFillColor(int red, int green, int blue)
Sets the color used to fill this shape using the solid fill pattern.void
setLineStyleColor(int red, int green, int blue)
The color applied to the lines of this shape.void
setNoFill(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:
resize
in 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:
resize
in 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:
getPreferredSize
in 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:
getPictureData
in interfacePicture
- Returns:
- picture data for this shape
-
getAnchor
public XSSFAnchor getAnchor()
-
resize
public void resize(double scaleX, double scaleY)
Description copied from interface:Picture
Resize 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:Picture
Calculate the preferred size for this picture.- Specified by:
getPreferredSize
in 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:Picture
Return the dimension of the embedded image in pixel- Specified by:
getImageDimension
in interfacePicture
- Returns:
- image dimension in pixels
-
getClientAnchor
public XSSFClientAnchor getClientAnchor()
- Specified by:
getClientAnchor
in 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:
getShapeName
in interfaceShape
- Returns:
- the name of this shape
-
getParent
public Shape getParent()
-
isNoFill
public boolean isNoFill()
Description copied from interface:Shape
Whether this shape is not filled with a color
-
setNoFill
public void setNoFill(boolean noFill)
Description copied from interface:Shape
Sets whether this shape is filled or transparent.
-
setFillColor
public void setFillColor(int red, int green, int blue)
Description copied from interface:Shape
Sets the color used to fill this shape using the solid fill pattern.- Specified by:
setFillColor
in interfaceShape
-
setLineStyleColor
public void setLineStyleColor(int red, int green, int blue)
Description copied from interface:Shape
The color applied to the lines of this shape.- Specified by:
setLineStyleColor
in interfaceShape
-
-