This commit is contained in:
Thomas Fussell 2016-11-14 20:14:42 -06:00
parent b781aeb989
commit 2618237678
2 changed files with 10 additions and 5 deletions

View File

@ -1890,8 +1890,13 @@ void xlsx_consumer::read_worksheet(const std::string &rel_id)
if (parser().qname() == xml::qname(xmlns, "v"))
{
has_value = true;
parser().next_expect(xml::parser::event_type::characters);
value_string = parser().value();
// <v> might be empty, check first
if (parser().peek() == xml::parser::event_type::characters)
{
parser().next_expect(xml::parser::event_type::characters);
value_string = parser().value();
}
}
else if (parser().qname() == xml::qname(xmlns, "f"))
{

View File

@ -2164,11 +2164,11 @@ void xlsx_producer::write_worksheet(const relationship &rel)
}
else if (cell.has_formula())
{
serializer().element(xmlns, "f", cell.get_formula());
serializer().element(xmlns, "v", "");
serializer().element(xmlns, "f", cell.get_formula());
// todo (but probably not) could calculate the formula and set the value here
serializer().end_element(xmlns, "c");
continue;
continue;
}
}