Skip to content

Commit

Permalink
doc: add example for solid pattern usage (#1649)
Browse files Browse the repository at this point in the history
Current doc for cell filling could lead to misunderstanding on how to apply a simple fill color
to a cell.

Related to #272
  • Loading branch information
fpaupier committed Apr 11, 2021
1 parent a0b4583 commit ae2d2e5
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions README.md
Expand Up @@ -1604,8 +1604,15 @@ ws.getCell('A2').fill = {
bgColor:{argb:'FF0000FF'}
};

// fill A3 with blue-white-blue gradient from left to right
// fill A3 with solid coral
ws.getCell('A3').fill = {
type: 'pattern',
pattern:'solid',
fgColor:{argb:'F08080'},
};

// fill A4 with blue-white-blue gradient from left to right
ws.getCell('A4').fill = {
type: 'gradient',
gradient: 'angle',
degree: 0,
Expand All @@ -1617,8 +1624,8 @@ ws.getCell('A3').fill = {
};


// fill A4 with red-green gradient from center
ws.getCell('A4').fill = {
// fill A5 with red-green gradient from center
ws.getCell('A5').fill = {
type: 'gradient',
gradient: 'path',
center:{left:0.5,top:0.5},
Expand All @@ -1638,6 +1645,10 @@ ws.getCell('A4').fill = {
| fgColor | N | Specifies the pattern foreground color. Default is black. |
| bgColor | N | Specifies the pattern background color. Default is white. |

Note: If you want to fill a cell using the `solid` pattern, then you don't need to specify `bgColor`.
See example above for cell `A3` with a `solid` pattern and a coral `fgColor`.


**Valid Pattern Types**

* none
Expand Down

0 comments on commit ae2d2e5

Please sign in to comment.