0.2.0 • Published 8 years ago

xlsform-template v0.2.0

Weekly downloads
3
License
MIT
Repository
github
Last release
8 years ago

xlsform-template

Build Status

Utilities create XLSForm template for nodejs

It generate excel workbook contains survey, choices and settings worksheets contains most commonly used xlsform fields

Installation

$ npm install --save xlsform-template

Usage

var template = new require('xlsform-template')({
    settings:{
        formTitle:'Registration',
        formId:'registration_form',
        version:'1.0.0'
    }
});

//write template to file
template.writeFile(_<filename>_, function(error,result) {
    ...
});

//download it on http request
app.get('/xlsform', function(request, response) {
            var template = new Template({
                settings:{
                    formTitle:'Registration',
                    formId:'registration_form',
                    version:'1.0.0'
                }
            });

            template.download(response, {
                filename: filename
            });

        });

Options

Settings

Must be a valid and allowed setting column in XLSForm. They must be in camelcase e.g for form_id should be provided as formId

Example

var template = new Template({
                settings:{
                    formTitle:'Registration',
                    formId:'registration_form',
                    instanceName:'<value>' or `<expression>`,
                    version:'1.0.0',
                    defaultLanguage: 'English'
                }
            });

Experimental

Passing array of question options, xlsform-template will try to add them to the survey workbook. All question attribute must be valid XLSForm attributes

Example

var template = new Template({
            questions: [{
                type: 'text',
                name: 'name',
                label: 'What is your name?'
            }, {
                type: 'integer',
                name: 'age',
                label: 'How old are you?'
            }]
        });

Literature Reviewed

Licence

The MIT License (MIT)

Copyright (c) 2015 lykmapipo, kusanya & Contributors

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

0.2.0

8 years ago

0.1.2

8 years ago

0.1.0

9 years ago