Permalink
Browse files

version bump 0.8.0: unification with js-xls 0.7.5

1 parent 61b17e6 commit 0d38d4c0a016029d83a80b2ad6f7af3fd8752c7d @SheetJSDev SheetJSDev committed Apr 2, 2015
Showing with 20,750 additions and 843 deletions.
  1. +13 −0 .gitignore
  2. +4 −0 .jshintrc
  3. +9 −0 .npmignore
  4. +2 −1 .travis.yml
  5. +14 −4 CONTRIBUTING.md
  6. +1 −1 LICENSE
  7. +7 −1 Makefile
  8. +70 −22 README.md
  9. +3 −1 bin/xlsx.njs
  10. +1 −0 bits/.npmignore
  11. +3 −2 bits/00_header.js
  12. +1 −1 bits/01_version.js
  13. +7 −2 bits/02_codepage.js
  14. +41 −0 bits/04_base64.js
  15. +16 −0 bits/05_buf.js
  16. +20 −0 bits/11_ssfutils.js
  17. +383 −0 bits/18_cfb.js
  18. +0 −1 bits/20_jsutils.js
  19. +17 −6 bits/22_xmlutils.js
  20. +93 −13 bits/23_binutils.js
  21. +2 −2 bits/24_hoppers.js
  22. +21 −0 bits/25_cellutils.js
  23. +35 −0 bits/26_crypto.js
  24. +6 −4 bits/28_binstructs.js
  25. +265 −0 bits/29_xlsenum.js
  26. +8 −0 bits/36_xlsprops.js
  27. +440 −0 bits/38_xlstypes.js
  28. +917 −0 bits/39_xlsbiff.js
  29. +180 −0 bits/44_offcrypto.js
  30. +20 −0 bits/45_styutils.js
  31. +78 −0 bits/50_styxls.js
  32. +17 −0 bits/61_fcommon.js
  33. +803 −0 bits/62_fxls.js
  34. +1 −1 bits/63_fbin.js
  35. +1,090 −0 bits/64_ftab.js
  36. +17 −17 bits/68_wsbin.js
  37. +699 −0 bits/80_xlml.js
  38. +675 −0 bits/81_xls.js
  39. +407 −2 bits/82_parsetab.js
  40. +2 −1 bits/84_defaults.js
  41. +30 −3 bits/87_read.js
  42. +14 −2 bits/88_write.js
  43. +7 −2 bits/90_utils.js
  44. +7 −3 bits/98_exports.js
  45. +1 −0 bits/99_footer.js
  46. +4 −1 bower.json
  47. +1 −1 dist/LICENSE
  48. +17 −11 dist/cpexcel.js
  49. +6 −0 dist/ods.js
  50. +10 −7 dist/xlsx.core.min.js
  51. +1 −1 dist/xlsx.core.min.map
  52. +11 −8 dist/xlsx.full.min.js
  53. +1 −1 dist/xlsx.full.min.map
  54. +6,504 −239 dist/xlsx.js
  55. +9 −7 dist/xlsx.min.js
  56. +1 −1 dist/xlsx.min.map
  57. +35 −26 index.html
  58. +3 −0 misc/_bower.json
  59. +104 −0 misc/cfb.d.ts
  60. +11 −0 misc/strip_sourcemap.sh
  61. +35 −2 misc/xl.d.ts
  62. +6 −0 ods.js
  63. +6 −0 odsbits/20_jsutils.js
  64. +5 −7 package.json
  65. +337 −198 test.js
  66. +694 −0 tests.lst
  67. +6,499 −238 xlsx.js
  68. +1 −1 xlsxworker.js
  69. +1 −1 xlsxworker1.js
  70. +1 −1 xlsxworker2.js
View
@@ -3,6 +3,19 @@ misc/coverage.html
misc/prof.js
v8.log
tmp
+*.txt
+*.csv
+*.dif
+*.prn
+*.slk
+*.socialcalc
+*.xls
+*.xlsb
+*.xlsm
*.xlsx
*.xlsm
*.xlsb
+*.xml
+*.htm
+*.html
+*.sheetjs
View
@@ -0,0 +1,4 @@
+{
+ "bitwise": false,
+ "curly": false
+}
View
@@ -4,11 +4,20 @@ index.html
misc/
node_modules
tmp
+*.txt
+*.csv
+*.dif
+*.prn
+*.slk
+*.socialcalc
*.xls
*.xlsb
*.xlsm
*.xlsx
*.xml
+*.htm
+*.html
+*.sheetjs
.gitignore
.jshintrc
CONTRIBUTING.md
View
@@ -1,6 +1,7 @@
language: node_js
node_js:
- - "0.11"
+ - "iojs"
+ - "0.11.14"
- "0.10"
- "0.8"
before_install:
View
@@ -5,7 +5,7 @@ order to maintain that, every contributor must be vigilant.
There have been many projects in the past that have been very lax regarding
licensing, and we are of the opinion that those are ticking timebombs and that
-no corporate product should depend on them.
+no commercial product should depend on them.
# Required Reading
@@ -17,6 +17,17 @@ These are pretty short reads and emphasize the importance of proper licensing:
- http://www.codinghorror.com/blog/2007/04/pick-a-license-any-license.html
+# Raising Issues
+
+Issues should generally be accompanied by test files. Since github does not
+support attachments, the best method is to send files to <sheetjs@gmail.com>
+(subject line should contain issue number or message) or to share using some
+storage service. Unless expressly permitted, any attachments will not be
+shared or included in a test suite (although I will ask :)
+
+If sending email to a gmail account is problematic, the <dev@sheetjs.com> email
+inbox is self-hosted.
+
# Pre-Contribution Checklist
Before thinking about contributing, make sure that:
@@ -27,7 +38,7 @@ Before thinking about contributing, make sure that:
Corporation or a subsidiary
- You have not consulted any existing relevant codebase (if you have, please
-take note of which codebases were consulted).
+ take note of which codebases were consulted).
If you cannot attest to each of these items, the best approach is to raise an
issue. If it is a particularly high-priority issue, please drop an email to
@@ -45,9 +56,8 @@ Keep these in mind as you work:
- You are working on your own time. Unless they explicitly grant permission,
your employer may be the ultimate owner of your IP
-
# Post-Contribution
Before contributions are merged, you will receive an email (at the address
associated with the git commit) and will be asked to confirm the aforementioned
-items.
+items. Ensure that the email addresses associated with the commits is valid.
View
@@ -1,4 +1,4 @@
-Copyright (C) 2012-2014 SheetJS
+Copyright (C) 2012-2015 SheetJS
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
View
@@ -1,5 +1,5 @@
LIB=xlsx
-FMT=xlsx xlsm xlsb ods misc full
+FMT=xlsx xlsm xlsb ods xls xml misc full
REQS=jszip.js
ADDONS=dist/cpexcel.js
AUXTARGETS=ods.js
@@ -17,6 +17,9 @@ $(TARGET): $(DEPS)
bits/01_version.js: package.json
echo "$(ULIB).version = '"`grep version package.json | awk '{gsub(/[^0-9a-z\.-]/,"",$$2); print $$2}'`"';" > $@
+bits/18_cfb.js: node_modules/cfb/dist/xlscfb.js
+ cp $^ $@
+
.PHONY: clean
clean:
rm -f $(TARGET)
@@ -88,8 +91,11 @@ dist: dist-deps $(TARGET) bower.json
cp $(TARGET) dist/
cp LICENSE dist/
uglifyjs $(TARGET) -o dist/$(LIB).min.js --source-map dist/$(LIB).min.map --preamble "$$(head -n 1 bits/00_header.js)"
+ misc/strip_sourcemap.sh dist/$(LIB).min.js
uglifyjs $(REQS) $(TARGET) -o dist/$(LIB).core.min.js --source-map dist/$(LIB).core.min.map --preamble "$$(head -n 1 bits/00_header.js)"
+ misc/strip_sourcemap.sh dist/$(LIB).core.min.js
uglifyjs $(REQS) $(ADDONS) $(TARGET) -o dist/$(LIB).full.min.js --source-map dist/$(LIB).full.min.map --preamble "$$(head -n 1 bits/00_header.js)"
+ misc/strip_sourcemap.sh dist/$(LIB).full.min.js
.PHONY: aux
aux: $(AUXTARGETS)
View
@@ -1,24 +1,38 @@
# xlsx
-Parser and writer for Excel 2007+ (XLSX/XLSM/XLSB) files and parser for ODS.
-Pure-JS cleanroom implementation from the Office Open XML spec, [MS-XLSB], ODF
-specifications and related documents.
+Parser and writer for various spreadsheet formats. Pure-JS cleanroom
+implementation from official specifications and related documents.
+
+Supported read formats:
+
+- Excel 2007+ XML Formats (XLSX/XLSM)
+- Excel 2007+ Binary Format (XLSB)
+- Excel 2003-2004 XML Format (XML "SpreadsheetML")
+- Excel 97-2004 (XLS BIFF8)
+- Excel 5.0/95 (XLS BIFF5)
+- OpenDocument Spreadsheet (ODS)
+
+Supported write formats:
+
+- XLSX
+- CSV (and general DSV)
+- JSON and JS objects (various styles)
Demo: <http://oss.sheetjs.com/js-xlsx>
Source: <http://git.io/xlsx>
## Installation
-In [nodejs](https://www.npmjs.org/package/xlsx):
+With [npm](https://www.npmjs.org/package/xlsx):
npm install xlsx
In the browser:
<script lang="javascript" src="dist/xlsx.core.min.js"></script>
-In [bower](http://bower.io/search/?q=js-xlsx):
+With [bower](http://bower.io/search/?q=js-xlsx):
bower install js-xlsx
@@ -27,7 +41,7 @@ CDNjs automatically pulls the latest version and makes all versions available at
## Optional Modules
-The nodejs version automatically requires modules for additional features. Some
+The node version automatically requires modules for additional features. Some
of these modules are rather large in size and are only needed in special
circumstances, so they do not ship with the core. For browser use, they must
be included directly:
@@ -56,7 +70,7 @@ To use the shim, add the shim before the script tag that loads xlsx.js:
For parsing, the first step is to read the file. This involves acquiring the
data and feeding it into the library. Here are a few common scenarios:
-- nodejs readFile:
+- node readFile:
```
if(typeof require !== 'undefined') XLSX = require('xlsx');
@@ -142,13 +156,32 @@ input_dom_element.addEventListener('change', handleFile, false);
## Working with the Workbook
-This example walks through every cell of every sheet and dumps the values:
+The full object format is described later in this README.
+
+This example extracts the value stored in cell A1 from the first worksheet:
+
+```
+var first_sheet_name = workbook.SheetNames[0];
+var address_of_cell = 'A1';
+
+/* Get worksheet */
+var worksheet = workbook.Sheets[first_sheet_name];
+
+/* Find desired cell */
+var desired_cell = worksheet[address_of_cell];
+
+/* Get the value */
+var desired_value = desired_cell.v;
+```
+
+This example iterates through every nonempty of every sheet and dumps values:
```
var sheet_name_list = workbook.SheetNames;
-sheet_name_list.forEach(function(y) {
+sheet_name_list.forEach(function(y) { /* iterate through sheets */
var worksheet = workbook.Sheets[y];
for (z in worksheet) {
+ /* all keys that do not begin with "!" correspond to cell addresses */
if(z[0] === '!') continue;
console.log(y + "!" + z + "=" + JSON.stringify(worksheet[z].v));
}
@@ -166,9 +199,9 @@ mode is provided for testing. On OSX you can get the base64 encoding with:
- <http://oss.sheetjs.com/js-xlsx/ajax.html> XMLHttpRequest
-- <https://github.com/SheetJS/js-xlsx/blob/master/bin/xlsx.njs> nodejs
+- <https://github.com/SheetJS/js-xlsx/blob/master/bin/xlsx.njs> node
-The nodejs version installs a binary `xlsx` which can read XLSX/XLSM/XLSB
+The node version installs a command line tool `xlsx` which can read spreadsheet
files and output the contents in various formats. The source is available at
`xlsx.njs` in the bin directory.
@@ -220,7 +253,7 @@ Complete examples:
## Interface
-`XLSX` is the exposed variable in the browser and the exported nodejs variable
+`XLSX` is the exposed variable in the browser and the exported node variable
`XLSX.version` is the version of the library (added by the build script).
@@ -374,7 +407,8 @@ Special worksheet keys (accessible as `worksheet[key]`, each starting with `!`):
`wb.Sheets[sheetname]` returns an object representing the worksheet.
`wb.Props` is an object storing the standard properties. `wb.Custprops` stores
-custom properties.
+custom properties. Since the XLS standard properties deviate from the XLSX
+standard, XLS parsing stores core properties in both places. .
## Parsing Options
@@ -383,7 +417,7 @@ The exported `read` and `readFile` functions accept an options argument:
| Option Name | Default | Description |
| :---------- | ------: | :---------- |
-| cellFormula | true | Save formulae to the .f field |
+| cellFormula | true | Save formulae to the .f field ** |
| cellHTML | true | Parse rich text and save HTML to the .h field |
| cellNF | false | Save number format string to the .z field |
| cellStyles | false | Save style/theme info to the .s field |
@@ -395,17 +429,24 @@ The exported `read` and `readFile` functions accept an options argument:
| bookProps | false | If true, only parse enough to get book metadata ** |
| bookSheets | false | If true, only parse enough to get the sheet names |
| bookVBA | false | If true, expose vbaProject.bin to `vbaraw` field ** |
+| password | "" | If defined and file is encrypted, use password ** |
+- `cellFormula` option only applies to formats that require extra processing to
+ parse formulae (XLS/XLSB).
- Even if `cellNF` is false, formatted text will be generated and saved to `.w`
- In some cases, sheets may be parsed even if `bookSheets` is false.
- `bookSheets` and `bookProps` combine to give both sets of information
- `Deps` will be an empty object if `bookDeps` is falsy
-- `bookFiles` adds a `keys` array (paths in the ZIP) and a `files` hash (whose
- keys are paths and values are objects representing the files)
+- `bookFiles` behavior depends on file type:
+ * `keys` array (paths in the ZIP) for ZIP-based formats
+ * `files` hash (mapping paths to objects representing the files) for ZIP
+ * `cfb` object for formats using CFB containers
- `sheetRows-1` rows will be generated when looking at the JSON object output
(since the header row is counted as a row when parsing the data)
- `bookVBA` merely exposes the raw vba object. It does not parse the data.
- `cellDates` currently does not convert numerical dates to JS dates.
+- Currently only XOR encryption is supported. Unsupported error will be thrown
+ for files employing other encryption methods.
The defaults are enumerated in bits/84_defaults.js
@@ -430,7 +471,7 @@ The exported `write` and `writeFile` functions accept an options argument:
## Tested Environments
- - NodeJS 0.8, 0.10 (latest release), 0.11 (unstable)
+ - NodeJS 0.8, 0.10 (latest release), 0.11.14 (unstable), io.js
- IE 6/7/8/9/10/11 using Base64 mode (IE10/11 using HTML5 mode)
- FF 18 using Base64 or HTML5 mode
- Chrome 24 using Base64 or HTML5 mode
@@ -449,7 +490,7 @@ Running `make init` will refresh the `test_files` submodule and get the files.
## Testing
-`make test` will run the nodejs-based tests. To run the in-browser tests, clone
+`make test` will run the node-based tests. To run the in-browser tests, clone
[the oss.sheetjs.com repo](https://github.com/SheetJS/SheetJS.github.io) and
replace the xlsx.js file (then fire up the browser and go to `stress.html`):
@@ -481,10 +522,6 @@ $ diff xlsx.js xlsx.new.js
To produce the dist files, run `make dist`. The dist files are updated in each
version release and should not be committed between versions.
-## XLS Support
-
-XLS is available in [js-xls](http://git.io/xls).
-
## License
Please consult the attached LICENSE file for details. All rights not explicitly
@@ -506,7 +543,18 @@ OSP-covered specifications:
- [MS-XLSB]: Excel (.xlsb) Binary File Format
- [MS-XLSX]: Excel (.xlsx) Extensions to the Office Open XML SpreadsheetML File Format
- [MS-OE376]: Office Implementation Information for ECMA-376 Standards Support
+ - [MS-CFB]: Compound File Binary File Format
+ - [MS-XLS]: Excel Binary File Format (.xls) Structure Specification
+ - [MS-ODATA]: Open Data Protocol (OData)
+ - [MS-OFFCRYPTO]: Office Document Cryptography Structure
+ - [MS-OLEDS]: Object Linking and Embedding (OLE) Data Structures
+ - [MS-OLEPS]: Object Linking and Embedding (OLE) Property Set Data Structures
+ - [MS-OSHARED]: Office Common Data Types and Objects Structures
+ - [MS-OVBA]: Office VBA File Format Structure
+ - [MS-CTXLS]: Excel Custom Toolbar Binary File Format
- [MS-XLDM]: Spreadsheet Data Model File Format
+ - [MS-EXSPXML3]: Excel Calculation Version 2 Web Service XML Schema
+ - [XLS]: Microsoft Office Excel 97-2007 Binary File Format Specification
Open Document Format for Office Applications Version 1.2 (29 September 2011)
View
@@ -1,5 +1,5 @@
#!/usr/bin/env node
-/* xlsx.js (C) 2013-2014 SheetJS -- http://sheetjs.com */
+/* xlsx.js (C) 2013-2015 SheetJS -- http://sheetjs.com */
var n = "xlsx";
/* vim: set ts=2 ft=javascript: */
var X = require('../');
@@ -9,6 +9,7 @@ program
.usage('[options] <file> [sheetname]')
.option('-f, --file <file>', 'use specified workbook')
.option('-s, --sheet <sheet>', 'print specified sheet (default first sheet)')
+ .option('-p, --password <pw>', 'if file is encrypted, try with specified pw')
.option('-l, --list-sheets', 'list sheet names and exit')
.option('-o, --output <file>', 'output to specified file')
.option('-B, --xlsb', 'emit XLSB to <sheetname> or <file>.xlsb')
@@ -67,6 +68,7 @@ if(!fs.existsSync(filename)) {
var opts = {}, wb;
if(program.listSheets) opts.bookSheets = true;
if(program.sheetRows) opts.sheetRows = program.sheetRows;
+if(program.password) opts.password = program.password;
if(program.xlsx || program.xlsm || program.xlsb) {
opts.cellNF = true;
if(program.output) sheetname = program.output;
View
@@ -0,0 +1 @@
+*.js
View
@@ -1,5 +1,6 @@
-/* xlsx.js (C) 2013-2014 SheetJS -- http://sheetjs.com */
+/* xlsx.js (C) 2013-2015 SheetJS -- http://sheetjs.com */
/* vim: set ts=2: */
/*jshint -W041 */
+/*jshint funcscope:true, eqnull:true */
var XLSX = {};
-(function(XLSX){
+(function make_xlsx(XLSX){
View
@@ -1 +1 @@
-XLSX.version = '0.7.12';
+XLSX.version = '0.8.0';
Oops, something went wrong.

0 comments on commit 0d38d4c

Please sign in to comment.