diff --git a/source/cell/cell_reference.cpp b/source/cell/cell_reference.cpp index 385e84d34..d996adab6 100644 --- a/source/cell/cell_reference.cpp +++ b/source/cell/cell_reference.cpp @@ -174,13 +174,13 @@ std::pair cell_reference::split_reference( if (column_string[0] == '$') { - absolute_row = true; + absolute_column = true; column_string = column_string.substr(1); } if (row_string[0] == '$') { - absolute_column = true; + absolute_row = true; row_string = row_string.substr(1); } diff --git a/tests/cell/cell_test_suite.cpp b/tests/cell/cell_test_suite.cpp index e388da51f..2cd04b7ef 100644 --- a/tests/cell/cell_test_suite.cpp +++ b/tests/cell/cell_test_suite.cpp @@ -665,8 +665,16 @@ class cell_test_suite : public test_suite xlnt_assert_throws(xlnt::cell_reference("A"), xlnt::invalid_cell_reference); auto ref = xlnt::cell_reference("$B$7"); - xlnt_assert(ref.row_absolute()); - xlnt_assert(ref.column_absolute()); + xlnt_assert_equals(ref.row_absolute(), true); + xlnt_assert_equals(ref.column_absolute(), true); + + ref = xlnt::cell_reference("$B7"); + xlnt_assert_equals(ref.row_absolute(), false); + xlnt_assert_equals(ref.column_absolute(), true); + + ref = xlnt::cell_reference("B$7"); + xlnt_assert_equals(ref.row_absolute(), true); + xlnt_assert_equals(ref.column_absolute(), false); xlnt_assert(xlnt::cell_reference("A1") == "A1"); xlnt_assert(xlnt::cell_reference("A1") != "A2");