node.js - Why does 'exceljs' package delete the scripts in an excel file when the javascript program interacts w

I have an excel file with a lot of scripts (office scripts). These scripts are linked with buttons insi

I have an excel file with a lot of scripts (office scripts). These scripts are linked with buttons inside the body of the excel file. I have written an Javascript app that I execute thought 'NodeJS'. This javascript reads the excel file, it makes some calculations and later the app put some results in the excel file (I use exceljs). The problem is that when I open the excel file, the buttons with the scripts have disappeared!. Can anyone help me! Thanks in advance.

      const ExcelJS = require('exceljs');
      const wb = new ExcelJS.Workbook();
      const fileName = 'Book.xlsx';

      (async () => {

        await wb.xlsx.readFile(fileName);
        const ws = wb.getWorksheet('RenM1ACont');
        const S_Bruto_00 = Number(ws.getCell('I69').value);


        ws.getCell('E61').value= tipoNumber;
        await wb.xlsx.writeFile(fileName);

})

Excel file with buttons

As can be seen in the image, before the program is run, the Excel file contains buttons with associated scripts. When the program is run through NodeJS, everything is correct except that the buttons, all of them, have disappeared and with them the scripts associated with each button.

I have an excel file with a lot of scripts (office scripts). These scripts are linked with buttons inside the body of the excel file. I have written an Javascript app that I execute thought 'NodeJS'. This javascript reads the excel file, it makes some calculations and later the app put some results in the excel file (I use exceljs). The problem is that when I open the excel file, the buttons with the scripts have disappeared!. Can anyone help me! Thanks in advance.

      const ExcelJS = require('exceljs');
      const wb = new ExcelJS.Workbook();
      const fileName = 'Book.xlsx';

      (async () => {

        await wb.xlsx.readFile(fileName);
        const ws = wb.getWorksheet('RenM1ACont');
        const S_Bruto_00 = Number(ws.getCell('I69').value);


        ws.getCell('E61').value= tipoNumber;
        await wb.xlsx.writeFile(fileName);

})

Excel file with buttons

As can be seen in the image, before the program is run, the Excel file contains buttons with associated scripts. When the program is run through NodeJS, everything is correct except that the buttons, all of them, have disappeared and with them the scripts associated with each button.

Share Improve this question asked Mar 8 at 1:45 PcouperPcouper 111 silver badge4 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 0

It’s likely that ExcelJS doesn’t recognize buttons, so it ignores them when parsing your file. As a result, when it writes the file back, it includes everything except the buttons

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744905383a4600223.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信