tfussell / xlnt

:bar_chart: Cross-platform user-friendly xlsx library for C++11+
Other
1.49k stars 418 forks source link

Writing and saving to a file - damages the file. #523

Open ghost opened 3 years ago

ghost commented 3 years ago

Writing and saving to a file .xlsx - breaks the xml structure of an exel file and the file does not open.

Here's some simple code that demonstrates this: { xlnt::workbook my_worbook;
xlnt::worksheet my_sheet;

my_worbook.load(u8"С:\excel\1.xlsx"); my_sheet = my_worbook.sheet_by_title(u8"Sheet1");

my_sheet.cell(xlnt::cell_reference(1, 1)).value(50);

my_worbook.save(u8"С:\excel\1.xlsx"); }

All, after executing this code - the file 1.xlsx file does not open, the file is damaged.

tfussell commented 3 years ago

Thanks. There are quite a few unit tests that ensure that files are reliably round-tripped (i.e. a file can be opened, modified, and written and vice versa) but sometimes XML issues slip through. I'll try to reproduce.

fly2sky2018 commented 3 years ago

meet the same problem... simple code { wb.save("Test.xlsx"); }

pop:

0x00007FFF53AA3C58 处(位于myMFC.exe 中)有未经处理的异常: Microsoft C++ 异常: xml::serialization,位于内存位置 0x00000098F54FDAC0 处。

OpenClipboard 失败,异常来自 HRESULT:0×800401D0 (CLIPBRD_E_CANT_OPEN)

how to kill the bug???

frank28 commented 2 years ago

Hi,

I've got the same issue here, after "open, modify and save" of an xlsx file, the file is reported as damaged. Excel could fix and resave the file though. Wondering if this bug has some update?

Thanks.