feat(soffice): add support for Excel and Calc spreadsheet conversions
This commit is contained in:
parent
70a2530456
commit
832f92c426
|
|
@ -699,47 +699,6 @@ export async function convert(
|
||||||
let extraArgs: string[] = [];
|
let extraArgs: string[] = [];
|
||||||
let message = "Done";
|
let message = "Done";
|
||||||
|
|
||||||
const audioFormatsWithCover = ["m4a", "mp3", "flac", "ogg"];
|
|
||||||
const audioFormatsNoCover = ["wav", "aac"];
|
|
||||||
|
|
||||||
const audioInputFormats = [
|
|
||||||
"aac",
|
|
||||||
"ac3",
|
|
||||||
"ac4",
|
|
||||||
"aiff",
|
|
||||||
"alac",
|
|
||||||
"amr",
|
|
||||||
"ape",
|
|
||||||
"au",
|
|
||||||
"caf",
|
|
||||||
"dts",
|
|
||||||
"eac3",
|
|
||||||
"flac",
|
|
||||||
"m4a",
|
|
||||||
"m4b",
|
|
||||||
"mka",
|
|
||||||
"mp2",
|
|
||||||
"mp3",
|
|
||||||
"mpc",
|
|
||||||
"ogg",
|
|
||||||
"oga",
|
|
||||||
"opus",
|
|
||||||
"ra",
|
|
||||||
"voc",
|
|
||||||
"wav",
|
|
||||||
"wma",
|
|
||||||
"wv",
|
|
||||||
];
|
|
||||||
|
|
||||||
if (
|
|
||||||
audioFormatsWithCover.includes(convertTo) &&
|
|
||||||
audioInputFormats.includes(fileType.toLowerCase())
|
|
||||||
) {
|
|
||||||
extraArgs.push("-c:v", "copy", "-disposition:v", "attached_pic");
|
|
||||||
} else if (audioFormatsNoCover.includes(convertTo) || audioFormatsWithCover.includes(convertTo)) {
|
|
||||||
extraArgs.push("-vn");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (convertTo === "ico") {
|
if (convertTo === "ico") {
|
||||||
// Make sure image is 256x256 or smaller
|
// Make sure image is 256x256 or smaller
|
||||||
extraArgs = [
|
extraArgs = [
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,6 @@ export const properties = {
|
||||||
text: [
|
text: [
|
||||||
"602",
|
"602",
|
||||||
"abw",
|
"abw",
|
||||||
"csv",
|
|
||||||
"cwk",
|
"cwk",
|
||||||
"doc",
|
"doc",
|
||||||
"docm",
|
"docm",
|
||||||
|
|
@ -35,7 +34,6 @@ export const properties = {
|
||||||
"stw",
|
"stw",
|
||||||
"sxw",
|
"sxw",
|
||||||
"tab",
|
"tab",
|
||||||
"tsv",
|
|
||||||
"txt",
|
"txt",
|
||||||
"wn",
|
"wn",
|
||||||
"wpd",
|
"wpd",
|
||||||
|
|
@ -46,10 +44,10 @@ export const properties = {
|
||||||
"xml",
|
"xml",
|
||||||
"zabw",
|
"zabw",
|
||||||
],
|
],
|
||||||
|
calc: ["csv", "ods", "tsv", "xls", "xlsx"],
|
||||||
},
|
},
|
||||||
to: {
|
to: {
|
||||||
text: [
|
text: [
|
||||||
"csv",
|
|
||||||
"doc",
|
"doc",
|
||||||
"docm",
|
"docm",
|
||||||
"docx",
|
"docx",
|
||||||
|
|
@ -65,13 +63,13 @@ export const properties = {
|
||||||
"pdf",
|
"pdf",
|
||||||
"rtf",
|
"rtf",
|
||||||
"tab",
|
"tab",
|
||||||
"tsv",
|
|
||||||
"txt",
|
"txt",
|
||||||
"wps",
|
"wps",
|
||||||
"wpt",
|
"wpt",
|
||||||
"xhtml",
|
"xhtml",
|
||||||
"xml",
|
"xml",
|
||||||
],
|
],
|
||||||
|
calc: ["csv", "ods", "pdf", "tsv", "xls", "xlsx", "ots", "xlsm", "xlt", "xltm"],
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -117,7 +115,7 @@ const filters: Record<FileCategories, Record<string, string | null>> = {
|
||||||
// filter makes soffice reject a genuine Works document with "source file
|
// filter makes soffice reject a genuine Works document with "source file
|
||||||
// could not be loaded", even though it converts the same file fine with
|
// could not be loaded", even though it converts the same file fine with
|
||||||
// no --infilter at all (LibreOffice auto-detects it correctly).
|
// no --infilter at all (LibreOffice auto-detects it correctly).
|
||||||
//
|
|
||||||
// null is deliberate for BOTH directions here, not just the import side:
|
// null is deliberate for BOTH directions here, not just the import side:
|
||||||
// this map feeds both --infilter (import) and the --convert-to suffix
|
// this map feeds both --infilter (import) and the --convert-to suffix
|
||||||
// (export). On import, null lets LibreOffice auto-detect - its Works
|
// (export). On import, null lets LibreOffice auto-detect - its Works
|
||||||
|
|
@ -133,7 +131,18 @@ const filters: Record<FileCategories, Record<string, string | null>> = {
|
||||||
xml: "OpenDocument Text Flat XML",
|
xml: "OpenDocument Text Flat XML",
|
||||||
zabw: "AbiWord",
|
zabw: "AbiWord",
|
||||||
},
|
},
|
||||||
calc: {},
|
calc: {
|
||||||
|
csv: "Text - txt - csv (StarCalc)",
|
||||||
|
ods: "calc8",
|
||||||
|
ots: "calc8_template",
|
||||||
|
pdf: "calc_pdf_Export",
|
||||||
|
tsv: "Text - txt - csv (StarCalc)",
|
||||||
|
xls: "MS Excel 97",
|
||||||
|
xlsx: "Calc MS Excel 2007 XML",
|
||||||
|
xlsm: "Calc MS Excel 2007 XML VBA",
|
||||||
|
xlt: "MS Excel 97 Vorlage",
|
||||||
|
xltm: "Calc MS Excel 2007 XML Template",
|
||||||
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
const getFilters = (fileType: string, converto: string) => {
|
const getFilters = (fileType: string, converto: string) => {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue