Update msoffice.js

This commit is contained in:
Namhyeon Go 2024-06-02 02:14:23 +09:00
parent b391867f14
commit aa8f10b6a7

View File

@ -120,9 +120,6 @@ function PowerPoint() {
this.currentPresentation = null;
this.open = function(filename) {
console.log("test");
console.log(typeof filename);
if (typeof filename !== "undefined") {
// check type of the path
if (filename.indexOf(":\\") < 0 && filename.indexOf(":/") < 0) {
@ -139,17 +136,39 @@ function PowerPoint() {
} else {
this.currentPresentation = this.application.Presentations.Add(true);
}
//this.selectPresentation(1);
};
this.selectPresentation = function(idx) {
if (idx == 0) {
this.currentWorksheet = this.application.ActivePresentation;
this.currentPresentation = this.application.ActivePresentation;
} else {
this.currentWorksheet = this.application.Presentations(idx);
this.currentPresentation = this.application.Presentations(idx);
}
return this;
};
this.saveAs = function(filename) {
try {
this.currentPresentation.saveAs(filename);
return FILE.fileExists(filename);
} catch (e) {
console.error("Could not save a file:", e.message);
return false;
}
};
this.close = function() {
try {
this.currentPresentation.Close()
this.currentPresentation = null;
this.application = null;
} catch (e) {
this.currentPresentation = null;
this.application = null;
}
};
// get all slides
this.getSlides = function() {
var slides = [];