{"action":"created","issue":{"url":"https://api.github.com/repos/tfussell/xlnt/issues/9","labels_url":"https://api.github.com/repos/tfussell/xlnt/issues/9/labels{/name}","comments_url":"https://api.github.com/repos/tfussell/xlnt/issues/9/comments","events_url":"https://api.github.com/repos/tfussell/xlnt/issues/9/events","html_url":"https://github.com/tfussell/xlnt/issues/9","id":108799596,"number":9,"title":"Unhandled exception from std::stoi when modifying .xlsx","user":{"login":"Malvineous","id":171656,"avatar_url":"https://avatars.githubusercontent.com/u/171656?v=3","gravatar_id":"","url":"https://api.github.com/users/Malvineous","html_url":"https://github.com/Malvineous","followers_url":"https://api.github.com/users/Malvineous/followers","following_url":"https://api.github.com/users/Malvineous/following{/other_user}","gists_url":"https://api.github.com/users/Malvineous/gists{/gist_id}","starred_url":"https://api.github.com/users/Malvineous/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Malvineous/subscriptions","organizations_url":"https://api.github.com/users/Malvineous/orgs","repos_url":"https://api.github.com/users/Malvineous/repos","events_url":"https://api.github.com/users/Malvineous/events{/privacy}","received_events_url":"https://api.github.com/users/Malvineous/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":9,"created_at":"2015-09-29T05:54:01Z","updated_at":"2015-10-06T13:01:11Z","closed_at":null,"body":"Sorry about spamming you with issues :-)\r\n\r\nIf you take `docs/sample/sample1.cpp` and change this line:\r\n\r\n    xlnt::workbook workbook;\r\n\r\nto this:\r\n\r\n    xlnt::workbook workbook = xlnt::reader::load_workbook(\"book.xlsx\");\r\n\r\nThen when you run the code, you get an unhandled exception error:\r\n\r\n    terminate called after throwing an instance of 'std::invalid_argument'\r\n      what():  stoi\r\n\r\nThe exception looks like it's got something to do with calculating the sheet index from the filename:\r\n```\r\n#9  0x00007ffff7b54f9e in xlnt::writer::write_workbook (wb=...) at writer.cpp:172\r\n172                 std::size_t sheet_index = std::stoi(sheet_index_string.substr(0, sheet_index_string.find('.'))) - 1;\r\n(gdb) print sheet_index_string\r\n$1 = \"eet1.xml\"\r\n```\r\nIt looks like the input file, produced by MS Excel, has a filename in a format that xlnt isn't expecting?\r\n\r\n`std::stoi()` seems to be encountering the `e` at the start of the string and then throwing `std::invalid_argument`, since it can only handle digits and leading whitespace."},"comment":{"url":"https://api.github.com/repos/tfussell/xlnt/issues/comments/145849728","html_url":"https://github.com/tfussell/xlnt/issues/9#issuecomment-145849728","issue_url":"https://api.github.com/repos/tfussell/xlnt/issues/9","id":145849728,"user":{"login":"tfussell","id":1735211,"avatar_url":"https://avatars.githubusercontent.com/u/1735211?v=3","gravatar_id":"","url":"https://api.github.com/users/tfussell","html_url":"https://github.com/tfussell","followers_url":"https://api.github.com/users/tfussell/followers","following_url":"https://api.github.com/users/tfussell/following{/other_user}","gists_url":"https://api.github.com/users/tfussell/gists{/gist_id}","starred_url":"https://api.github.com/users/tfussell/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tfussell/subscriptions","organizations_url":"https://api.github.com/users/tfussell/orgs","repos_url":"https://api.github.com/users/tfussell/repos","events_url":"https://api.github.com/users/tfussell/events{/privacy}","received_events_url":"https://api.github.com/users/tfussell/received_events","type":"User","site_admin":false},"created_at":"2015-10-06T13:01:10Z","updated_at":"2015-10-06T13:01:10Z","body":"Did you merge in the most recent commit, 690322? Sorry it's so complicated to get started. We'll get it working soon."}}