当使用insertWorksheetsFromBase64在当前上下文中插入excel时,链接显示阻塞的内容



目前我已经创建了一个excel插件,我在文件上传中选择一个模板excel,并使用insertWorksheetsFromBase64方法将所有工作表从模板导入到当前工作簿。

let myFile = document.getElementById("file");
let reader = new FileReader();
reader.onload = (event) => {
Excel.run((context) => {
// Remove the metadata before the base64-encoded string.
let startIndex = reader.result.toString().indexOf("base64,");
let externalWorkbook = reader.result.toString().substr(startIndex + 7);

// Retrieve the current workbook.
let workbook = context.workbook;

// Set up the insert options. 
let options = { 
sheetNamesToInsert: [], // Insert all the worksheets from the source workbook.
positionType: Excel.WorksheetPositionType.after, // Insert after the `relativeTo` sheet.
relativeTo: "Sheet1" // The sheet relative to which the other worksheets will be inserted. Used with `positionType`.
}; 

// Insert the new worksheets into the current workbook.
workbook.insertWorksheetsFromBase64(externalWorkbook, options);
return context.sync();
});
};

// Read the file as a data URL so we can parse the base64-encoded string.
reader.readAsDataURL(myFile.files[0]);

但在此之后,插入的所有单元格链接显示阻塞的内容,如图所示错误截图

根据我的理解,它没有按照当前excel更新单元格引用。有没有人可以帮助我如何更新参考。

点击继续后得到下面的错误

continue后出错

我认为这是通过设计(这是一个安全警告),当你上传包含外部单元格引用的工作簿,然后在excel中在线打开工作簿时,你也会看到相同的消息。你可以点击&quot启用内容"继续。

最新更新