Cell Background Color and Border
| API | Description | Example |
|---|---|---|
| Range.Interior | Property that returns the background management object for the specified range | let range = instance.Application.ActiveSheet.Range("A1"); let interior = range.Interior; |
| Interior.Color | Property that returns or changes the background color of the specified range cf) RGB numeric value corresponding to color must be used | function RGBToInteger(rgbText) { const [r,g,b] = rgbText.match(/\d+/g).map(Number); return r + g * 256 + b * 65536; } let interior = instance.Application.ActiveSheet.Range("A1").Interior; console.log(interior.Color); interior.Color = RGBToInteger("RGB(255,199,206)"); |
| Interior.ColorIndex | Property that returns or changes the background color of the specified range using index method | let interior = instance.Application.ActiveSheet.Range("A1").Interior; console.log(interior.ColorIndex); interior.ColorIndex = 1; |
| Interior.Pattern | Property that returns or changes the background pattern of the specified range | let interior = instance.Application.ActiveSheet.Range("A1").Interior; console.log(interior.Pattern); interior.Pattern = instance.Enums.XlPattern.xlPatternCrissCross; |
| Interior.PatternColor | Property that returns or changes the background pattern color of the specified range cf) RGB numeric value corresponding to color must be used | function RGBToInteger(rgbText) { const [r,g,b] = rgbText.match(/\d+/g).map(Number); return r + g * 256 + b * 65536; } let interior = instance.Application.ActiveSheet.Range("A1").Interior; console.log(interior.PatternColor); interior.PatternColor = RGBToInteger("RGB(255,199,206)"); |
| Interior.PatternColorIndex | Property that returns or changes the background pattern color of the specified range using index method | let interior = instance.Application.ActiveSheet.Range("A1").Interior; console.log(interior.PatternColorIndex); interior.PatternColorIndex = 1; |
| Interior.PatternThemeColor | Property that returns or changes the background pattern theme color of the specified range using index method | let interior = instance.Application.ActiveSheet.Range("A1").Interior; console.log(interior.PatternThemeColor); interior.PatternThemeColor = 1; |
| Interior.PatternTintAndShade | Property that returns or changes the brightness of the background pattern of the specified range | let interior = instance.Application.ActiveSheet.Range("A1").Interior; console.log(interior.PatternTintAndShade); interior.PatternTintAndShade = 0.3; |
| Interior.ThemeColor | Property that returns or changes the background theme color of the specified range using index method | let interior = instance.Application.ActiveSheet.Range("A1").Interior; console.log(interior.ThemeColor); interior.ThemeColor = 1; |
| Interior.TintAndShade | Property that returns or changes the brightness of the background of the specified range | let interior = instance.Application.ActiveSheet.Range("A1").Interior; console.log(interior.TintAndShade); interior.TintAndShade = 0.3; |
| Range.Borders | Property that returns the border management object for the specified range | let range = instance.Application.ActiveSheet.Range("A1"); let borders = range.Borders; |
| Borders.Color | Property that returns or changes the outer border color of the specified range cf) RGB numeric value corresponding to color must be used | function RGBToInteger(rgbText) { const [r,g,b] = rgbText.match(/\d+/g).map(Number); return r + g * 256 + b * 65536; } let borders = instance.Application.ActiveSheet.Range("A1").Borders; console.log(borders.Color); borders.Color = RGBToInteger("RGB(255,199,206)"); |
| Borders.ColorIndex | Property that returns or changes the outer border color of the specified range using index method | let borders = instance.Application.ActiveSheet.Range("A1").Borders; console.log(borders.ColorIndex); borders.ColorIndex = 1; |
| Borders.Count | Property that returns the number of borders for the specified range | let borders = instance.Application.ActiveSheet.Range("A1").Borders; console.log(borders.Count); |
| Borders.LineStyle | Property that returns or changes the outer border type of the specified range | let borders = instance.Application.ActiveSheet.Range("A1").Borders; console.log(borders.LineStyle); borders.LineStyle = instance.Enums.XlLineStyle.xlContinuous; |
| Borders.ThemeColor | Property that returns or changes the outer border theme color of the specified range using index method | let borders = instance.Application.ActiveSheet.Range("A1").Borders; console.log(borders.ThemeColor); borders.ThemeColor = 1; |
| Borders.TintAndShade | Property that returns or changes the brightness of the outer border of the specified range | let borders = instance.Application.ActiveSheet.Range("A1").Borders; console.log(borders.TintAndShade); borders.TintAndShade = 0.3; |
| Borders.Value | Property that returns or changes the outer border type of the specified range | let borders = instance.Application.ActiveSheet.Range("A1").Borders; console.log(borders.Value); borders.Value = instance.Enums.XlLineStyle.xlContinuous; |
| Borders.Weight | Property that returns or changes the thickness of the outer border of the specified range | let borders = instance.Application.ActiveSheet.Range("A1").Borders; console.log(borders.Weight); borders.Weight = instance.Enums.XlBorderWeight.xlThick; |
| Borders.Item | Function that returns the border object corresponding to a specific index of the specified range | let borders = instance.Application.ActiveSheet.Range("A1").Borders; let border = borders.Item(instance.Enums.XlBordersIndex.xlEdgeBottom); |
| Border.Color | Property that returns or changes the border color of the specified range cf) RGB numeric value corresponding to color must be used | function RGBToInteger(rgbText) { const [r,g,b] = rgbText.match(/\d+/g).map(Number); return r + g * 256 + b * 65536; } let range = instance.Application.ActiveSheet.Range("A1"); let border = range.Borders.Item(instance.Enums.XlBordersIndex.xlEdgeBottom); console.log(border.Color); border.Color = RGBToInteger("RGB(255,199,206)"); |
| Border.ColorIndex | Property that returns or changes the border color of the specified range using index method | let range = instance.Application.ActiveSheet.Range("A1"); let border = range.Borders.Item(instance.Enums.XlBordersIndex.xlEdgeBottom); console.log(border.ColorIndex); border.ColorIndex = 1; |
| Border.LineStyle | Property that returns or changes the border type of the specified range | let range = instance.Application.ActiveSheet.Range("A1"); let border = range.Borders.Item(instance.Enums.XlBordersIndex.xlEdgeBottom); console.log(border.LineStyle); border.LineStyle = instance.Enums.XlLineStyle.xlContinuous; |
| Border.ThemeColor | Property that returns or changes the border theme color of the specified range using index method | let range = instance.Application.ActiveSheet.Range("A1"); let border = range.Borders.Item(instance.Enums.XlBordersIndex.xlEdgeBottom); console.log(border.ThemeColor); border.ThemeColor = 1; |
| Border.TintAndShade | Property that returns or changes the brightness of the border of the specified range | let range = instance.Application.ActiveSheet.Range("A1"); let border = range.Borders.Item(instance.Enums.XlBordersIndex.xlEdgeBottom); console.log(border.TintAndShade); border.TintAndShade = 0.3; |
| Border.Weight | Property that returns or changes the thickness of the border of the specified range | let range = instance.Application.ActiveSheet.Range("A1"); let border = range.Borders.Item(instance.Enums.XlBordersIndex.xlEdgeBottom); console.log(border.Weight); border.Weight = instance.Enums.XlBorderWeight.xlThick; |
| Range.BorderAround | Function that specifies a border around the specified range | let range = instance.Application.ActiveSheet.UsedRange; let enums = instance.Enums; range.BorderAround({ LineStyle: enums.XlLineStyle.xlDash, Weight: enums.XlBorderWeight.xlThin }); |
Related Features
Format Management , Font Style , Text Alignment and Line Breaks , Conditional Formatting , Custom Formatting , Formatting Rendering Overview