本帖最后由 Wilson.Zhang 于 2024-9-25 09:16 编辑
const initSpread = (spread) => {
tableApi.templateFile(params).then((response) => {
let activeSheetName,
activeRowIndex,
activeColumnIndex = null;
if (spread != null) {
activeSheetName = spread.getActiveSheet().name();
activeRowIndex = spread.getActiveSheet().getActiveRowIndex();
activeColumnIndex = spread
.getActiveSheet()
.getActiveColumnIndex();
spread.destroy();
}
const excelIo = new Excel.IO();
excelIo.open(
response,
(json) => {
console.log(response)
spread.fromJSON(json);
if (
activeSheetName != null &&
activeRowIndex != null &&
activeColumnIndex != null
) {
spread.setActiveSheet(activeSheetName);
let sheet = spread.getActiveSheet();
sheet.setActiveCell(activeRowIndex, activeColumnIndex);
sheet.showCell(
activeRowIndex,
activeColumnIndex,
GC.Spread.Sheets.VerticalPosition.center,
GC.Spread.Sheets.HorizontalPosition.center
);
}
resetDataInf.value = true; //重置数据接口组件的数据
if (flag.value) {
//flag = true 只要重新获取数据
initData_dataIn(dataObject);
} else {
//flag = fasle 重新获取全部
initAll_resources(dataObject);
}
},
(e) => {
console.log(e);
}
);
})
.catch((error) => {
console.log(error);
});
}
|