diff --git a/dist/Workbook.js b/dist/Workbook.js index b2a0ba8a..cb28bb56 100644 --- a/dist/Workbook.js +++ b/dist/Workbook.js @@ -1,6 +1,6 @@ import { FsWorkbook } from "./FsSpreadsheet/FsWorkbook.js"; import { addFsWorksheet, addJsWorksheet } from "./Worksheet.js"; -import { Excel } from "./fable_modules/Fable.Exceljs.1.3.6/ExcelJs.fs.js"; +import { Excel } from "./fable_modules/Fable.Exceljs.1.5.0/ExcelJs.fs.js"; import { disposeSafe, getEnumerator } from "./fable_modules/fable-library.4.1.3/Util.js"; export function toFsWorkbook(jswb) { diff --git a/dist/Xlsx.js b/dist/Xlsx.js index abe4aa5d..b1536cb3 100644 --- a/dist/Xlsx.js +++ b/dist/Xlsx.js @@ -1,9 +1,7 @@ import { PromiseBuilder__Delay_62FBFDE1, PromiseBuilder__Run_212F1D4B } from "./fable_modules/Fable.Promise.3.2.0/Promise.fs.js"; -import { Excel } from "./fable_modules/Fable.Exceljs.1.3.6/ExcelJs.fs.js"; +import { Excel } from "./fable_modules/Fable.Exceljs.1.5.0/ExcelJs.fs.js"; import { promise } from "./fable_modules/Fable.Promise.3.2.0/PromiseImpl.fs.js"; -import { startAsPromise } from "./fable_modules/fable-library.4.1.3/Async.js"; import { toJsWorkbook, toFsWorkbook } from "./Workbook.js"; -import { singleton } from "./fable_modules/fable-library.4.1.3/AsyncBuilder.js"; import { class_type } from "./fable_modules/fable-library.4.1.3/Reflection.js"; export class Xlsx { @@ -12,24 +10,24 @@ export class Xlsx { static fromXlsxFile(path) { return PromiseBuilder__Run_212F1D4B(promise, PromiseBuilder__Delay_62FBFDE1(promise, () => { const wb = new Excel.Workbook(); - return startAsPromise(wb.xlsx.readFile(path)).then(() => { + return wb.xlsx.readFile(path).then(() => { const fswb = toFsWorkbook(wb); return Promise.resolve(fswb); }); })); } static fromXlsxStream(stream) { - return singleton.Delay(() => { + return PromiseBuilder__Run_212F1D4B(promise, PromiseBuilder__Delay_62FBFDE1(promise, () => { const wb = new Excel.Workbook(); - return singleton.Bind(wb.xlsx.read(stream), () => singleton.Return(toFsWorkbook(wb))); - }); + return wb.xlsx.read(stream).then(() => (Promise.resolve(toFsWorkbook(wb)))); + })); } static fromBytes(bytes) { - return singleton.Delay(() => { + return PromiseBuilder__Run_212F1D4B(promise, PromiseBuilder__Delay_62FBFDE1(promise, () => { const wb = new Excel.Workbook(); const uint8 = new Uint8Array(bytes); - return singleton.Bind(wb.xlsx.load(uint8.buffer), () => singleton.Return(toFsWorkbook(wb))); - }); + return wb.xlsx.load(uint8.buffer).then(() => (Promise.resolve(toFsWorkbook(wb)))); + })); } static toFile(path, wb) { const jswb = toJsWorkbook(wb); @@ -40,11 +38,11 @@ export class Xlsx { return jswb.xlsx.write(stream); } static toBytes(wb) { - return singleton.Delay(() => { + return PromiseBuilder__Run_212F1D4B(promise, PromiseBuilder__Delay_62FBFDE1(promise, () => { const jswb = toJsWorkbook(wb); const buffer = jswb.xlsx.writeBuffer(); - return singleton.Return(buffer); - }); + return Promise.resolve(buffer); + })); } } diff --git a/package-lock.json b/package-lock.json index 39f7b44e..3cd2d69e 100644 --- a/package-lock.json +++ b/package-lock.json @@ -9,7 +9,7 @@ "version": "3.2.2+caf21db", "license": "MIT", "dependencies": { - "exceljs": "^4.3.0" + "@nfdi4plants/exceljs": "0.1.0" }, "devDependencies": { "mocha": "^10.2.0" @@ -42,6 +42,25 @@ "lodash.uniq": "^4.5.0" } }, + "node_modules/@nfdi4plants/exceljs": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/@nfdi4plants/exceljs/-/exceljs-0.1.0.tgz", + "integrity": "sha512-fr8F6oPpdX+VZrNqcSY9ntMVPl0SfFty7xwfzjBraLdLg6HFxorrBOZW1I+hpWUMy0oAWCjUw8/zuWQk44ZOZQ==", + "dependencies": { + "archiver": "^5.0.0", + "dayjs": "^1.8.34", + "fast-csv": "^4.3.1", + "jszip": "^3.10.1", + "readable-stream": "^3.6.0", + "saxes": "^5.0.1", + "tmp": "^0.2.0", + "unzipper": "^0.10.11", + "uuid": "^8.3.0" + }, + "engines": { + "node": ">=8.3.0" + } + }, "node_modules/@types/node": { "version": "14.18.54", "resolved": "https://registry.npmjs.org/@types/node/-/node-14.18.54.tgz", @@ -582,25 +601,6 @@ "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/exceljs": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/exceljs/-/exceljs-4.3.0.tgz", - "integrity": "sha512-hTAeo5b5TPvf8Z02I2sKIT4kSfCnOO2bCxYX8ABqODCdAjppI3gI9VYiGCQQYVcBaBSKlFDMKlAQRqC+kV9O8w==", - "dependencies": { - "archiver": "^5.0.0", - "dayjs": "^1.8.34", - "fast-csv": "^4.3.1", - "jszip": "^3.5.0", - "readable-stream": "^3.6.0", - "saxes": "^5.0.1", - "tmp": "^0.2.0", - "unzipper": "^0.10.11", - "uuid": "^8.3.0" - }, - "engines": { - "node": ">=8.3.0" - } - }, "node_modules/fast-csv": { "version": "4.3.6", "resolved": "https://registry.npmjs.org/fast-csv/-/fast-csv-4.3.6.tgz", diff --git a/package.json b/package.json index 51325645..60eb7bb9 100644 --- a/package.json +++ b/package.json @@ -3,7 +3,8 @@ "version": "3.2.2+caf21db", "description": "Minimal spreadsheet creation and manipulation using exceljs io.", "type": "module", - "main": "npmpkg/Xlsx.js", + "main": "dist/Xlsx.js", + "files": [ "dist", "package.json" ], "scripts": { "clean-test": "cd tests/FsSpreadsheet.Tests/js & dotnet fable clean --extension .js --yes", "pretest": "npm run clean-test && dotnet fable tests/FsSpreadsheet.Tests -o tests/FsSpreadsheet.Tests/js", @@ -32,6 +33,6 @@ "mocha": "^10.2.0" }, "dependencies": { - "exceljs": "^4.3.0" + "@nfdi4plants/exceljs": "0.1.0" } } diff --git a/src/FsSpreadsheet.Exceljs/FsSpreadsheet.Exceljs.fsproj b/src/FsSpreadsheet.Exceljs/FsSpreadsheet.Exceljs.fsproj index 6de1d746..6fd50397 100644 --- a/src/FsSpreadsheet.Exceljs/FsSpreadsheet.Exceljs.fsproj +++ b/src/FsSpreadsheet.Exceljs/FsSpreadsheet.Exceljs.fsproj @@ -29,7 +29,7 @@ - + @@ -45,7 +45,7 @@ - + diff --git a/tests/JS/TestFiles/README.md b/tests/JS/TestFiles/README.md new file mode 100644 index 00000000..7cebbaa6 --- /dev/null +++ b/tests/JS/TestFiles/README.md @@ -0,0 +1 @@ +Never open these test files and save them with libre office or microsoft excel. They will automatically standardize the files to their favored format, making them all uniform and working with both OpenXml and Exceljs. \ No newline at end of file