Skip to content

Commit

Permalink
allow change of the output format type
Browse files Browse the repository at this point in the history
  • Loading branch information
Jacek Dominiak committed Jan 7, 2014
1 parent 60858dc commit 11b6acd
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions index.js
Expand Up @@ -54,21 +54,22 @@ var office = {
} else { self.xlsParse(filename, cb); }
},
documentParse: function(filename, options, cb) {
var self = this;
var self = this,
options.format = options.format || 'html';
if (options.img) {
if (!options.path) {
options.path = temp.path({prefix: 'node-office-'});
}
}
}
if (options.path) {
exec('unoconv', ['--outputpath='+options.path, '--format=html', filename], function(error, stdout, stderr) {
exec('unoconv', ['--outputpath='+options.path, '--format='+options.format, filename], function(error, stdout, stderr) {
if (stderr) { console.error(stderr); }
if (!error) {
cb(null, path.join(options.path, path.basename(filename, path.extname(filename))+'.html'));
} else { cb(error); }
});
} else {
exec('unoconv', ['--stdout', '--format=html', filename], function(error, stdout, stderr) {
exec('unoconv', ['--stdout', '--format='+options.format, filename], function(error, stdout, stderr) {
if (stderr) { console.error(stderr); }
if (!error) {
cb(null, stdout);
Expand Down

0 comments on commit 11b6acd

Please sign in to comment.