mirror of
https://github.com/tfussell/xlnt.git
synced 2024-03-22 13:11:17 +08:00
fix some windows build problems and warnings
This commit is contained in:
parent
9ae506c1ea
commit
47f74fd4c1
|
@ -71,6 +71,7 @@ if(SHARED)
|
||||||
target_compile_definitions(xlnt.shared PRIVATE XLNT_SHARED=1)
|
target_compile_definitions(xlnt.shared PRIVATE XLNT_SHARED=1)
|
||||||
if(MSVC)
|
if(MSVC)
|
||||||
target_compile_definitions(xlnt.shared PRIVATE XLNT_EXPORT=1)
|
target_compile_definitions(xlnt.shared PRIVATE XLNT_EXPORT=1)
|
||||||
|
target_compile_definitions(xlnt.shared PRIVATE PUGIXML_API=__declspec\(dllexport\))
|
||||||
set_target_properties(xlnt.shared PROPERTIES COMPILE_FLAGS "/wd\"4251\" /wd\"4275\"")
|
set_target_properties(xlnt.shared PROPERTIES COMPILE_FLAGS "/wd\"4251\" /wd\"4275\"")
|
||||||
endif()
|
endif()
|
||||||
install(TARGETS xlnt.shared
|
install(TARGETS xlnt.shared
|
||||||
|
|
|
@ -268,8 +268,7 @@ void excel_serializer::write_data(bool /*as_template*/)
|
||||||
{
|
{
|
||||||
const auto &strings = workbook_.get_shared_strings();
|
const auto &strings = workbook_.get_shared_strings();
|
||||||
pugi::xml_document shared_strings_xml;
|
pugi::xml_document shared_strings_xml;
|
||||||
shared_strings_serializer strings_serializer;
|
shared_strings_serializer::write_shared_strings(strings, shared_strings_xml);
|
||||||
strings_serializer.write_shared_strings(strings, shared_strings_xml);
|
|
||||||
shared_strings_xml.save(ss);
|
shared_strings_xml.save(ss);
|
||||||
|
|
||||||
archive_.writestr(constants::ArcSharedString(), ss.str());
|
archive_.writestr(constants::ArcSharedString(), ss.str());
|
||||||
|
|
|
@ -160,6 +160,7 @@ bool format_condition::satisfied_by(long double number) const
|
||||||
case condition_type::not_equal:
|
case condition_type::not_equal:
|
||||||
return number != value;
|
return number != value;
|
||||||
case condition_type::none:
|
case condition_type::none:
|
||||||
|
default:
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -471,11 +472,11 @@ void number_format_parser::finalize()
|
||||||
if (part.type == template_part::template_type::month_number
|
if (part.type == template_part::template_type::month_number
|
||||||
|| part.type == template_part::template_type::month_number_leading_zero)
|
|| part.type == template_part::template_type::month_number_leading_zero)
|
||||||
{
|
{
|
||||||
if (i < code.parts.size() - 2)
|
if (code.parts.size() > 1 && i < code.parts.size() - 2)
|
||||||
{
|
{
|
||||||
const auto &next = code.parts[i + 1];
|
const auto &next = code.parts[i + 1];
|
||||||
const auto &after_next = code.parts[i + 2];
|
const auto &after_next = code.parts[i + 2];
|
||||||
|
|
||||||
if (next.type == template_part::template_type::text
|
if (next.type == template_part::template_type::text
|
||||||
&& next.string == ":"
|
&& next.string == ":"
|
||||||
&& (after_next.type == template_part::template_type::second ||
|
&& (after_next.type == template_part::template_type::second ||
|
||||||
|
|
|
@ -411,17 +411,13 @@ xlnt::alignment read_alignment(const pugi::xml_node alignment_node)
|
||||||
align.set_wrap_text(is_true(alignment_node.attribute("wrapText").value()));
|
align.set_wrap_text(is_true(alignment_node.attribute("wrapText").value()));
|
||||||
align.set_shrink_to_fit(is_true(alignment_node.attribute("shrinkToFit").value()));
|
align.set_shrink_to_fit(is_true(alignment_node.attribute("shrinkToFit").value()));
|
||||||
|
|
||||||
bool has_vertical = alignment_node.attribute("vertical");
|
if (alignment_node.attribute("vertical"))
|
||||||
|
|
||||||
if (has_vertical)
|
|
||||||
{
|
{
|
||||||
std::string vertical = alignment_node.attribute("vertical").value();
|
std::string vertical = alignment_node.attribute("vertical").value();
|
||||||
align.set_vertical(vertical_alignment_from_string(vertical));
|
align.set_vertical(vertical_alignment_from_string(vertical));
|
||||||
}
|
}
|
||||||
|
|
||||||
bool has_horizontal = alignment_node.attribute("horizontal");
|
if (alignment_node.attribute("horizontal"))
|
||||||
|
|
||||||
if (has_horizontal)
|
|
||||||
{
|
{
|
||||||
std::string horizontal = alignment_node.attribute("horizontal").value();
|
std::string horizontal = alignment_node.attribute("horizontal").value();
|
||||||
align.set_horizontal(horizontal_alignment_from_string(horizontal));
|
align.set_horizontal(horizontal_alignment_from_string(horizontal));
|
||||||
|
|
|
@ -129,17 +129,17 @@ bool worksheet_serializer::read_worksheet(const pugi::xml_document &xml, detail:
|
||||||
|
|
||||||
if (cell_found)
|
if (cell_found)
|
||||||
{
|
{
|
||||||
bool has_value = cell_node.child("v");
|
bool has_value = cell_node.child("v") != nullptr;
|
||||||
std::string value_string = has_value ? cell_node.child("v").text().get() : "";
|
std::string value_string = has_value ? cell_node.child("v").text().get() : "";
|
||||||
|
|
||||||
bool has_type = cell_node.attribute("t");
|
bool has_type = cell_node.attribute("t") != nullptr;
|
||||||
std::string type = has_type ? cell_node.attribute("t").value() : "";
|
std::string type = has_type ? cell_node.attribute("t").value() : "";
|
||||||
|
|
||||||
bool has_format = cell_node.attribute("s");
|
bool has_format = cell_node.attribute("s") != nullptr;
|
||||||
auto format_id = static_cast<std::size_t>(has_format ? std::stoull(cell_node.attribute("s").value()) : 0LL);
|
auto format_id = static_cast<std::size_t>(has_format ? std::stoull(cell_node.attribute("s").value()) : 0LL);
|
||||||
|
|
||||||
bool has_formula = cell_node.child("f");
|
bool has_formula = cell_node.child("f") != nullptr;
|
||||||
bool has_shared_formula = has_formula && cell_node.child("f").attribute("t")
|
bool has_shared_formula = has_formula && cell_node.child("f").attribute("t") != nullptr
|
||||||
&& cell_node.child("f").attribute("t").value() == std::string("shared");
|
&& cell_node.child("f").attribute("t").value() == std::string("shared");
|
||||||
|
|
||||||
auto cell = sheet_.get_cell(address);
|
auto cell = sheet_.get_cell(address);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user