Actualmente, he creado un complemento de Excel en el que estoy seleccionando una plantilla de Excel en la carga de archivos y usando el método insertWorksheetsFromBase64 para importar todas las hojas de la plantilla al libro de trabajo actual.
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]);Pero después de esto, todos los enlaces de celda en hojas insertadas muestran contenido bloqueado como se muestra en la imagen Captura de pantalla de error
Según tengo entendido, no está actualizando la referencia de celda según Excel actual. ¿Puede alguien ayudarme? ¿Cómo puedo actualizar la referencia también?
Actualizar Después de hacer clic en continuar, obtenga el siguiente error
Creo que es por diseño (es una advertencia de seguridad), cuando carga el libro de trabajo que contiene la referencia de celda externa y luego abre el libro de trabajo en Excel en línea, también verá el mismo mensaje. Puede simplemente hacer clic en "Habilitar contenido" para continuar.