[]
Provides access to the background color and fill pattern of a supported object, such as a cell or range. Use an IInterior instance to configure fill appearance by applying a Color and a Pattern.
worksheet.getRange("A1").setValue("Test");
IInterior interior = worksheet.getRange("A1").getInterior();
interior.setPattern(Pattern.Solid);
interior.setColor(Color.GetBlue());
getColor()intintdoubledoublevoidvoidsetColorIndex(int value) voidsetPattern(Pattern value) voidsetPatternColor(Color value) voidsetPatternColorIndex(int value) voidsetPatternThemeColor(ThemeColor value) voidsetPatternTintAndShade(double value) voidsetThemeColor(ThemeColor value) voidsetTintAndShade(double value) Returns the fill color applied to the interior of the object, such as the background color of a cell or range. Use setColor(Color) to change the returned color.
IRange cell = worksheet.getRange("A1");
cell.getInterior().setColor(Color.GetLightBlue());
Color color = cell.getInterior().getColor();
Color of the represented interior.
IRange cell = worksheet.getRange("A1");
cell.getInterior().setColor(Color.FromArgb(100, 100, 100));
value - The Color of the represented interior.This property returns the interior color as an index value. Use setColorIndex(int) to assign a palette-based interior color, or IRange.getInterior() to access the interior of a cell or range.
IInterior interior = worksheet.getRange("A1").getInterior();
interior.setColorIndex(3);
int colorIndex = interior.getColorIndex();
IInterior interior = worksheet.getRange("A1").getInterior();
interior.setColorIndex(3);
value - The color index of the interior.
IInterior interior = worksheet.getRange("A1").getInterior();
interior.setThemeColor(ThemeColor.Accent1);
ThemeColor themeColor = interior.getThemeColor();
Use a ThemeColor constant to apply one of the workbook theme colors to the interior. The displayed color follows the active workbook theme.
IRange cell = worksheet.getRange("A1");
cell.getInterior().setThemeColor(ThemeColor.Accent1);
value - The theme color to apply to the interior.The valid number is from -1 (darkest) to 1 (lightest). Zero (0) is neutral.
IRange cell = worksheet.getRange("A1");
cell.getInterior().setThemeColor(ThemeColor.Accent1);
cell.getInterior().setTintAndShade(0.5);
double tintAndShade = cell.getInterior().getTintAndShade();
The valid number is from -1 (darkest) to 1 (lightest). Zero (0) is neutral.
IRange cell = worksheet.getRange("A1");
cell.getInterior().setThemeColor(ThemeColor.Accent1);
cell.getInterior().setTintAndShade(0.25);
value - The tint and shade value of the interior color, from -1 (darkest) to 1 (lightest). Zero (0) is neutral.Returns the Pattern applied to the represented interior, such as a cell or range fill. Use setPattern(Pattern) to change the returned pattern.
IRange cell = worksheet.getRange("A1");
cell.getInterior().setPattern(Pattern.LightDown);
Pattern pattern = cell.getInterior().getPattern();
Pattern of the represented interior.Use this method to apply a Pattern to the represented interior, such as a cell or range fill. Use setPatternColor(Color) to specify the color used by the pattern.
IRange cell = worksheet.getRange("A1");
cell.getInterior().setPattern(Pattern.Solid);
cell.getInterior().setPatternColor(Color.GetWhite());
value - The Pattern to apply to the represented interior.Returns the foreground color used by the current Pattern on the represented interior. Use setPatternColor(Color) to change the returned color.
IRange cell = worksheet.getRange("A1");
cell.getInterior().setPattern(Pattern.LightDown);
cell.getInterior().setPatternColor(Color.GetWhite());
Color patternColor = cell.getInterior().getPatternColor();
Color of the pattern for the represented interior.
IRange cell = worksheet.getRange("A1");
cell.getInterior().setPattern(Pattern.LightDown);
cell.getInterior().setPatternColor(Color.FromArgb(100, 100, 100));
value - The Color of the pattern for the represented interior.Use this property to read the palette-based color index applied to the current interior pattern. The returned value can also be a special value from ColorDataIndex, such as ColorDataIndex.Automatic or ColorDataIndex.None.
IInterior interior = worksheet.getRange("A1").getInterior();
interior.setPattern(Pattern.Solid);
interior.setPatternColorIndex(10);
int patternColorIndex = interior.getPatternColorIndex();
ColorDataIndex.Use this property to set the palette-based color index applied to the current interior pattern.
IInterior interior = worksheet.getRange("A1").getInterior();
interior.setPattern(Pattern.Solid);
interior.setPatternColorIndex(10);
value - The color index of the interior pattern in the current color palette, or a special value from ColorDataIndex.Use this property to read the theme color applied to the pattern foreground of the interior. Pattern theme colors are typically used together with a patterned fill.
IRange cell = worksheet.getRange("A1");
cell.getInterior().setPattern(Pattern.LightDown);
cell.getInterior().setPatternThemeColor(ThemeColor.Accent1);
ThemeColor themeColor = cell.getInterior().getPatternThemeColor();
Use this method to assign a ThemeColor to the pattern foreground of the interior fill.
IInterior interior = worksheet.getRange("A1").getInterior();
interior.setPattern(Pattern.Gray25);
interior.setPatternThemeColor(ThemeColor.Accent5);
value - The theme color to apply to the pattern foreground. Must not be null.Use this property to read how the current pattern color is lightened or darkened. The valid number is from -1 (darkest) to 1 (lightest). Zero (0) is neutral.
IRange cell = worksheet.getRange("A1");
cell.getInterior().setPattern(Pattern.LightDown);
cell.getInterior().setPatternThemeColor(ThemeColor.Accent1);
cell.getInterior().setPatternTintAndShade(0.25);
double patternTintAndShade = cell.getInterior().getPatternTintAndShade();
Use this property to set how the current pattern color is lightened or darkened.
IRange cell = worksheet.getRange("A1");
cell.getInterior().setPattern(Pattern.LightDown);
cell.getInterior().setPatternThemeColor(ThemeColor.Accent1);
cell.getInterior().setPatternTintAndShade(0.25);
value - The tint and shade value of the interior pattern, from -1 (darkest) to 1 (lightest). Zero (0) is neutral.Returns the gradient definition for the interior when the pattern is set to Pattern.LinearGradient or Pattern.RectangularGradient. The returned object is an ILinearGradient for a linear gradient pattern or an IRectangularGradient for a rectangular gradient pattern. Returns null if the interior does not use a gradient pattern.
IRange cell = worksheet.getRange("A1");
cell.getInterior().setPattern(Pattern.LinearGradient);
ILinearGradient gradient = (ILinearGradient) cell.getInterior().getGradient();
ILinearGradient or IRectangularGradient depending on the current pattern, or null if no gradient pattern is applied.