Skip to content

there is no way to read files under absolute paths #758

@wushuohua

Description

@wushuohua

int main() {
std::string file_path = "C:/Users/Name/Docs/test.xlsx";
std::ifstream file(file_path, std::ios::binary);
if (!file.is_open()) {
std::cerr << "Error: Failed to open file at '" << file_path << "'." << std::endl;
return 1;
}

xlnt::workbook wb;
try {
    wb.load(file);//it will report an error
    std::cout << "File loaded successfully!" << std::endl;
    auto ws = wb.active_sheet();
    std::cout << "First sheet name: " << ws.title() << std::endl;
}
catch (const std::exception& e) {
    std::cerr << "Error loading file: " << e.what() << std::endl;
    return 1;
}

file.close();
return 0;

}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions