oxmljs
v0.1.6
Published
Javascript library for creating and manipulating open xml documents such as docx and xlsx.
Downloads
30
Readme
oxml.js
Javascript library for creating and manipulating Open XML Documents like docx, xlsx, etc.
This is a small javascript library, which can let you download / export data in open xml documents like docx and xlsx which can be opened in any desktop or online document processing application such as Microsoft Excel, Google Sheets, etc. User can export data from charts or grid without making any server calls and thus saving processing units.
Open XML documents are just a ziped collection of XML files, thus only library required for oxml.js to work is JSZip, for compressing data in zip format and downloading.
Dependencies
- JSZIP
- File Saver - But not required. oxml.js can work on modern browsers without File Saver. Please see browser supported section for more details.
Installation
Oxml.js can be installed by referring development js file, or minified js file in dist directory. This small library (~30KB) is based on javascript and require only dependency JSZip for creating compressed files. File Saver can help in achieving browser compatibility, however is not a required library.
Usage
Simple refer scripts file from dist folder and start working on workbook document.
<script src="scripts/oxml.min.js"></script>
<script>
var workbook = oxml.xlsx();
var worksheet = oxml.sheet('Sheet1');
worksheet.cell(1,1, 'First Workbook');
workbook.download('workbook.xlsx');
</script>
Documentation
Oxml.js is simple to use and does not require background knowledge of Open XML. Refer openxml.js examples for detailed documentation and example of all the methods available in oxml.js.
Builds
Oxml.js comes in different build files, which are following:
- oxml.min.js: This is the minified file of complete oxml.js library.
- oxml.js: This is non minified file of complete oxml.js library.
- oxml-xlsx-minimal.min.js: This is the minified version minimal library of only xlsx. It use only creation of excel, without any styles.
- oxml-xlsx-minimal.min.js: This is the complete minimal library of only xlsx. It use only creation of excel, without any styles.
They all are available in distributions (dist) folder. This project is configured to build with require.js and almond.js, files for the same are kept in build folder. Use build-full.js and build-min.js configuration files with r.js for generating full and minified files respectively.
License
This project is licensed under MIT license. See LICENSE for more details.