Add alignment; update README

This commit is contained in:
Pieter Sheth-Voss 2015-05-21 15:52:24 -04:00
parent 858abf1103
commit ed0cd9b2c1
4 changed files with 9 additions and 1 deletions

@ -347,6 +347,9 @@ is available. To change a value, be sure to delete `cell.w` (or set it to
`undefined`) before attempting to export. The utilities will regenerate the `w`
text from the number format (`cell.z`) and the raw value if possible.
**Note**: The .z attribute is now deprecated. Use the `.s` attribute to specify cell styles including number formats.
To specify a number format, use `s.numFmt`, e.g. `{v: 42145.822, s: { numFmt: "m/dd/yy"}}` described below.
### Data Types
The raw value is stored in the `v` field, interpreted based on the `t` field.
@ -511,9 +514,11 @@ top-level attributes: `fill`, `font`, `numFmt`, `alignment`, and `border`.
| | | `"0.00%"` // string matching a built-in format, see StyleBuilder.SSF
| | | `"0.0%"` // string specifying a custom format
| | | `"0.00%;\\(0.00%\\);\\-;@"` // string specifying a custom format, escaping special characters
| | | `"m/dd/yy"` // string a date format using Excel's format notation
| alignment | vertical | `"bottom"||"center"||"top"`
| | horizontal | `"bottom"||"center"||"top"`
| | wrapText | `true || false`
| | readingOrder | `2` // for right-to-left
| | textRotation | Number from `0` to `180` or `255` (default is `0`)
| | | `90` is rotated up 90 degrees
| | | `45` is rotated up 45 degrees

@ -191,6 +191,7 @@
if (attributes.alignment.horizontal) { $alignment.attr('horizontal', attributes.alignment.horizontal);}
if (attributes.alignment.vertical) { $alignment.attr('vertical', attributes.alignment.vertical);}
if (attributes.alignment.indent) { $alignment.attr('indent', attributes.alignment.indent);}
if (attributes.alignment.readingOrder) { $alignment.attr('readingOrder', attributes.alignment.readingOrder);}
if (attributes.alignment.wrapText) { $alignment.attr('wrapText', attributes.alignment.wrapText);}
if (attributes.alignment.textRotation!=undefined) { $alignment.attr('textRotation', attributes.alignment.textRotation);}

@ -137,7 +137,8 @@ var workbook = new Workbook(XLSX)
{v: "Vertical", s: {alignment: {textRotation: 255}}}
],
[
{v: "Font color test", s: { font: {fgColor: {rgb: "FFC6EFCE"}}}}
{v: "Font color test", s: { font: {fgColor: {rgb: "FFC6EFCE"}}}},
{v: "right to left", s: {alignment: {readingOrder: 2}}}
]
]).mergeCells("Main", {
"s": {"c": 0, "r": 0 },

@ -12197,6 +12197,7 @@ var XmlNode = (function () {
if (attributes.alignment.horizontal) { $alignment.attr('horizontal', attributes.alignment.horizontal);}
if (attributes.alignment.vertical) { $alignment.attr('vertical', attributes.alignment.vertical);}
if (attributes.alignment.indent) { $alignment.attr('indent', attributes.alignment.indent);}
if (attributes.alignment.readingOrder) { $alignment.attr('readingOrder', attributes.alignment.readingOrder);}
if (attributes.alignment.wrapText) { $alignment.attr('wrapText', attributes.alignment.wrapText);}
if (attributes.alignment.textRotation!=undefined) { $alignment.attr('textRotation', attributes.alignment.textRotation);}