tfussell / xlnt

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

xlnt::exception : failed to find zip header, error in read #471

Closed birubisht13 closed 4 years ago

birubisht13 commented 4 years ago

Hi, I am trying to read a xls file in linux platform but getting following error : -

terminate called after throwing an instance of 'xlnt::exception' what(): xlnt::exception : failed to find zip header Aborted (core dumped)

code is taken from here [https://tfussell.gitbooks.io/xlnt/content/docs/introduction/Examples.html] -

 xlnt::workbook wb;
    wb.load(daily_stmt_file);
    auto ws = wb.active_sheet();
    cout << "Processing spread sheet" << std::endl;
    for (auto row : ws.rows(false))
    {
        for (auto cell : row)
        {
            cout << cell.to_string() << std::endl;
        }
    }
    cout << "Processing complete" << std::endl;

what could be the reason for this exception ?

tfussell commented 4 years ago

I'm sorry to say that xlnt only supports .xlsx (OOXML) files. To work with .xls files you'll need a different library such as ExcelFormat.