dtjohnson / xlsx-populate

Excel XLSX parser/generator written in JavaScript with Node.js and browser support, jQuery/d3-style method chaining, encryption, and a focus on keeping existing workbook features and styles in tact.
MIT License
956 stars 183 forks source link

Very important: Loss of styles and data! #368

Open Vaki-86 opened 4 months ago

Vaki-86 commented 4 months ago

Hello, people! My first test of the xlsx-populate library had a disappointing result. Note that I only executed the commands to open and save the file, without doing anything with data.

  const XlsxPopulate = require('xlsx-populate');   
  const workbook = await XlsxPopulate.fromFileAsync(filePathPosix);
  const mySheet = workbook.sheet(sheetName);

  // do nothing

  // write to file
  const filePathCopy= filePathPosix.replace('.xlsx', ' -child-1.xlsx');
  workbook.toFileAsync(filePathCopy);

test-result-compare

As you can see at first glance, the text format is gone. But if you go through all the cells with the Enter key or double-click, you can restore the appearance of these cells. (In fact, the format settings are preserved, we just have the wrong display).

And now the most important thing - the numbers after the 15th character have turned into ZEROS. This is, of course, a known Excel problem that can be solved by using a text format. But here there was a failure during saving and the information was irretrievably lost.

Xlsx-Populate version: 1.21.0 Excel version: 2016