sc-im icon indicating copy to clipboard operation
sc-im copied to clipboard

With libxls support, sc-im breaks .xls files on write, while .xlsx files are OK

Open wkoszek opened this issue 3 years ago • 2 comments

First of all thanks for this program. It's great for easy and fast viewing of spreadsheets.

I just contributed Homebrew support for libxls under macOS, and added sc-im support for Excel reading to Homebrew. I'm testing reading/writing and I think we have a bug.

When you open .xlsx file, everything works: file opens fine, and I can write it, and it gets saved as .xlsx. For .xls however it doesn't work. Instead, the sc-im overwrites the original file as sc spreadsheet.

Test case:

wget https://file-examples-com.github.io/uploads/2017/02/file_example_XLSX_10.xlsx 
wget https://file-examples-com.github.io/uploads/2017/02/file_example_XLS_10.xls
% la *.xl*
-rw-r--r--  1 wk  staff  5425 Jul  9  2020 file_example_XLSX_10.xlsx
-rw-r--r--  1 wk  staff  8704 Jul  9  2020 file_example_XLS_10.xls
% sc-im file_example_XLSX_10.xlsx

I go to 1x1 and replace Dolce with >adam and do ESC + :wq.

Then:

% sc-im file_example_XLS_10.xls

I do the same edit. Result:

% la *.xl*
-rw-r--r--  1 wk  staff  5994 Nov 13 16:45 file_example_XLSX_10.xlsx
-rw-r--r--  1 wk  staff  1687 Nov 13 16:45 file_example_XLS_10.xls
% file file_example_XLSX_10.xlsx file_example_XLS_10.xls
file_example_XLSX_10.xlsx: Microsoft Excel 2007+
file_example_XLS_10.xls:   sc spreadsheet file

wkoszek avatar Nov 14 '21 00:11 wkoszek

Hello @wkoszek. Actually sc-im can only import xls files. It cannot write in that format. this is a limitation of libxls, the library in which sc-im relies for this format. Since this format was almost replaced by xlsx, i think it will never be added.

andmarti1424 avatar Dec 22 '21 13:12 andmarti1424

This sounds pretty similar to https://github.com/andmarti1424/sc-im/issues/606.

triallax avatar Mar 18 '22 22:03 triallax