[]
        
(Showing Draft Content)

IGradientStop

Interface IGradientStop


public interface IGradientStop
Represents a single stop in a gradient.

A gradient stop defines one point in the gradient transition, including its color, position, and transparency. Use IFillFormat.getGradientStops() to access the stops in a gradient fill and adjust each IGradientStop to refine the gradient effect.


 IShape shape = worksheet.getShapes().addShape(AutoShapeType.Rectangle, 50, 50, 120, 60);
 shape.getFill().twoColorGradient(GradientStyle.Horizontal, 1);
 IGradientStop gradientStop = shape.getFill().getGradientStops().get(0);
 gradientStop.setPosition(0.25);
 gradientStop.setTransparency(0.2);
 
  • Method Summary

    Modifier and Type
    Method
    Description
    Gets the color of the gradient stop.
    double
    Gets the position of the gradient stop.
    double
    Gets a value that represents the opacity of the gradient fill expressed as a percent.
    void
    setPosition(double value)
    Sets the position of the gradient stop.
    void
    setTransparency(double value)
    Sets a value that represents the opacity of the gradient fill expressed as a percent.
  • Method Details

    • getColor

      IColorFormat getColor()
      Gets the color of the gradient stop.

      The returned IColorFormat object represents the color settings for this gradient stop and can be used to inspect or modify the stop color after a gradient is created with IFillFormat.twoColorGradient(GradientStyle,int).

      
       IShape shape = worksheet.getShapes().addShape(AutoShapeType.Rectangle, 20, 20, 120, 80);
       IFillFormat fill = shape.getFill();
       fill.twoColorGradient(GradientStyle.Horizontal, 1);
       IGradientStop stop = fill.getGradientStops().get(0);
       IColorFormat color = stop.getColor();
       color.setRGB(Color.GetRed());
       
      Returns:
      The IColorFormat object that represents the color of the gradient stop.
    • getPosition

      double getPosition()
      Gets the position of the gradient stop.

      The position determines where this stop is placed within the gradient definition.

      
       IShape shape = worksheet.getShapes().addShape(AutoShapeType.Rectangle, 20, 20, 120, 80);
       IFillFormat fill = shape.getFill();
       fill.twoColorGradient(GradientStyle.Horizontal, 1);
       IGradientStop stop = fill.getGradientStops().get(0);
       double position = stop.getPosition();
       
      Returns:
      The position of the gradient stop.
    • setPosition

      void setPosition(double value)
      Sets the position of the gradient stop.

      The position determines where this stop is placed within the gradient definition.

      
       IShape shape = worksheet.getShapes().addShape(AutoShapeType.Rectangle, 20, 20, 120, 80);
       IFillFormat fill = shape.getFill();
       fill.twoColorGradient(GradientStyle.Horizontal, 1);
       IGradientStop stop = fill.getGradientStops().get(0);
       stop.setPosition(100.0);
       
      Parameters:
      value - The position of the gradient stop.
    • getTransparency

      double getTransparency()
      Gets a value that represents the opacity of the gradient fill expressed as a percent.

      This value indicates the transparency setting applied at the current gradient stop.

      
       IShape shape = worksheet.getShapes().addShape(AutoShapeType.Rectangle, 20, 20, 120, 80);
       IFillFormat fill = shape.getFill();
       fill.twoColorGradient(GradientStyle.Horizontal, 1);
       IGradientStop stop = fill.getGradientStops().get(0);
       double transparency = stop.getTransparency();
       
      Returns:
      The transparency value of the gradient stop, expressed as a percentage.
    • setTransparency

      void setTransparency(double value)
      Sets a value that represents the opacity of the gradient fill expressed as a percent.

      This value indicates the transparency setting applied at the current gradient stop.

      
       IShape shape = worksheet.getShapes().addShape(AutoShapeType.Rectangle, 20, 20, 120, 80);
       IFillFormat fill = shape.getFill();
       fill.twoColorGradient(GradientStyle.Horizontal, 1);
       IGradientStop stop = fill.getGradientStops().get(0);
       stop.setTransparency(100.0);
       
      Parameters:
      value - The transparency value of the gradient stop, expressed as a percentage.