tfussell / xlnt

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

The xlsx file is successfully generated, but there is a repair prompt when it is opened. Click OK to display the view (Workbook) of the deleted records: / XL / workbook.xml section What is the reason? Is it a version problem? #587

Open kematy opened 3 years ago

kematy commented 3 years ago

The xlsx file is successfully generated, but there is a repair prompt when it is opened. Click OK to display the view (Workbook) of the deleted records: / XL / workbook.xml section What is the reason? Is it a version problem?

Repaired records: string attribute (string) of: / XL / sharedstrings.xml section 成功生成了xlsx文件,但是在打开时有修复提示,点击确定出现:已删除的记录: /xl/workbook.xml 部分的 视图 (工作簿) 已修复的记录: /xl/sharedStrings.xml 部分的 字符串属性 (字符串)

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>

error111440_01.xml在文件“G:\xlnt_projs\samples\Stress_Sag_result.xlsx”中检测到错误已删除的记录: /xl/workbook.xml 部分的 视图 (工作簿)已修复的记录: /xl/sharedStrings.xml 部分的 字符串属性 (字符串)

请问是什么原因?难道是版本的问题吗?

tfussell commented 2 years ago

Please attach a file so I can see which part is corrupt.

StubbornSlug commented 2 years ago

Please attach a file so I can see which part is corrupt. test.xlsx test2.xlsx Code:

void sample_read_and_print_example()
{
xlnt::workbook wb;
wb.load("D:/pyxlnt/msvc/Release/test.xlsx"); // modified to use the test data directory
for (std::string name: wb.sheet_titles())
{
std::clog << name << std::endl;
}
auto ws = wb.active_sheet();
std::clog << "Processing spread sheet" << std::endl;
for (auto row : ws.rows(false))
{
for (auto cell : row)
{
std::string str1 = cell.to_string();
std::string str2 = UTF8_To_string(str1);
std::cout << str2 << std::endl;
}
}
wb.save("D:/pyxlnt/msvc/Release/test2.xlsx");
std::clog << "Processing complete" << std::endl;
}

There is a repair prompt when it is opened by excel of office 365. image image