should fix issue #9

This commit is contained in:
Thomas Fussell 2015-10-01 23:22:46 -04:00
parent c03f7d28e4
commit 8dc7342137

View File

@ -167,9 +167,16 @@ std::string writer::write_workbook(const workbook &wb)
for(auto relationship : wb.get_relationships())
{
if(relationship.get_type() == relationship::type::worksheet)
{
std::string sheet_index_string = relationship.get_target_uri().substr(16);
std::size_t sheet_index = std::stoi(sheet_index_string.substr(0, sheet_index_string.find('.'))) - 1;
{
std::string sheet_index_string = relationship.get_target_uri();
sheet_index_string = sheet_index_string.substr(0, sheet_index_string.find('.'));
sheet_index_string = sheet_index_string.substr(sheet_index_string.find_last_of('/'));
auto iter = sheet_index_string.end();
iter--;
while (isdigit(*iter)) iter--;
auto first_digit = iter - sheet_index_string.begin();
sheet_index_string = sheet_index_string.substr(first_digit + 1);
std::size_t sheet_index = std::stoi(sheet_index_string) - 1;
auto ws = wb.get_sheet_by_index(sheet_index);