mirror of
https://github.com/tfussell/xlnt.git
synced 2024-03-22 13:11:17 +08:00
Merge remote-tracking branch 'xpol/shared-string-with-different-formatted-parts' into styles-refactoring
This commit is contained in:
commit
e1e29e1f30
|
@ -68,9 +68,17 @@ bool shared_strings_serializer::read_shared_strings(const xml_document &xml, std
|
|||
{
|
||||
strings.push_back(si_node.get_child("t").get_text());
|
||||
}
|
||||
else if (si_node.has_child("r"))
|
||||
else if (si_node.has_child("r")) // possible multiple text entities.
|
||||
{
|
||||
strings.push_back(si_node.get_child("r").get_child("t").get_text());
|
||||
std::string text;
|
||||
for (const auto& r_node : si_node.get_children())
|
||||
{
|
||||
if (r_node.get_name() == "r" && r_node.has_child("t"))
|
||||
{
|
||||
text += r_node.get_child("t").get_text();
|
||||
}
|
||||
}
|
||||
strings.push_back(std::move(text));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -184,6 +184,20 @@ public:
|
|||
TS_ASSERT_EQUALS(val, "Donald");
|
||||
}
|
||||
|
||||
void test_read_shared_strings_multiple_r_nodes()
|
||||
{
|
||||
auto path = PathHelper::GetDataDirectory("/reader/shared_strings-multiple_r_nodes.xlsx");
|
||||
|
||||
xlnt::workbook wb;
|
||||
xlnt::excel_serializer serializer(wb);
|
||||
|
||||
serializer.load_workbook(path);
|
||||
|
||||
auto ws = wb["Sheet1"];
|
||||
auto val = ws.get_cell("A1").get_value<std::string>();
|
||||
TS_ASSERT_EQUALS(val, "abcdef");
|
||||
}
|
||||
|
||||
xlnt::workbook date_mac_1904()
|
||||
{
|
||||
auto path = PathHelper::GetDataDirectory("/reader/date_1904.xlsx");
|
||||
|
|
BIN
tests/data/reader/shared_strings-multiple_r_nodes.xlsx
Normal file
BIN
tests/data/reader/shared_strings-multiple_r_nodes.xlsx
Normal file
Binary file not shown.
Loading…
Reference in New Issue
Block a user