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;
}
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;
}
}