2017-03-31 21:46:02 +00:00
|
|
|
### Sheet Objects
|
2017-03-20 09:02:25 +00:00
|
|
|
|
|
|
|
Each key that does not start with `!` maps to a cell (using `A-1` notation)
|
|
|
|
|
2017-03-31 21:46:02 +00:00
|
|
|
`sheet[address]` returns the cell object for the specified address.
|
2017-03-20 09:02:25 +00:00
|
|
|
|
2017-04-30 20:37:53 +00:00
|
|
|
**Special sheet keys (accessible as `sheet[key]`, each starting with `!`):**
|
2017-03-20 09:02:25 +00:00
|
|
|
|
2017-03-31 21:46:02 +00:00
|
|
|
- `sheet['!ref']`: A-1 based range representing the sheet range. Functions that
|
2017-03-20 09:02:25 +00:00
|
|
|
work with sheets should use this parameter to determine the range. Cells that
|
|
|
|
are assigned outside of the range are not processed. In particular, when
|
2017-03-31 21:46:02 +00:00
|
|
|
writing a sheet by hand, cells outside of the range are not included
|
2017-03-20 09:02:25 +00:00
|
|
|
|
2017-03-31 21:46:02 +00:00
|
|
|
Functions that handle sheets should test for the presence of `!ref` field.
|
2017-03-20 09:02:25 +00:00
|
|
|
If the `!ref` is omitted or is not a valid range, functions are free to treat
|
|
|
|
the sheet as empty or attempt to guess the range. The standard utilities that
|
|
|
|
ship with this library treat sheets as empty (for example, the CSV output is
|
|
|
|
empty string).
|
|
|
|
|
|
|
|
When reading a worksheet with the `sheetRows` property set, the ref parameter
|
|
|
|
will use the restricted range. The original range is set at `ws['!fullref']`
|
|
|
|
|
2017-04-13 01:29:38 +00:00
|
|
|
- `sheet['!margins']`: Object representing the page margins. The default values
|
|
|
|
follow Excel's "normal" preset. Excel also has a "wide" and a "narrow" preset
|
|
|
|
but they are stored as raw measurements. The main properties are listed below:
|
|
|
|
|
2017-04-30 20:37:53 +00:00
|
|
|
<details>
|
|
|
|
<summary><b>Page margin details</b> (click to show)</summary>
|
|
|
|
|
2017-04-13 01:29:38 +00:00
|
|
|
| key | description | "normal" | "wide" | "narrow" |
|
|
|
|
|----------|------------------------|:---------|:-------|:-------- |
|
|
|
|
| `left` | left margin (inches) | `0.7` | `1.0` | `0.25` |
|
|
|
|
| `right` | right margin (inches) | `0.7` | `1.0` | `0.25` |
|
|
|
|
| `top` | top margin (inches) | `0.75` | `1.0` | `0.75` |
|
|
|
|
| `bottom` | bottom margin (inches) | `0.75` | `1.0` | `0.75` |
|
|
|
|
| `header` | header margin (inches) | `0.3` | `0.5` | `0.3` |
|
|
|
|
| `footer` | footer margin (inches) | `0.3` | `0.5` | `0.3` |
|
|
|
|
|
|
|
|
```js
|
|
|
|
/* Set worksheet sheet to "normal" */
|
|
|
|
sheet["!margins"] = { left:0.7, right:0.7, top:0.75, bottom:0.75, header:0.3, footer:0.3 }
|
|
|
|
/* Set worksheet sheet to "wide" */
|
|
|
|
sheet["!margins"] = { left:1.0, right:1.0, top:1.0, bottom:1.0, header:0.5, footer:0.5 }
|
|
|
|
/* Set worksheet sheet to "narrow" */
|
|
|
|
sheet["!margins"] = { left:0.25, right:0.25, top:0.75, bottom:0.75, header:0.3, footer:0.3 }
|
|
|
|
```
|
2017-04-30 20:37:53 +00:00
|
|
|
</details>
|
2017-04-13 01:29:38 +00:00
|
|
|
|