mirror of
https://github.com/tfussell/xlnt.git
synced 2024-03-22 13:11:17 +08:00
clean up comment parsing
This commit is contained in:
parent
91ea4d81ad
commit
26b0302aac
|
@ -2015,42 +2015,36 @@ void xlsx_consumer::read_comments(worksheet ws)
|
||||||
|
|
||||||
std::vector<std::string> authors;
|
std::vector<std::string> authors;
|
||||||
|
|
||||||
parser().next_expect(xml::parser::event_type::start_element, xmlns, "comments");
|
expect_start_element(xml::qname(xmlns, "comments"), xml::content::complex);
|
||||||
parser().content(xml::content::complex);
|
expect_start_element(xml::qname(xmlns, "authors"), xml::content::complex);
|
||||||
parser().next_expect(xml::parser::event_type::start_element, xmlns, "authors");
|
|
||||||
parser().content(xml::content::complex);
|
|
||||||
|
|
||||||
while (in_element(xml::qname(xmlns, "authors")))
|
while (in_element(xml::qname(xmlns, "authors")))
|
||||||
{
|
{
|
||||||
parser().next_expect(xml::parser::event_type::start_element, xmlns, "author");
|
expect_start_element(xml::qname(xmlns, "author"), xml::content::simple);
|
||||||
authors.push_back(read_text());
|
authors.push_back(read_text());
|
||||||
parser().next_expect(xml::parser::event_type::end_element, xmlns, "author");
|
expect_end_element(xml::qname(xmlns, "author"));
|
||||||
}
|
}
|
||||||
|
|
||||||
parser().next_expect(xml::parser::event_type::end_element, xmlns, "authors");
|
expect_end_element(xml::qname(xmlns, "authors"));
|
||||||
|
expect_start_element(xml::qname(xmlns, "commentList"), xml::content::complex);
|
||||||
parser().next_expect(xml::parser::event_type::start_element, xmlns, "commentList");
|
|
||||||
parser().content(xml::content::complex);
|
|
||||||
|
|
||||||
while (in_element(xml::qname(xmlns, "commentList")))
|
while (in_element(xml::qname(xmlns, "commentList")))
|
||||||
{
|
{
|
||||||
parser().next_expect(xml::parser::event_type::start_element, xmlns, "comment");
|
expect_start_element(xml::qname(xmlns, "comment"), xml::content::complex);
|
||||||
parser().content(xml::content::complex);
|
|
||||||
|
|
||||||
auto cell_ref = parser().attribute("ref");
|
auto cell_ref = parser().attribute("ref");
|
||||||
auto author_id = parser().attribute<std::size_t>("authorId");
|
auto author_id = parser().attribute<std::size_t>("authorId");
|
||||||
|
|
||||||
parser().next_expect(xml::parser::event_type::start_element, xmlns, "text");
|
expect_start_element(xml::qname(xmlns, "text"), xml::content::complex);
|
||||||
parser().content(xml::content::complex);
|
|
||||||
|
|
||||||
ws.get_cell(cell_ref).comment(comment(read_formatted_text(xmlns), authors.at(author_id)));
|
ws.get_cell(cell_ref).comment(comment(read_formatted_text(xmlns), authors.at(author_id)));
|
||||||
|
|
||||||
parser().next_expect(xml::parser::event_type::end_element, xmlns, "text");
|
expect_end_element(xml::qname(xmlns, "text"));
|
||||||
parser().next_expect(xml::parser::event_type::end_element, xmlns, "comment");
|
expect_end_element(xml::qname(xmlns, "comment"));
|
||||||
}
|
}
|
||||||
|
|
||||||
parser().next_expect(xml::parser::event_type::end_element, xmlns, "commentList");
|
expect_end_element(xml::qname(xmlns, "commentList"));
|
||||||
parser().next_expect(xml::parser::event_type::end_element, xmlns, "comments");
|
expect_end_element(xml::qname(xmlns, "comments"));
|
||||||
}
|
}
|
||||||
|
|
||||||
void xlsx_consumer::read_drawings()
|
void xlsx_consumer::read_drawings()
|
||||||
|
|
|
@ -2534,7 +2534,7 @@ void xlsx_producer::write_vml_drawings(const relationship &rel, worksheet ws,
|
||||||
|
|
||||||
while (filename[index_pos] >= '0' && filename[index_pos] <= '9')
|
while (filename[index_pos] >= '0' && filename[index_pos] <= '9')
|
||||||
{
|
{
|
||||||
index_pos--;
|
index_pos--;
|
||||||
}
|
}
|
||||||
|
|
||||||
auto file_index = std::stoull(filename.substr(index_pos + 1));
|
auto file_index = std::stoull(filename.substr(index_pos + 1));
|
||||||
|
|
Loading…
Reference in New Issue
Block a user