[]
        
(Showing Draft Content)

IPictureFormat

Interface IPictureFormat


public interface IPictureFormat
Represents picture formatting options for a shape.

This interface provides access to picture-specific properties such as brightness, contrast, transparency, color transformation, cropping, image data, and linked picture settings. An IPictureFormat object is typically obtained from IShape.getPictureFormat() and applies to both regular pictures and linked pictures.


 worksheet.getRange("A1:B2").setValue(new Object[][] {
     {"Name", "Value"},
     {"Test", 100}
 });
 IShape picture = worksheet.getShapes().addCameraPicture("=$A$1:$B$2", 20, 20);
 IPictureFormat pictureFormat = picture.getPictureFormat();
 pictureFormat.setTransparentBackground(true);
 pictureFormat.setTransparency(0.5);
 
  • Method Summary

    Modifier and Type
    Method
    Description
    double
    Gets the brightness of the specified picture or OLE object.
    Gets the type of color transformation applied to the specified picture.
    double
    Gets the contrast for the specified picture or OLE object.
    Gets the ICrop object that represents the cropping settings for the specified IPictureFormat object.
    double
    Gets the number of points that are cropped off the bottom of the specified picture.
    double
    Gets the number of points that are cropped off the left side of the specified picture.
    double
    Gets the number of points that are cropped off the right side of the specified picture.
    double
    Gets the number of points that are cropped off the top of the specified picture.
    byte[]
    Gets the byte array of the specified picture.
    Gets the reference of the current picture.
    double
    Gets the degree of transparency of the specified picture.
    boolean
    Gets whether the specified picture format uses a transparent background.
    Gets the image type of the specified picture.
    Gets the URL of the picture from JSON.
    void
    setBrightness(double value)
    Sets the brightness of the specified picture or OLE object.
    void
    Sets the type of color transformation applied to the specified picture.
    void
    setContrast(double value)
    Sets the contrast for the specified picture or OLE object.
    void
    setCropBottom(double value)
    Sets the number of points that are cropped off the bottom of the specified picture.
    void
    setCropLeft(double value)
    Sets the number of points that are cropped off the left side of the specified picture.
    void
    setCropRight(double value)
    Sets the number of points that are cropped off the right side of the specified picture.
    void
    setCropTop(double value)
    Sets the number of points that are cropped off the top of the specified picture.
    void
    setFill(byte[] bytes)
    Sets the byte array of the specified picture.
    void
    Sets the reference of the current picture.
    void
    setTransparency(double value)
    Sets the degree of transparency of the specified picture.
    void
    setTransparentBackground(boolean value)
    Sets whether the specified picture format uses a transparent background.
  • Method Details

    • getBrightness

      double getBrightness()
      Gets the brightness of the specified picture or OLE object.

      The returned value is a number from 0.0 (dimmest) to 1.0 (brightest).

      
       worksheet.getRange("A1:B2").setValue(new Object[][] {
           {"Name", "Value"},
           {"Test", 100}
       });
       IShape picture = worksheet.getShapes().addCameraPicture("=$A$1:$B$2", 20, 20);
       picture.getPictureFormat().setBrightness(0.6);
       double brightness = picture.getPictureFormat().getBrightness();
       
      Returns:
      The brightness of the specified picture or OLE object, from 0.0 (dimmest) to 1.0 (brightest).
    • setBrightness

      void setBrightness(double value)
      Sets the brightness of the specified picture or OLE object.

      The returned value is a number from 0.0 (dimmest) to 1.0 (brightest).

      
       worksheet.getRange("A1:B2").setValue(new Object[][] {
           {"Name", "Value"},
           {"Test", 100}
       });
       IShape picture = worksheet.getShapes().addCameraPicture("=$A$1:$B$2", 20, 20);
       picture.getPictureFormat().setBrightness(0.6);
       
      Parameters:
      value - The brightness of the specified picture or OLE object, from 0.0 (dimmest) to 1.0 (brightest).
    • getColorType

      PictureColorType getColorType()
      Gets the type of color transformation applied to the specified picture.

      The returned value indicates whether the picture uses the default color transformation or a specific transformation such as PictureColorType.Grayscale, PictureColorType.BlackAndWhite, or PictureColorType.Watermark.

      
       worksheet.getRange("A1:B2").setValue(new Object[][] {
           {"Name", "Value"},
           {"Test", 100}
       });
       IShape picture = worksheet.getShapes().addCameraPicture("=$A$1:$B$2", 20, 20);
       picture.getPictureFormat().setColorType(PictureColorType.Grayscale);
       PictureColorType colorType = picture.getPictureFormat().getColorType();
       
      Returns:
      The type of color transformation applied to the specified picture.
    • setColorType

      void setColorType(PictureColorType value)
      Sets the type of color transformation applied to the specified picture.

      Use this method to apply a predefined picture color transformation such as PictureColorType.Grayscale, PictureColorType.BlackAndWhite, or PictureColorType.Watermark.

      
       worksheet.getRange("A1:B2").setValue(new Object[][] {
           {"Name", "Value"},
           {"Test", 100}
       });
       IShape picture = worksheet.getShapes().addCameraPicture("=$A$1:$B$2", 20, 20);
       IPictureFormat pictureFormat = picture.getPictureFormat();
       pictureFormat.setColorType(PictureColorType.Grayscale);
       
      Parameters:
      value - The color transformation type to apply to the picture.
    • getContrast

      double getContrast()
      Gets the contrast for the specified picture or OLE object.

      The returned value is a number from 0.0 (the least contrast) to 1.0 (the greatest contrast).

      
       worksheet.getRange("A1:B2").setValue(new Object[][] {
           {"Name", "Value"},
           {"Test", 100}
       });
       IShape picture = worksheet.getShapes().addCameraPicture("=$A$1:$B$2", 20, 20);
       picture.getPictureFormat().setContrast(0.6);
       double contrast = picture.getPictureFormat().getContrast();
       
      Returns:
      The contrast of the specified picture or OLE object, from 0.0 (the least contrast) to 1.0 (the greatest contrast).
    • setContrast

      void setContrast(double value)
      Sets the contrast for the specified picture or OLE object.

      The returned value is a number from 0.0 (the least contrast) to 1.0 (the greatest contrast).

      
       worksheet.getRange("A1:B2").setValue(new Object[][] {
           {"Name", "Value"},
           {"Test", 100}
       });
       IShape picture = worksheet.getShapes().addCameraPicture("=$A$1:$B$2", 20, 20);
       picture.getPictureFormat().setContrast(0.6);
       
      Parameters:
      value - The contrast of the specified picture or OLE object, from 0.0 (the least contrast) to 1.0 (the greatest contrast).
    • getCrop

      ICrop getCrop()
      Gets the ICrop object that represents the cropping settings for the specified IPictureFormat object.

      Use the returned object to access or modify image cropping properties such as the source image size, image offsets, and the visible area of the picture.

      
       IShape picture = worksheet.getShapes().addCameraPicture("=$A$1:$B$2", 20, 20);
       IPictureFormat pictureFormat = picture.getPictureFormat();
       ICrop crop = pictureFormat.getCrop();
       crop.setPictureOffsetX(10);
       
      Returns:
      The ICrop object that represents the cropping settings for the specified IPictureFormat object.
    • getCropBottom

      double getCropBottom()
      Gets the number of points that are cropped off the bottom of the specified picture.

      Use this property to determine how much of the source image is hidden from the bottom edge of the picture.

      
       worksheet.getRange("A1:B2").setValue(new Object[][] {
           {"Name", "Value"},
           {"Test", 100}
       });
       IShape picture = worksheet.getShapes().addCameraPicture("=$A$1:$B$2", 20, 20);
       picture.getPictureFormat().setCropBottom(8);
       double cropBottom = picture.getPictureFormat().getCropBottom();
       
      Returns:
      The number of points that are cropped off the bottom of the specified picture.
    • setCropBottom

      void setCropBottom(double value)
      Sets the number of points that are cropped off the bottom of the specified picture.

      Use this property to set how much of the source image is hidden from the bottom edge of the picture.

      
       worksheet.getRange("A1:B2").setValue(new Object[][] {
           {"Name", "Value"},
           {"Test", 100}
       });
       IShape picture = worksheet.getShapes().addCameraPicture("=$A$1:$B$2", 20, 20);
       picture.getPictureFormat().setCropBottom(8);
       picture.getPictureFormat().setCropBottom(100.0);
       
      Parameters:
      value - The number of points that are cropped off the bottom of the specified picture.
    • getCropLeft

      double getCropLeft()
      Gets the number of points that are cropped off the left side of the specified picture.

      Use this property to determine how much of the source image is hidden from the left edge of the picture.

      
       worksheet.getRange("A1:B2").setValue(new Object[][] {
           {"Name", "Value"},
           {"Test", 100}
       });
       IShape picture = worksheet.getShapes().addCameraPicture("=$A$1:$B$2", 20, 20);
       picture.getPictureFormat().setCropLeft(8);
       double cropLeft = picture.getPictureFormat().getCropLeft();
       
      Returns:
      The number of points that are cropped off the left side of the specified picture.
    • setCropLeft

      void setCropLeft(double value)
      Sets the number of points that are cropped off the left side of the specified picture.

      Use this property to set how much of the source image is hidden from the left edge of the picture.

      
       worksheet.getRange("A1:B2").setValue(new Object[][] {
           {"Name", "Value"},
           {"Test", 100}
       });
       IShape picture = worksheet.getShapes().addCameraPicture("=$A$1:$B$2", 20, 20);
       picture.getPictureFormat().setCropLeft(8);
       picture.getPictureFormat().setCropLeft(100.0);
       
      Parameters:
      value - The number of points that are cropped off the left side of the specified picture.
    • getCropRight

      double getCropRight()
      Gets the number of points that are cropped off the right side of the specified picture.

      Use this method to retrieve the current right-side crop amount that was applied to the picture format, such as through setCropRight(double).

      
       worksheet.getRange("A1:B2").setValue(new Object[][] {
           {"Name", "Value"},
           {"Test", 100}
       });
       IShape picture = worksheet.getShapes().addCameraPicture("=$A$1:$B$2", 20, 20);
       IPictureFormat pictureFormat = picture.getPictureFormat();
       pictureFormat.setCropRight(12);
       double cropRight = pictureFormat.getCropRight();
       
      Returns:
      The number of points that are cropped off the right side of the specified picture.
    • setCropRight

      void setCropRight(double value)
      Sets the number of points that are cropped off the right side of the specified picture.
      
       worksheet.getRange("A1:B2").setValue(new Object[][] {
           {"Name", "Value"},
           {"Test", 100}
       });
       IShape picture = worksheet.getShapes().addCameraPicture("=$A$1:$B$2", 20, 20);
       IPictureFormat pictureFormat = picture.getPictureFormat();
       pictureFormat.setCropRight(12);
       
      Parameters:
      value - The number of points that are cropped off the right side of the specified picture.
    • getCropTop

      double getCropTop()
      Gets the number of points that are cropped off the top of the specified picture.

      Use setCropTop(double) to change this cropping value.

      
       worksheet.getRange("A1:B2").setValue(new Object[][] {{"Name", "Value"}, {"Test", 100}});
       IShape picture = worksheet.getShapes().addCameraPicture("=$A$1:$B$2", 20, 20);
       IPictureFormat pictureFormat = picture.getPictureFormat();
       pictureFormat.setCropTop(10);
       double cropTop = pictureFormat.getCropTop();
       
      Returns:
      The number of points that are cropped off the top of the picture.
    • setCropTop

      void setCropTop(double value)
      Sets the number of points that are cropped off the top of the specified picture.
      
       worksheet.getRange("A1:B2").setValue(new Object[][] {{"Name", "Value"}, {"Test", 100}});
       IShape picture = worksheet.getShapes().addCameraPicture("=$A$1:$B$2", 20, 20);
       IPictureFormat pictureFormat = picture.getPictureFormat();
       pictureFormat.setCropTop(10);
       
      Parameters:
      value - The number of points that are cropped off the top of the picture.
    • getFill

      byte[] getFill()
      Gets the byte array of the specified picture.

      Use setFill(byte[]) to replace the picture data.

      
       worksheet.getRange("A1:B2").setValue(new Object[][] {{"Name", "Value"}, {"Test", 100}});
       IShape picture = worksheet.getShapes().addCameraPicture("=$A$1:$B$2", 20, 20);
       IPictureFormat pictureFormat = picture.getPictureFormat();
       byte[] pictureBytes = pictureFormat.getFill();
       
      Returns:
      The byte array of the specified picture.
    • setFill

      void setFill(byte[] bytes)
      Sets the byte array of the specified picture.
      
       worksheet.getRange("A1:B2").setValue(new Object[][] {{"Name", "Value"}, {"Test", 100}});
       IShape picture = worksheet.getShapes().addCameraPicture("=$A$1:$B$2", 20, 20);
       IPictureFormat pictureFormat = picture.getPictureFormat();
       pictureFormat.setFill(value);
       
      Parameters:
      bytes - The byte array of the specified picture.
    • getType

      ImageType getType()
      Gets the image type of the specified picture.

      Use this method to determine the picture format, such as PNG, JPG, or SVG, for a picture shape.

      
       worksheet.getRange("A1:B2").setValue(new Object[][] {{"Name", "Value"}, {"Test", 100}});
       IShape picture = worksheet.getShapes().addCameraPicture("=$A$1:$B$2", 20, 20);
       IPictureFormat pictureFormat = picture.getPictureFormat();
       ImageType type = pictureFormat.getType();
       
      Returns:
      The image type of the specified picture.
    • getTransparency

      double getTransparency()
      Gets the degree of transparency of the specified picture.

      The returned value ranges from 0.0 for a fully opaque picture to 1.0 for a fully clear picture.

      
       worksheet.getRange("A1:B2").setValue(new Object[][] {{"Name", "Value"}, {"Test", 100}});
       IShape picture = worksheet.getShapes().addCameraPicture("=$A$1:$B$2", 20, 20);
       IPictureFormat pictureFormat = picture.getPictureFormat();
       pictureFormat.setTransparency(0.25);
       double transparency = pictureFormat.getTransparency();
       
      Returns:
      The degree of transparency of the specified picture, from 0.0 for fully opaque to 1.0 for fully clear.
    • setTransparency

      void setTransparency(double value)
      Sets the degree of transparency of the specified picture.

      The returned value ranges from 0.0 for a fully opaque picture to 1.0 for a fully clear picture.

      
       worksheet.getRange("A1:B2").setValue(new Object[][] {{"Name", "Value"}, {"Test", 100}});
       IShape picture = worksheet.getShapes().addCameraPicture("=$A$1:$B$2", 20, 20);
       IPictureFormat pictureFormat = picture.getPictureFormat();
       pictureFormat.setTransparency(0.25);
       
      Parameters:
      value - The degree of transparency of the specified picture, from 0.0 for fully opaque to 1.0 for fully clear.
    • getUrl

      String getUrl()
      Gets the URL of the picture from JSON.
      
       worksheet.getRange("A1:B2").setValue(new Object[][] {{"Name", "Value"}, {"Test", 100}});
       IShape picture = worksheet.getShapes().addCameraPicture("=$A$1:$B$2", 20, 20);
       IPictureFormat pictureFormat = picture.getPictureFormat();
       String url = pictureFormat.getUrl();
       
      Returns:
      The URL of the picture from JSON.
    • getReference

      String getReference()
      Gets the reference of the current picture.

      For a linked picture created from a cell range, the returned string identifies the source reference used by the picture.

      
       worksheet.getRange("A1:B2").setValue(new Object[][] {{"Name", "Value"}, {"Test", 100}});
       IShape picture = worksheet.getShapes().addCameraPicture("=$A$1:$B$2", 20, 20);
       IPictureFormat pictureFormat = picture.getPictureFormat();
       String reference = pictureFormat.getReference();
       
      Returns:
      The reference string of the current picture.
    • setReference

      void setReference(String value)
      Sets the reference of the current picture.

      For a linked picture created from a cell range, the returned string identifies the source reference used by the picture.

      
       worksheet.getRange("A1:B2").setValue(new Object[][] {{"Name", "Value"}, {"Test", 100}});
       IShape picture = worksheet.getShapes().addCameraPicture("=$A$1:$B$2", 20, 20);
       IPictureFormat pictureFormat = picture.getPictureFormat();
       pictureFormat.setReference("=$A$1");
       
      Parameters:
      value - The reference string of the current picture.
    • getTransparentBackground

      boolean getTransparentBackground()
      Gets whether the specified picture format uses a transparent background.
      
       worksheet.getRange("A1:B2").setValue(new Object[][] {{"Name", "Value"}, {"Test", 100}});
       IShape picture = worksheet.getShapes().addCameraPicture("=$A$1:$B$2", 20, 20);
       IPictureFormat pictureFormat = picture.getPictureFormat();
       pictureFormat.setTransparentBackground(true);
       boolean transparentBackground = pictureFormat.getTransparentBackground();
       
      Returns:
      true if the picture format uses a transparent background; otherwise, false.
    • setTransparentBackground

      void setTransparentBackground(boolean value)
      Sets whether the specified picture format uses a transparent background.
      
       worksheet.getRange("A1:B2").setValue(new Object[][] {{"Name", "Value"}, {"Test", 100}});
       IShape picture = worksheet.getShapes().addCameraPicture("=$A$1:$B$2", 20, 20);
       IPictureFormat pictureFormat = picture.getPictureFormat();
       pictureFormat.setTransparentBackground(true);
       
      Parameters:
      value - true if the picture format uses a transparent background; otherwise, false.