Support ods import
This commit is contained in:
parent
7026123bfc
commit
36926e11c9
@ -801,15 +801,28 @@ define([
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
var x2tConvertData = function (x2t, data, filename, extension) {
|
||||||
|
var convertedContent;
|
||||||
|
if (filename.endsWith(".ods")) {
|
||||||
|
convertedContent = x2tConvertDataInternal(x2t, new Uint8Array(data), "test.ods", "xlsx");
|
||||||
|
convertedContent = x2tConvertDataInternal(x2t, convertedContent, "test.xlsx", extension);
|
||||||
|
} else {
|
||||||
|
convertedContent = x2tConvertDataInternal(x2t, new Uint8Array(data), filename, extension);
|
||||||
|
}
|
||||||
|
return convertedContent;
|
||||||
|
}
|
||||||
|
|
||||||
var importXLSXFile = function(content, filename) {
|
var importXLSXFile = function(content, filename) {
|
||||||
var file = getFileType();
|
|
||||||
// Perform the x2t conversion
|
// Perform the x2t conversion
|
||||||
|
console.log("Filename");
|
||||||
|
console.log(filename);
|
||||||
require(['/common/onlyoffice/x2t/x2t.js'], function() {
|
require(['/common/onlyoffice/x2t/x2t.js'], function() {
|
||||||
var x2t = Module;
|
var x2t = Module;
|
||||||
x2t.run();
|
x2t.run();
|
||||||
if (x2tInitialized) {
|
if (x2tInitialized) {
|
||||||
console.log("x2t runtime already initialized");
|
console.log("x2t runtime already initialized");
|
||||||
var convertedContent = x2tConvertDataInternal(x2t, new Uint8Array(content), file.title, "bin");
|
var convertedContent = x2tConvertData(x2t, new Uint8Array(content), filename.name, "bin");
|
||||||
importFile(convertedContent);
|
importFile(convertedContent);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -818,7 +831,7 @@ define([
|
|||||||
// Init x2t js module
|
// Init x2t js module
|
||||||
x2tInit(x2t);
|
x2tInit(x2t);
|
||||||
x2tInitialized = true;
|
x2tInitialized = true;
|
||||||
var convertedContent = x2tConvertDataInternal(x2t, new Uint8Array(content), file.title, "bin");
|
var convertedContent = x2tConvertData(x2t, new Uint8Array(content), filename.name, "bin");
|
||||||
importFile(convertedContent);
|
importFile(convertedContent);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user