org.apache.poi.xssf.streaming
Class SXSSFPicture

java.lang.Object
  extended by org.apache.poi.xssf.streaming.SXSSFPicture
All Implemented Interfaces:
Picture, Shape

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
 XSSFAnchor getAnchor()
           
 XSSFClientAnchor getClientAnchor()
           
 org.openxmlformats.schemas.drawingml.x2006.spreadsheetDrawing.CTPicture getCTPicture()
          Return the underlying CTPicture bean that holds all properties for this picture
 XSSFDrawing getDrawing()
           
 java.awt.Dimension getImageDimension()
          Return the dimension of the embedded image in pixel
protected static java.awt.Dimension getImageDimension(PackagePart part, int type)
          Return the dimension of this image
 Shape getParent()
           
 XSSFPictureData getPictureData()
          Return picture data for this shape
 XSSFClientAnchor 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()
           
protected  org.openxmlformats.schemas.drawingml.x2006.main.CTShapeProperties getShapeProperties()
           
 XSSFSheet getSheet()
           
 boolean isNoFill()
          Whether this shape is not filled with a color
 void 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.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getCTPicture

@Internal
public org.openxmlformats.schemas.drawingml.x2006.spreadsheetDrawing.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 interface Picture
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 interface Picture
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 interface Picture
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

getImageDimension

protected static java.awt.Dimension getImageDimension(PackagePart part,
                                                      int type)
Return the dimension of this image

Parameters:
part - the package part holding raw picture data
type - type of the picture: Workbook.PICTURE_TYPE_JPEG, Workbook.PICTURE_TYPE_PNG or Workbook.PICTURE_TYPE_DIB
Returns:
image dimension in pixels

getPictureData

public XSSFPictureData getPictureData()
Return picture data for this shape

Specified by:
getPictureData in interface Picture
Returns:
picture data for this shape

getShapeProperties

protected org.openxmlformats.schemas.drawingml.x2006.main.CTShapeProperties getShapeProperties()

getAnchor

public XSSFAnchor getAnchor()
Specified by:
getAnchor in interface Shape
Returns:
the anchor that is used by this shape.

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(Double.MAX_VALUE,Double.MAX_VALUE) resizes to the dimension of the embedded image.

Specified by:
resize in interface Picture
Parameters:
scaleX - the amount by which the image width is multiplied relative to the original width.
scaleY - the amount by which the image height is multiplied relative to the original height.

getPreferredSize

public XSSFClientAnchor getPreferredSize(double scaleX,
                                         double scaleY)
Description copied from interface: Picture
Calculate the preferred size for this picture.

Specified by:
getPreferredSize in interface Picture
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 interface Picture
Returns:
image dimension in pixels

getClientAnchor

public XSSFClientAnchor getClientAnchor()
Specified by:
getClientAnchor in interface Picture
Returns:
the anchor that is used by this picture

getDrawing

public XSSFDrawing getDrawing()

getSheet

public XSSFSheet getSheet()
Specified by:
getSheet in interface Picture
Returns:
the sheet which contains the picture

getShapeName

public java.lang.String getShapeName()
Specified by:
getShapeName in interface Shape
Returns:
the name of this shape

getParent

public Shape getParent()
Specified by:
getParent in interface Shape
Returns:
the parent shape.

isNoFill

public boolean isNoFill()
Description copied from interface: Shape
Whether this shape is not filled with a color

Specified by:
isNoFill in interface Shape
Returns:
true if 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.

Specified by:
setNoFill in interface Shape
Parameters:
noFill - if true then no fill will be applied to the shape element.

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 interface Shape

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 interface Shape


Copyright 2017 The Apache Software Foundation or its licensors, as applicable.