mirror of
https://github.com/tfussell/xlnt.git
synced 2024-03-22 13:11:17 +08:00
Fix some issues after merge
This commit is contained in:
parent
0af7ad88e1
commit
cbe50f4681
|
@ -94,7 +94,7 @@ struct workbook_impl
|
|||
{
|
||||
return active_sheet_index_ == other.active_sheet_index_
|
||||
&& worksheets_ == other.worksheets_
|
||||
&& shared_strings_ == other.shared_strings_
|
||||
&& shared_strings_ids_ == other.shared_strings_ids_
|
||||
&& stylesheet_ == other.stylesheet_
|
||||
&& base_date_ == other.base_date_
|
||||
&& title_ == other.title_
|
||||
|
@ -138,7 +138,6 @@ struct workbook_impl
|
|||
optional<workbook_view> view_;
|
||||
optional<std::string> code_name_;
|
||||
|
||||
<<<<<<< Updated upstream
|
||||
struct file_version_t
|
||||
{
|
||||
std::string app_name;
|
||||
|
@ -154,17 +153,7 @@ struct workbook_impl
|
|||
&& rup_build == rhs.rup_build;
|
||||
}
|
||||
};
|
||||
|
||||
=======
|
||||
struct file_version_t
|
||||
{
|
||||
std::string app_name;
|
||||
std::size_t last_edited;
|
||||
std::size_t lowest_edited;
|
||||
std::size_t rup_build;
|
||||
};
|
||||
|
||||
>>>>>>> Stashed changes
|
||||
optional<file_version_t> file_version_;
|
||||
optional<calculation_properties> calculation_properties_;
|
||||
optional<std::string> abs_path_;
|
||||
|
|
|
@ -246,11 +246,7 @@ cell xlsx_consumer::read_cell()
|
|||
|
||||
if (parser().attribute_present("s"))
|
||||
{
|
||||
<<<<<<< Updated upstream
|
||||
cell.format(target_.format(static_cast<std::size_t>(std::stoull(parser().attribute("s")))));
|
||||
=======
|
||||
cell.format(target_.format(std::stoull(parser().attribute("s"))));
|
||||
>>>>>>> Stashed changes
|
||||
}
|
||||
|
||||
auto has_value = false;
|
||||
|
@ -540,15 +536,12 @@ std::string xlsx_consumer::read_worksheet_begin(const std::string &rel_id)
|
|||
current_selection.active_cell(parser().attribute("activeCell"));
|
||||
}
|
||||
|
||||
<<<<<<< Updated upstream
|
||||
if (parser().attribute_present("sqref"))
|
||||
{
|
||||
const auto sqref = range_reference(parser().attribute("sqref"));
|
||||
current_selection.sqref(sqref);
|
||||
}
|
||||
|
||||
=======
|
||||
>>>>>>> Stashed changes
|
||||
current_selection.pane(pane_corner::top_left);
|
||||
|
||||
new_view.add_selection(current_selection);
|
||||
|
@ -734,11 +727,7 @@ void xlsx_consumer::read_worksheet_sheetdata()
|
|||
|
||||
if (parser().attribute_present("s"))
|
||||
{
|
||||
<<<<<<< Updated upstream
|
||||
cell.format(target_.format(static_cast<std::size_t>(std::stoull(parser().attribute("s")))));
|
||||
=======
|
||||
cell.format(target_.format(std::stoull(parser().attribute("s"))));
|
||||
>>>>>>> Stashed changes
|
||||
}
|
||||
|
||||
auto has_value = false;
|
||||
|
|
|
@ -473,15 +473,11 @@ workbook workbook::empty()
|
|||
.color(theme_color(1));
|
||||
stylesheet.fonts.push_back(default_font);
|
||||
|
||||
<<<<<<< Updated upstream
|
||||
wb.create_builtin_style(0)
|
||||
.border(default_border)
|
||||
.fill(default_fill)
|
||||
.font(default_font)
|
||||
.number_format(xlnt::number_format::general());
|
||||
=======
|
||||
wb.create_builtin_style(0);
|
||||
>>>>>>> Stashed changes
|
||||
|
||||
wb.create_format(true)
|
||||
.border(default_border)
|
||||
|
|
|
@ -36,7 +36,6 @@ public:
|
|||
void test_all()
|
||||
{
|
||||
xlnt::workbook wb;
|
||||
auto ws = wb.active_sheet();
|
||||
auto test_style = wb.create_style("test_style");
|
||||
test_style.number_format(xlnt::number_format::date_ddmmyyyy());
|
||||
|
||||
|
@ -63,4 +62,4 @@ public:
|
|||
xlnt_assert(copy_style.quote_prefix());
|
||||
}
|
||||
};
|
||||
static style_test_suite x;
|
||||
static style_test_suite x;
|
||||
|
|
|
@ -110,7 +110,6 @@ public:
|
|||
const auto path = path_helper::test_file("3_default.xlsx");
|
||||
xlnt_assert(workbook_matches_file(wb, path));
|
||||
}
|
||||
<<<<<<< Updated upstream:tests/workbook/serialization_test_suite.cpp
|
||||
|
||||
void test_produce_simple_excel()
|
||||
{
|
||||
|
@ -246,103 +245,6 @@ public:
|
|||
|
||||
sheet1.cell("A5").hyperlink("https://google.com/");
|
||||
sheet1.cell("A5").format(hyperlink_format);
|
||||
=======
|
||||
|
||||
void test_produce_simple_excel()
|
||||
{
|
||||
xlnt::workbook wb;
|
||||
auto ws = wb.active_sheet();
|
||||
|
||||
auto bold_font = xlnt::font().bold(true);
|
||||
|
||||
ws.cell("A1").value("Type");
|
||||
ws.cell("A1").font(bold_font);
|
||||
|
||||
ws.cell("B1").value("Value");
|
||||
ws.cell("B1").font(bold_font);
|
||||
|
||||
ws.cell("A2").value("null");
|
||||
ws.cell("B2").value(nullptr);
|
||||
|
||||
ws.cell("A3").value("bool (true)");
|
||||
ws.cell("B3").value(true);
|
||||
|
||||
ws.cell("A4").value("bool (false)");
|
||||
ws.cell("B4").value(false);
|
||||
|
||||
ws.cell("A5").value("number (int)");
|
||||
ws.cell("B5").value(std::numeric_limits<int>::max());
|
||||
|
||||
ws.cell("A5").value("number (unsigned int)");
|
||||
ws.cell("B5").value(std::numeric_limits<unsigned int>::max());
|
||||
|
||||
ws.cell("A6").value("number (long long int)");
|
||||
ws.cell("B6").value(std::numeric_limits<long long int>::max());
|
||||
|
||||
ws.cell("A6").value("number (unsigned long long int)");
|
||||
ws.cell("B6").value(std::numeric_limits<unsigned long long int>::max());
|
||||
|
||||
ws.cell("A13").value("number (float)");
|
||||
ws.cell("B13").value(std::numeric_limits<float>::max());
|
||||
|
||||
ws.cell("A14").value("number (double)");
|
||||
ws.cell("B14").value(std::numeric_limits<double>::max());
|
||||
|
||||
ws.cell("A16").value("text (char *)");
|
||||
ws.cell("B16").value("string");
|
||||
|
||||
ws.cell("A17").value("text (std::string)");
|
||||
ws.cell("B17").value(std::string("string"));
|
||||
|
||||
ws.cell("A18").value("date");
|
||||
ws.cell("B18").value(xlnt::date(2016, 2, 3));
|
||||
|
||||
ws.cell("A19").value("time");
|
||||
ws.cell("B19").value(xlnt::time(1, 2, 3, 4));
|
||||
|
||||
ws.cell("A20").value("datetime");
|
||||
ws.cell("B20").value(xlnt::datetime(2016, 2, 3, 1, 2, 3, 4));
|
||||
|
||||
ws.cell("A21").value("timedelta");
|
||||
ws.cell("B21").value(xlnt::timedelta(1, 2, 3, 4, 5));
|
||||
|
||||
ws.freeze_panes("B2");
|
||||
|
||||
std::vector<std::uint8_t> temp_buffer;
|
||||
wb.save(temp_buffer);
|
||||
xlnt_assert(!temp_buffer.empty());
|
||||
}
|
||||
|
||||
void test_save_after_sheet_deletion()
|
||||
{
|
||||
xlnt::workbook workbook;
|
||||
|
||||
xlnt_assert_equals(workbook.sheet_titles().size(), 1);
|
||||
|
||||
auto sheet = workbook.create_sheet();
|
||||
sheet.title("XXX1");
|
||||
xlnt_assert_equals(workbook.sheet_titles().size(), 2);
|
||||
|
||||
workbook.remove_sheet(workbook.sheet_by_title("XXX1"));
|
||||
xlnt_assert_equals(workbook.sheet_titles().size(), 1);
|
||||
|
||||
std::vector<std::uint8_t> temp_buffer;
|
||||
xlnt_assert_throws_nothing(workbook.save(temp_buffer));
|
||||
xlnt_assert(!temp_buffer.empty());
|
||||
}
|
||||
|
||||
void test_write_comments_hyperlinks_formulae()
|
||||
{
|
||||
xlnt::workbook wb;
|
||||
auto sheet1 = wb.active_sheet();
|
||||
auto comment_font = xlnt::font().bold(true).size(10).color(xlnt::indexed_color(81)).name("Calibri");
|
||||
|
||||
sheet1.cell("A1").value("Sheet1!A1");
|
||||
sheet1.cell("A1").comment("Sheet1 comment", comment_font, "Microsoft Office User");
|
||||
|
||||
sheet1.cell("A2").value("Sheet1!A2");
|
||||
sheet1.cell("A2").comment("Sheet1 comment2", comment_font, "Microsoft Office User");
|
||||
>>>>>>> Stashed changes:tests/workbook/serialization_test_suite.hpp
|
||||
|
||||
sheet1.cell("A6").hyperlink(sheet1.cell("A1"));
|
||||
sheet1.cell("A6").format(hyperlink_format);
|
||||
|
@ -355,7 +257,6 @@ public:
|
|||
sheet1.cell("C2").value("a");
|
||||
sheet1.cell("C3").value("b");
|
||||
|
||||
<<<<<<< Updated upstream:tests/workbook/serialization_test_suite.cpp
|
||||
for (auto i = 1; i <= 7; ++i)
|
||||
{
|
||||
sheet1.row_properties(i).dy_descent = 0.2;
|
||||
|
@ -369,11 +270,6 @@ public:
|
|||
// comments
|
||||
sheet2.cell("A1").value("Sheet2!A1");
|
||||
sheet2.cell("A1").comment("Sheet2 comment", comment_font, "Microsoft Office User");
|
||||
=======
|
||||
auto sheet2 = wb.create_sheet();
|
||||
sheet2.cell("A1").value("Sheet2!A1");
|
||||
sheet2.cell("A2").comment("Sheet2 comment", comment_font, "Microsoft Office User");
|
||||
>>>>>>> Stashed changes:tests/workbook/serialization_test_suite.hpp
|
||||
|
||||
sheet2.cell("A2").value("Sheet2!A2");
|
||||
sheet2.cell("A2").comment("Sheet2 comment2", comment_font, "Microsoft Office User");
|
||||
|
@ -464,17 +360,11 @@ public:
|
|||
{
|
||||
#ifdef _MSC_VER
|
||||
xlnt::workbook wb;
|
||||
<<<<<<< Updated upstream:tests/workbook/serialization_test_suite.cpp
|
||||
// L"/9_unicode_Λ.xlsx" doesn't use wchar_t(0x039B) for the capital lambda...
|
||||
// L"/9_unicode_\u039B.xlsx" gives the corrct output
|
||||
const auto path = LSTRING_LITERAL(XLNT_TEST_DATA_DIR) L"/9_unicode_\u039B.xlsx"; // L"/9_unicode_Λ.xlsx"
|
||||
wb.load(path);
|
||||
xlnt_assert_equals(wb.active_sheet().cell("A1").value<std::string>(), u8"un\u00EFc\u00F4d\u0117!"); // u8"unïcôdė!"
|
||||
=======
|
||||
std::wstring path = LSTRING_LITERAL(XLNT_TEST_DATA_DIR) L"/9_unicode_Λ.xlsx";
|
||||
wb.load(path_normalized);
|
||||
xlnt_assert_equals(wb.active_sheet().cell("A1").value<std::string>(), u8"unicodê!");
|
||||
>>>>>>> Stashed changes:tests/workbook/serialization_test_suite.hpp
|
||||
#endif
|
||||
|
||||
#ifndef __MINGW32__
|
||||
|
@ -670,13 +560,8 @@ public:
|
|||
ws.column_properties("E").width = width;
|
||||
ws.column_properties("E").custom_width = true;
|
||||
|
||||
<<<<<<< Updated upstream:tests/workbook/serialization_test_suite.cpp
|
||||
xlnt_assert(workbook_matches_file(wb,
|
||||
path_helper::test_file("13_custom_heights_widths.xlsx")));
|
||||
=======
|
||||
wb.save("temp.xlsx");
|
||||
xlnt_assert(workbook_matches_file(wb, path_helper::test_file("13_custom_heights_widths.xlsx")));
|
||||
>>>>>>> Stashed changes:tests/workbook/serialization_test_suite.hpp
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
Loading…
Reference in New Issue
Block a user