officejs 0.4.0 officejs: ^0.4.0 copied to clipboard
Unofficial Office.js (https://github.com/OfficeDev/office-js) wrapper for Flutter/Dart
Unofficial Office.js (https://github.com/OfficeDev/office-js) wrapper for Flutter/Dart
Please note: the package is a Work In Progress and in highly risk of change. Do not use it in production.
Features #
Getting started with Excel #
To start, add in the index.html "Initialize office" then
section.
That's all you need to do)
window.addEventListener("load", function (ev) {
// Download main.dart.js
_flutter.loader
.loadEntrypoint({
serviceWorker: {
serviceWorkerVersion: serviceWorkerVersion,
},
})
.then(function (engineInitializer) {
return engineInitializer.initializeEngine();
})
.then(function (appRunner) {
return appRunner.runApp();
})
/** Initialize office **/
.then(function () {
console.log("intializing office");
const officeEl = document.getElementById("office");
if (officeEl != null) return;
const scriptTag = document.createElement("script");
scriptTag.src =
"https://appsforoffice.microsoft.com/lib/1/hosted/office.js";
scriptTag.id = "office";
scriptTag.addEventListener("load", () => {
console.log("office loaded");
class OfficeHelpers {
officeOnReady = Office.onReady;
// may cause an error Excel is not defined
runExcel = Excel.run;
}
window["getOfficeHelpers"] = () => new OfficeHelpers();
console.log("helpers injected");
});
document.getElementsByTagName("head")[0].appendChild(scriptTag);
});
});
Getting started with Outlook #
To start, add in the index.html "Initialize office" then
section.
That's all you need to do)
window.addEventListener("load", function (ev) {
// Download main.dart.js
_flutter.loader
.loadEntrypoint({
serviceWorker: {
serviceWorkerVersion: serviceWorkerVersion,
},
})
.then(function (engineInitializer) {
return engineInitializer.initializeEngine();
})
.then(function (appRunner) {
return appRunner.runApp();
})
/** Initialize office **/
.then(function () {
console.log("intializing office");
const officeEl = document.getElementById("office");
if (officeEl != null) return;
const scriptTag = document.createElement("script");
scriptTag.src =
"https://appsforoffice.microsoft.com/lib/1/hosted/office.js";
scriptTag.id = "office";
scriptTag.addEventListener("load", () => {
console.log("office loaded");
class OfficeHelpers {
officeOnReady = Office.onReady;
context = Office.context;
}
window["getOfficeHelpers"] = () => new OfficeHelpers();
console.log("helpers injected");
});
document.getElementsByTagName("head")[0].appendChild(scriptTag);
});
});
Donations / Sponsor #
Please sponsor or donate to the creator on Boosty or CloudTips.
Thank you for your support and have a great day! 🌄
Getting Help #
If you need help getting started or have questions, check out our Discord Community.