[]
The IRectangularGradient object transitions through a series of colors within a rectangular gradient fill. Use this interface to configure the gradient convergence points at the left, top, right, and bottom edges and to manage the gradient IColorStops.
IRange cell = worksheet.getRange("A1");
cell.getInterior().setPattern(Pattern.RectangularGradient);
IRectangularGradient gradient = (IRectangularGradient) cell.getInterior().getGradient();
gradient.setLeft(0.1);
gradient.setTop(0.2);
gradient.setRight(0.9);
gradient.setBottom(0.8);
doubledoublegetLeft()doublegetRight()doublegetTop()voidsetBottom(double value) voidsetLeft(double value) voidsetRight(double value) voidsetTop(double value) Returns the IColorStops collection for the IRectangularGradient object. The returned collection contains the IColorStop objects that define the colors and positions used by the gradient fill.
worksheet.getRange("A1").getInterior().setPattern(Pattern.RectangularGradient);
IRectangularGradient gradient = (IRectangularGradient) worksheet.getRange("A1").getInterior().getGradient();
IColorStops colorStops = gradient.getColorStops();
colorStops.get(0).setColor(Color.FromArgb(255, 0, 0));
colorStops.get(1).setColor(Color.FromArgb(0, 255, 0));
IColorStops collection for this rectangular gradient.Use this property to read the bottom convergence setting of a rectangular gradient fill.
IRange cell = worksheet.getRange("A1");
cell.getInterior().setPattern(Pattern.RectangularGradient);
IRectangularGradient gradient = (IRectangularGradient) cell.getInterior().getGradient();
gradient.setBottom(0.8);
double bottom = gradient.getBottom();
Use this property to set the bottom convergence setting of a rectangular gradient fill.
IRange cell = worksheet.getRange("A1");
cell.getInterior().setPattern(Pattern.RectangularGradient);
IRectangularGradient gradient = (IRectangularGradient) cell.getInterior().getGradient();
gradient.setBottom(0.8);
value - The convergence position of the rectangular gradient fill at the bottom.Use this property to read the left-side convergence setting of a rectangular gradient fill.
IRange cell = worksheet.getRange("A1");
cell.getInterior().setPattern(Pattern.RectangularGradient);
IRectangularGradient gradient = (IRectangularGradient) cell.getInterior().getGradient();
gradient.setLeft(0.2);
double left = gradient.getLeft();
Use this property to set the left-side convergence setting of a rectangular gradient fill.
IRange cell = worksheet.getRange("A1");
cell.getInterior().setPattern(Pattern.RectangularGradient);
IRectangularGradient gradient = (IRectangularGradient) cell.getInterior().getGradient();
gradient.setLeft(0.2);
value - The convergence position of the rectangular gradient fill at the left.This value controls the right-side convergence position of a rectangular gradient fill.
IRange cell = worksheet.getRange("A1");
cell.getInterior().setPattern(Pattern.RectangularGradient);
IRectangularGradient gradient = (IRectangularGradient) cell.getInterior().getGradient();
gradient.setRight(0.3);
double right = gradient.getRight();
This value controls the right-side convergence position of a rectangular gradient fill.
IRange cell = worksheet.getRange("A1");
cell.getInterior().setPattern(Pattern.RectangularGradient);
IRectangularGradient gradient = (IRectangularGradient) cell.getInterior().getGradient();
gradient.setRight(0.3);
value - The convergence position of the rectangular gradient fill at the right.Use this property to read the top convergence setting of a rectangular gradient fill.
IRange cell = worksheet.getRange("A1");
cell.getInterior().setPattern(Pattern.RectangularGradient);
IRectangularGradient gradient = (IRectangularGradient) cell.getInterior().getGradient();
gradient.setTop(0.2);
double top = gradient.getTop();
Use this property to set the top convergence setting of a rectangular gradient fill.
IRange cell = worksheet.getRange("A1");
cell.getInterior().setPattern(Pattern.RectangularGradient);
IRectangularGradient gradient = (IRectangularGradient) cell.getInterior().getGradient();
gradient.setTop(0.2);
value - The convergence position of the rectangular gradient fill at the top.