Skip to content

Commit ae2d2e5

Browse files
authored
doc: add example for solid pattern usage (#1649)
Current doc for cell filling could lead to misunderstanding on how to apply a simple fill color to a cell. Related to #272
1 parent a0b4583 commit ae2d2e5

File tree

1 file changed

+14
-3
lines changed

1 file changed

+14
-3
lines changed

README.md

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1604,8 +1604,15 @@ ws.getCell('A2').fill = {
16041604
bgColor:{argb:'FF0000FF'}
16051605
};
16061606

1607-
// fill A3 with blue-white-blue gradient from left to right
1607+
// fill A3 with solid coral
16081608
ws.getCell('A3').fill = {
1609+
type: 'pattern',
1610+
pattern:'solid',
1611+
fgColor:{argb:'F08080'},
1612+
};
1613+
1614+
// fill A4 with blue-white-blue gradient from left to right
1615+
ws.getCell('A4').fill = {
16091616
type: 'gradient',
16101617
gradient: 'angle',
16111618
degree: 0,
@@ -1617,8 +1624,8 @@ ws.getCell('A3').fill = {
16171624
};
16181625

16191626

1620-
// fill A4 with red-green gradient from center
1621-
ws.getCell('A4').fill = {
1627+
// fill A5 with red-green gradient from center
1628+
ws.getCell('A5').fill = {
16221629
type: 'gradient',
16231630
gradient: 'path',
16241631
center:{left:0.5,top:0.5},
@@ -1638,6 +1645,10 @@ ws.getCell('A4').fill = {
16381645
| fgColor | N | Specifies the pattern foreground color. Default is black. |
16391646
| bgColor | N | Specifies the pattern background color. Default is white. |
16401647

1648+
Note: If you want to fill a cell using the `solid` pattern, then you don't need to specify `bgColor`.
1649+
See example above for cell `A3` with a `solid` pattern and a coral `fgColor`.
1650+
1651+
16411652
**Valid Pattern Types**
16421653

16431654
* none

0 commit comments

Comments
 (0)