Fix .doc export with LibreOffice (soffice) (#3338)
When using LibreOffice to convert pads to doc, we got `Error: no export filter for /tmp/xxxx.doc` (tested with LO 5 and 6). Maybe it's a regression from LO. Anyway, converting HTML to odt, then to doc works. Thx to lpagliari for her review!pull/3342/head
parent
6aa19c56a8
commit
82816acf4a
|
@ -35,7 +35,21 @@ var queue = async.queue(doConvertTask, 1);
|
||||||
* @param {Function} callback Standard callback function
|
* @param {Function} callback Standard callback function
|
||||||
*/
|
*/
|
||||||
exports.convertFile = function(srcFile, destFile, type, callback) {
|
exports.convertFile = function(srcFile, destFile, type, callback) {
|
||||||
|
// soffice can't convert from html to doc directly (verified with LO 5 and 6)
|
||||||
|
// we need to convert to odt first, then to doc
|
||||||
|
// to avoid `Error: no export filter for /tmp/xxxx.doc` error
|
||||||
|
if (type === 'doc') {
|
||||||
|
queue.push({
|
||||||
|
"srcFile": srcFile,
|
||||||
|
"destFile": destFile.replace(/\.doc$/, '.odt'),
|
||||||
|
"type": 'odt',
|
||||||
|
"callback": function () {
|
||||||
|
queue.push({"srcFile": srcFile.replace(/\.html$/, '.odt'), "destFile": destFile, "type": type, "callback": callback});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} else {
|
||||||
queue.push({"srcFile": srcFile, "destFile": destFile, "type": type, "callback": callback});
|
queue.push({"srcFile": srcFile, "destFile": destFile, "type": type, "callback": callback});
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
function doConvertTask(task, callback) {
|
function doConvertTask(task, callback) {
|
||||||
|
|
Loading…
Reference in New Issue