ppt-template
ppt-template copied to clipboard
Dynamically changing the PPTX File and cloning
can you please tell me how to call second return function from this code?
files.forEach(function(fileId) {
module.exports.fileDet(res, fileId, function(res, fileData) {
fileDetArr.push(fileData);
fileDetails.forEach(function(data) {
//console.log("data.fileName===", data.fileName);
// return false;
var originalfileName = parentDir + '\\uploads\\' + data.fileName + ".pptx";
var output_fileName = docTitle + '_' + fileName + '.pptx';
var output_fileDirectory = parentDir + '\\uploads\\' + output_fileName;
var Presentation = PPT_Template.Presentation;
var Slide = PPT_Template.Slide;
// Presentation Object
var myPresentation = new Presentation();
// Load example.pptx
myPresentation.loadFile(originalfileName)
.then(() => {
console.log("originalfileName==", originalfileName);
page_number = (data.pageNumber) + 1;
let cloneSlide = myPresentation.getSlide(page_number).clone();
sampleArray.push(cloneSlide);
// console.log("1--------", myPresentation.generate(sampleArray));
// if (sampleArray.length == fileDetails.length) {
console.log("1--------", myPresentation.generate(sampleArray));
return myPresentation.generate(sampleArray);
// }
})
})
.then(() => {
console.log("2--------", newPresentation);
return newPresentation;
})
// Output .pptx file
.then(() => {
return newPresentation.saveAs(output_fileDirectory);
})
.then(() => {
console.log('- Save Successfully');
})
})
})
})
can you change the function without then function?