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

View File

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