江湖初学者 2023-07-01 22:03 采纳率: 0%
浏览 24

c++编写的OTL库读取.xlsx内容的方法?

不知道如何连接xlsx文件,使用OTL库,要求使用字符连接。

  • 写回答

5条回答 默认 最新

  • Minuw 2023-07-01 22:19
    关注
    #include <xlnt/xlnt.hpp>
    
    xlnt::workbook wb;
    
    wb.load("example.xlsx");
    auto ws = wb.active_sheet();
    
    std::string cell_value = ws.cell("A1").value().as<std::string>();
    
    std::string result;
    for (const auto& row : ws) {
        for (const auto& cell : row) {
            result += cell.to_string() + "\t";
        }
        result += "\n";
    }
    
    评论

报告相同问题?

问题事件

  • 创建了问题 7月1日