我在编写时添加了office.js,因此无法从excel文件中提取值。
该附件将帮助我的同事为每位老师准备报告表。应该从主表中过滤相应的课程,并将数据发送到下一个处理步骤(为每个老师创建单词文件)。
我尝试使用自动过滤器过滤范围并使用数据创建表,但似乎在return context.sync()
之后没有执行任何代码>
我已经阅读了buildingofficeaddins.com上的官方教程和一些代码,但是我的函数在“ return context.sync()”之后从未执行该代码]
function mselectTeacher(teachers) { Excel.run(function (context) { var sheet = context.workbook.worksheets.getActiveWorksheet(); var lfv = sheet.tables.add("A1:M211", true); var wsy = lfv.columns.getItem("WS/SS"); var studium = lfv.columns.getItem("Studium"); // some more colums wsy.load("values"); studium.load("values"); return context.sync() .then(function () { //I actually want to filter the rows by teacher, //this is only for testing for (var i = 1; i < 20; i++) { console.log(wsy[i] + "," + studium[i]); } }); }); }
是问题,我是从另一个函数中调用Excel.run吗?
我在编写时添加了office.js,因此无法从excel文件中提取值。外接程序将帮助我的同事为每位老师准备报告表。应该...
您能尝试这个吗?
function mselectTeacher(teachers) {
Excel.run(function (context) {
var sheet = context.workbook.worksheets.getActiveWorksheet();
var lfv = sheet.tables.add("A1:M211", true);
var wsy = lfv.columns.getItem("WS/SS");
var studium = lfv.columns.getItem("Studium");
// some more colums
wsy.load("values");
studium.load("values");
context.sync()
//I actually want to filter the rows by teacher,
//this is only for testing
for (var i = 1; i < 20; i++) {
console.log(wsy[i] + "," + studium[i]);
}
});
}