mirror of
https://github.com/tfussell/xlnt.git
synced 2024-03-22 13:11:17 +08:00
Merge pull request #218 from sukoi26/dev
Dev: atttribut s optimize code
This commit is contained in:
commit
a21d659247
|
@ -218,9 +218,11 @@ cell xlsx_consumer::read_cell()
|
||||||
auto has_type = parser().attribute_present("t");
|
auto has_type = parser().attribute_present("t");
|
||||||
auto type = has_type ? parser().attribute("t") : "n";
|
auto type = has_type ? parser().attribute("t") : "n";
|
||||||
|
|
||||||
auto has_format = parser().attribute_present("s");
|
if (parser().attribute_present("s"))
|
||||||
auto format_id = static_cast<std::size_t>(has_format ? std::stoull(parser().attribute("s")) : 0LL);
|
{
|
||||||
|
cell.format(target_.format(std::stoull(parser().attribute("s"))));
|
||||||
|
}
|
||||||
|
|
||||||
auto has_value = false;
|
auto has_value = false;
|
||||||
auto value_string = std::string();
|
auto value_string = std::string();
|
||||||
|
|
||||||
|
@ -305,11 +307,6 @@ cell xlsx_consumer::read_cell()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (has_format)
|
|
||||||
{
|
|
||||||
cell.format(target_.format(format_id));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!in_element(qn("spreadsheetml", "row")))
|
if (!in_element(qn("spreadsheetml", "row")))
|
||||||
{
|
{
|
||||||
expect_end_element(qn("spreadsheetml", "row"));
|
expect_end_element(qn("spreadsheetml", "row"));
|
||||||
|
@ -599,9 +596,11 @@ void xlsx_consumer::read_worksheet_sheetdata()
|
||||||
|
|
||||||
auto has_type = parser().attribute_present("t");
|
auto has_type = parser().attribute_present("t");
|
||||||
auto type = has_type ? parser().attribute("t") : "n";
|
auto type = has_type ? parser().attribute("t") : "n";
|
||||||
|
|
||||||
auto has_format = parser().attribute_present("s");
|
if (parser().attribute_present("s"))
|
||||||
auto format_id = static_cast<std::size_t>(has_format ? std::stoull(parser().attribute("s")) : 0LL);
|
{
|
||||||
|
cell.format(target_.format(std::stoull(parser().attribute("s"))));
|
||||||
|
}
|
||||||
|
|
||||||
auto has_value = false;
|
auto has_value = false;
|
||||||
auto value_string = std::string();
|
auto value_string = std::string();
|
||||||
|
@ -685,10 +684,6 @@ void xlsx_consumer::read_worksheet_sheetdata()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (has_format)
|
|
||||||
{
|
|
||||||
cell.format(target_.format(format_id));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
expect_end_element(qn("spreadsheetml", "row"));
|
expect_end_element(qn("spreadsheetml", "row"));
|
||||||
|
|
Loading…
Reference in New Issue
Block a user