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) {
@ -137,37 +134,59 @@ function PowerPoint() {
this.currentPresentation = this.application.Presentations.Add(true);
}
} else {
this.currentPresentation = this.application.Presentations.Add(true);
}
this.currentPresentation = this.application.Presentations.Add(true);
}
//this.selectPresentation(1);
};
this.selectPresentation = function(idx) {
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;
};
// get all slides
this.getSlides = function() {
var slides = [];
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;
}
};
var slideEnum = new Enumerator(this.currentPresentation.Slides);
for (; !slideEnum.atEnd(); slideEnum.moveNext()) {
slides.push(new PowerPoint.Slide(slideEnum.item()));
}
this.close = function() {
try {
this.currentPresentation.Close()
this.currentPresentation = null;
this.application = null;
} catch (e) {
this.currentPresentation = null;
this.application = null;
}
};
return slides;
};
// get all slides
this.getSlides = function() {
var slides = [];
var slideEnum = new Enumerator(this.currentPresentation.Slides);
for (; !slideEnum.atEnd(); slideEnum.moveNext()) {
slides.push(new PowerPoint.Slide(slideEnum.item()));
}
return slides;
};
}
PowerPoint.Slide = function(slide) {
this.slide = slide;
this.getShapes = function() {
// todo
};
this.getShapes = function() {
// todo
};
};
PowerPoint.Shape = function(shape) {
this.shape = shape;