mirror of
https://github.com/tfussell/xlnt.git
synced 2024-03-22 13:11:17 +08:00
some changes
This commit is contained in:
parent
0bc0b9c69f
commit
5ccc345f8c
|
@ -61,6 +61,9 @@ public:
|
||||||
|
|
||||||
void reset();
|
void reset();
|
||||||
|
|
||||||
|
bool has_file(const std::string &name);
|
||||||
|
bool has_file(const zip_info &name);
|
||||||
|
|
||||||
zip_info getinfo(const std::string &name);
|
zip_info getinfo(const std::string &name);
|
||||||
|
|
||||||
std::vector<zip_info> infolist();
|
std::vector<zip_info> infolist();
|
||||||
|
|
|
@ -79,9 +79,9 @@ public:
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
static const std::unordered_map<format, std::string, format_hash> format_strings;
|
static const std::unordered_map<format, std::string, format_hash> &format_strings();
|
||||||
static const std::unordered_map<int, std::string> builtin_formats;
|
static const std::unordered_map<int, std::string> &builtin_formats();
|
||||||
static const std::unordered_map<std::string, int> reversed_builtin_formats;
|
static const std::unordered_map<std::string, int> &reversed_builtin_formats();
|
||||||
|
|
||||||
static std::string builtin_format_code(int index);
|
static std::string builtin_format_code(int index);
|
||||||
static format lookup_format(int code);
|
static format lookup_format(int code);
|
||||||
|
|
|
@ -263,6 +263,8 @@ public:
|
||||||
const std::unordered_map<column_t, double> &get_column_dimensions() const;
|
const std::unordered_map<column_t, double> &get_column_dimensions() const;
|
||||||
const std::unordered_map<row_t, double> &get_row_dimensions() const;
|
const std::unordered_map<row_t, double> &get_row_dimensions() const;
|
||||||
|
|
||||||
|
std::string unique_sheet_name(const std::string &value) const;
|
||||||
|
|
||||||
// named range
|
// named range
|
||||||
void create_named_range(const std::string &name, const range_reference &reference);
|
void create_named_range(const std::string &name, const range_reference &reference);
|
||||||
bool has_named_range(const std::string &name);
|
bool has_named_range(const std::string &name);
|
||||||
|
|
|
@ -234,6 +234,9 @@ void cell::set_value(double d)
|
||||||
void cell::set_value(const date &d)
|
void cell::set_value(const date &d)
|
||||||
{
|
{
|
||||||
d_->is_date_ = true;
|
d_->is_date_ = true;
|
||||||
|
auto date_format_code = xlnt::number_format::lookup_format(14);
|
||||||
|
auto number_format = xlnt::number_format(date_format_code);
|
||||||
|
get_style().set_number_format(number_format);
|
||||||
auto base_date = get_parent().get_parent().get_properties().excel_base_date;
|
auto base_date = get_parent().get_parent().get_properties().excel_base_date;
|
||||||
set_value(d.to_number(base_date));
|
set_value(d.to_number(base_date));
|
||||||
}
|
}
|
||||||
|
@ -241,6 +244,9 @@ void cell::set_value(const date &d)
|
||||||
void cell::set_value(const datetime &d)
|
void cell::set_value(const datetime &d)
|
||||||
{
|
{
|
||||||
d_->is_date_ = true;
|
d_->is_date_ = true;
|
||||||
|
auto date_format_code = xlnt::number_format::lookup_format(22);
|
||||||
|
auto number_format = xlnt::number_format(date_format_code);
|
||||||
|
get_style().set_number_format(number_format);
|
||||||
auto base_date = get_parent().get_parent().get_properties().excel_base_date;
|
auto base_date = get_parent().get_parent().get_properties().excel_base_date;
|
||||||
set_value(d.to_number(base_date));
|
set_value(d.to_number(base_date));
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,8 +4,10 @@
|
||||||
|
|
||||||
namespace xlnt {
|
namespace xlnt {
|
||||||
|
|
||||||
const std::unordered_map<number_format::format, std::string, number_format::format_hash> number_format::format_strings =
|
const std::unordered_map<number_format::format, std::string, number_format::format_hash> &number_format::format_strings()
|
||||||
{
|
{
|
||||||
|
static const std::unordered_map<number_format::format, std::string, number_format::format_hash> strings =
|
||||||
|
{
|
||||||
{format::general, "General"},
|
{format::general, "General"},
|
||||||
{format::text, "@"},
|
{format::text, "@"},
|
||||||
{format::number, "0"},
|
{format::number, "0"},
|
||||||
|
@ -40,10 +42,15 @@ const std::unordered_map<number_format::format, std::string, number_format::form
|
||||||
{format::currency_usd_simple, "\"$\"#,##0.00_-"},
|
{format::currency_usd_simple, "\"$\"#,##0.00_-"},
|
||||||
{format::currency_usd, "$#,##0_-"},
|
{format::currency_usd, "$#,##0_-"},
|
||||||
{format::currency_eur_simple, "[$EUR ]#,##0.00_-"}
|
{format::currency_eur_simple, "[$EUR ]#,##0.00_-"}
|
||||||
};
|
};
|
||||||
|
|
||||||
const std::unordered_map<int, std::string> number_format::builtin_formats =
|
return strings;
|
||||||
|
}
|
||||||
|
|
||||||
|
const std::unordered_map<int, std::string> &number_format::builtin_formats()
|
||||||
{
|
{
|
||||||
|
static const std::unordered_map<int, std::string> formats =
|
||||||
|
{
|
||||||
{0, "General"},
|
{0, "General"},
|
||||||
{1, "0"},
|
{1, "0"},
|
||||||
{2, "0.00"},
|
{2, "0.00"},
|
||||||
|
@ -93,10 +100,15 @@ const std::unordered_map<int, std::string> number_format::builtin_formats =
|
||||||
//{40, "#,##0.00_);[Red]"},
|
//{40, "#,##0.00_);[Red]"},
|
||||||
//{47, "mm:ss.0"},
|
//{47, "mm:ss.0"},
|
||||||
//{55, "yyyy/mm/dd"}
|
//{55, "yyyy/mm/dd"}
|
||||||
};
|
};
|
||||||
|
|
||||||
const std::unordered_map<std::string, int> number_format::reversed_builtin_formats =
|
return formats;
|
||||||
|
}
|
||||||
|
|
||||||
|
const std::unordered_map<std::string, int> &number_format::reversed_builtin_formats()
|
||||||
{
|
{
|
||||||
|
static const std::unordered_map<std::string, int> formats =
|
||||||
|
{
|
||||||
{"General", 0},
|
{"General", 0},
|
||||||
{"0", 1},
|
{"0", 1},
|
||||||
{"0.00", 2},
|
{"0.00", 2},
|
||||||
|
@ -136,19 +148,22 @@ const std::unordered_map<std::string, int> number_format::reversed_builtin_forma
|
||||||
{"mmss.0", 47},
|
{"mmss.0", 47},
|
||||||
{"##0.0E+0", 48},
|
{"##0.0E+0", 48},
|
||||||
{"@", 49}
|
{"@", 49}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
return formats;
|
||||||
|
}
|
||||||
|
|
||||||
number_format::format number_format::lookup_format(int code)
|
number_format::format number_format::lookup_format(int code)
|
||||||
{
|
{
|
||||||
if(builtin_formats.find(code) == builtin_formats.end())
|
if(builtin_formats().find(code) == builtin_formats().end())
|
||||||
{
|
{
|
||||||
return format::unknown;
|
return format::unknown;
|
||||||
}
|
}
|
||||||
|
|
||||||
auto format_string = builtin_formats.at(code);
|
auto format_string = builtin_formats().at(code);
|
||||||
auto match = std::find_if(format_strings.begin(), format_strings.end(), [&](const std::pair<format, std::string> &p) { return p.second == format_string; });
|
auto match = std::find_if(format_strings().begin(), format_strings().end(), [&](const std::pair<format, std::string> &p) { return p.second == format_string; });
|
||||||
|
|
||||||
if(match == format_strings.end())
|
if(match == format_strings().end())
|
||||||
{
|
{
|
||||||
return format::unknown;
|
return format::unknown;
|
||||||
}
|
}
|
||||||
|
|
|
@ -187,9 +187,10 @@ std::vector<std::pair<std::string, std::string>> reader::read_content_types(zip_
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
doc.load(archive.read("[Content_Types].xml").c_str());
|
auto content_types_string = archive.read("[Content_Types].xml");
|
||||||
|
doc.load(content_types_string.c_str());
|
||||||
}
|
}
|
||||||
catch(std::out_of_range)
|
catch(std::exception e)
|
||||||
{
|
{
|
||||||
throw invalid_file_exception(archive.get_filename());
|
throw invalid_file_exception(archive.get_filename());
|
||||||
}
|
}
|
||||||
|
|
|
@ -63,6 +63,14 @@ std::string style_writer::write_table() const
|
||||||
style_sheet_node.append_attribute("mc:Ignorable").set_value("x14ac");
|
style_sheet_node.append_attribute("mc:Ignorable").set_value("x14ac");
|
||||||
style_sheet_node.append_attribute("xmlns:x14ac").set_value("http://schemas.microsoft.com/office/spreadsheetml/2009/9/ac");
|
style_sheet_node.append_attribute("xmlns:x14ac").set_value("http://schemas.microsoft.com/office/spreadsheetml/2009/9/ac");
|
||||||
|
|
||||||
|
for(auto style : get_styles())
|
||||||
|
{
|
||||||
|
if((int)style.get_number_format().get_format_code() > 163)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
auto fonts_node = style_sheet_node.append_child("fonts");
|
auto fonts_node = style_sheet_node.append_child("fonts");
|
||||||
fonts_node.append_attribute("count").set_value(1);
|
fonts_node.append_attribute("count").set_value(1);
|
||||||
fonts_node.append_attribute("x14ac:knownFonts").set_value(1);
|
fonts_node.append_attribute("x14ac:knownFonts").set_value(1);
|
||||||
|
|
|
@ -285,16 +285,23 @@ bool workbook::load(const std::vector<unsigned char> &data)
|
||||||
|
|
||||||
bool workbook::load(const std::string &filename)
|
bool workbook::load(const std::string &filename)
|
||||||
{
|
{
|
||||||
zip_file f(filename);
|
zip_file f;
|
||||||
//auto core_properties = read_core_properties();
|
|
||||||
//auto app_properties = read_app_properties();
|
|
||||||
auto content_types = reader::read_content_types(f);
|
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
f.load(filename);
|
||||||
|
}
|
||||||
|
catch(std::exception e)
|
||||||
|
{
|
||||||
|
throw invalid_file_exception(filename);
|
||||||
|
}
|
||||||
|
|
||||||
|
auto content_types = reader::read_content_types(f);
|
||||||
auto type = reader::determine_document_type(content_types);
|
auto type = reader::determine_document_type(content_types);
|
||||||
|
|
||||||
if(type != "excel")
|
if(type != "excel")
|
||||||
{
|
{
|
||||||
throw std::runtime_error("unsupported document type: " + filename);
|
throw invalid_file_exception(filename);
|
||||||
}
|
}
|
||||||
|
|
||||||
clear();
|
clear();
|
||||||
|
@ -317,20 +324,16 @@ bool workbook::load(const std::string &filename)
|
||||||
auto sheets_node = root_node.child("sheets");
|
auto sheets_node = root_node.child("sheets");
|
||||||
|
|
||||||
std::vector<std::string> shared_strings;
|
std::vector<std::string> shared_strings;
|
||||||
auto infolist = f.infolist();
|
if(f.has_file("xl/sharedStrings.xml"))
|
||||||
auto shared_strings_info = std::find_if(infolist.begin(), infolist.end(), [](const zip_info &info) { return info.filename == "xl/sharedStrings.xml"; });
|
|
||||||
if(shared_strings_info != infolist.end())
|
|
||||||
{
|
{
|
||||||
shared_strings = xlnt::reader::read_shared_string(f.read(*shared_strings_info));
|
shared_strings = xlnt::reader::read_shared_string(f.read("xl/sharedStrings.xml"));
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<int> number_format_ids;
|
std::vector<int> number_format_ids;
|
||||||
|
if(f.has_file("xl/styles.xml"))
|
||||||
auto styles_info = std::find_if(infolist.begin(), infolist.end(), [](const zip_info &info) { return info.filename == "xl/styles.xml"; });
|
|
||||||
if(shared_strings_info != infolist.end())
|
|
||||||
{
|
{
|
||||||
pugi::xml_document styles_doc;
|
pugi::xml_document styles_doc;
|
||||||
styles_doc.load(f.read(*styles_info).c_str());
|
styles_doc.load(f.read("xl/styles.xml").c_str());
|
||||||
auto stylesheet_node = styles_doc.child("styleSheet");
|
auto stylesheet_node = styles_doc.child("styleSheet");
|
||||||
auto cell_xfs_node = stylesheet_node.child("cellXfs");
|
auto cell_xfs_node = stylesheet_node.child("cellXfs");
|
||||||
|
|
||||||
|
@ -558,6 +561,8 @@ bool workbook::save(const std::string &filename)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
f.save(filename);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -37,6 +37,19 @@ bool worksheet::has_frozen_panes() const
|
||||||
return get_frozen_panes() != cell_reference("A1");
|
return get_frozen_panes() != cell_reference("A1");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::string worksheet::unique_sheet_name(const std::string &value) const
|
||||||
|
{
|
||||||
|
auto names = get_parent().get_sheet_names();
|
||||||
|
auto match = std::find(names.begin(), names.end(), value);
|
||||||
|
std::size_t append = 0;
|
||||||
|
while(match != names.end())
|
||||||
|
{
|
||||||
|
append++;
|
||||||
|
match = std::find(names.begin(), names.end(), value + std::to_string(append));
|
||||||
|
}
|
||||||
|
return append == 0 ? value : value + std::to_string(append);
|
||||||
|
}
|
||||||
|
|
||||||
void worksheet::create_named_range(const std::string &name, const range_reference &reference)
|
void worksheet::create_named_range(const std::string &name, const range_reference &reference)
|
||||||
{
|
{
|
||||||
d_->named_ranges_[name] = reference;
|
d_->named_ranges_[name] = reference;
|
||||||
|
|
|
@ -210,6 +210,11 @@ std::string writer::write_worksheet(worksheet ws, const std::vector<std::string>
|
||||||
root_node.append_attribute("xmlns:r").set_value(constants::Namespaces.at("r").c_str());
|
root_node.append_attribute("xmlns:r").set_value(constants::Namespaces.at("r").c_str());
|
||||||
auto sheet_pr_node = root_node.append_child("sheetPr");
|
auto sheet_pr_node = root_node.append_child("sheetPr");
|
||||||
auto outline_pr_node = sheet_pr_node.append_child("outlinePr");
|
auto outline_pr_node = sheet_pr_node.append_child("outlinePr");
|
||||||
|
if(!ws.get_page_setup().is_default())
|
||||||
|
{
|
||||||
|
auto page_set_up_pr_node = sheet_pr_node.append_child("pageSetUpPr");
|
||||||
|
page_set_up_pr_node.append_attribute("fitToPage").set_value(ws.get_page_setup().fit_to_page() ? 1 : 0);
|
||||||
|
}
|
||||||
outline_pr_node.append_attribute("summaryBelow").set_value(1);
|
outline_pr_node.append_attribute("summaryBelow").set_value(1);
|
||||||
outline_pr_node.append_attribute("summaryRight").set_value(1);
|
outline_pr_node.append_attribute("summaryRight").set_value(1);
|
||||||
auto dimension_node = root_node.append_child("dimension");
|
auto dimension_node = root_node.append_child("dimension");
|
||||||
|
@ -474,6 +479,13 @@ std::string writer::write_worksheet(worksheet ws, const std::vector<std::string>
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(!ws.get_page_setup().is_default())
|
||||||
|
{
|
||||||
|
auto print_options_node = root_node.append_child("printOptions");
|
||||||
|
print_options_node.append_attribute("horizontalCentered").set_value(ws.get_page_setup().get_horizontal_centered() ? 1 : 0);
|
||||||
|
print_options_node.append_attribute("verticalCentered").set_value(ws.get_page_setup().get_vertical_centered() ? 1 : 0);
|
||||||
|
}
|
||||||
|
|
||||||
auto page_margins_node = root_node.append_child("pageMargins");
|
auto page_margins_node = root_node.append_child("pageMargins");
|
||||||
|
|
||||||
page_margins_node.append_attribute("left").set_value(ws.get_page_margins().get_left());
|
page_margins_node.append_attribute("left").set_value(ws.get_page_margins().get_left());
|
||||||
|
@ -492,9 +504,6 @@ std::string writer::write_worksheet(worksheet ws, const std::vector<std::string>
|
||||||
page_setup_node.append_attribute("paperSize").set_value((int)ws.get_page_setup().get_paper_size());
|
page_setup_node.append_attribute("paperSize").set_value((int)ws.get_page_setup().get_paper_size());
|
||||||
page_setup_node.append_attribute("fitToHeight").set_value(ws.get_page_setup().fit_to_height() ? 1 : 0);
|
page_setup_node.append_attribute("fitToHeight").set_value(ws.get_page_setup().fit_to_height() ? 1 : 0);
|
||||||
page_setup_node.append_attribute("fitToWidth").set_value(ws.get_page_setup().fit_to_width() ? 1 : 0);
|
page_setup_node.append_attribute("fitToWidth").set_value(ws.get_page_setup().fit_to_width() ? 1 : 0);
|
||||||
|
|
||||||
auto page_set_up_pr_node = root_node.append_child("pageSetUpPr");
|
|
||||||
page_set_up_pr_node.append_attribute("fitToPage").set_value(ws.get_page_setup().fit_to_page() ? 1 : 0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!ws.get_header_footer().is_default())
|
if(!ws.get_header_footer().is_default())
|
||||||
|
|
|
@ -1,9 +1,11 @@
|
||||||
|
#include <algorithm>
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
|
|
||||||
#define MINIZ_HEADER_FILE_ONLY
|
#define MINIZ_HEADER_FILE_ONLY
|
||||||
#include "miniz.c"
|
#include "miniz.c"
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
|
#define NOMINMAX
|
||||||
#include <Windows.h>
|
#include <Windows.h>
|
||||||
#else
|
#else
|
||||||
|
|
||||||
|
@ -18,15 +20,19 @@ std::string get_working_directory()
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
TCHAR buffer[MAX_PATH];
|
TCHAR buffer[MAX_PATH];
|
||||||
GetCurrentDirectory(MAX_PATH, buffer);
|
GetCurrentDirectory(MAX_PATH, buffer);
|
||||||
return buffer;
|
std::wstring working_directory(buffer);
|
||||||
#endif
|
return std::string(working_directory.begin(), working_directory.end());
|
||||||
|
#else
|
||||||
return "";
|
return "";
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
char directory_separator = '\\';
|
char directory_separator = '\\';
|
||||||
|
char alt_directory_separator = '/';
|
||||||
#else
|
#else
|
||||||
char directory_separator = '/';
|
char directory_separator = '/';
|
||||||
|
char alt_directory_separator = '\\';
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
std::string join_path(const std::vector<std::string> &parts)
|
std::string join_path(const std::vector<std::string> &parts)
|
||||||
|
@ -39,27 +45,44 @@ std::string join_path(const std::vector<std::string> &parts)
|
||||||
|
|
||||||
if(i++ != parts.size() - 1)
|
if(i++ != parts.size() - 1)
|
||||||
{
|
{
|
||||||
joined.append(1, directory_separator);
|
joined.append(1, '/');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return joined;
|
return joined;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<std::string> split_path(const std::string &path)
|
std::vector<std::string> split_path(const std::string &path, char delim = directory_separator)
|
||||||
{
|
{
|
||||||
std::vector<std::string> split;
|
std::vector<std::string> split;
|
||||||
std::string::size_type previous_index = 0;
|
std::string::size_type previous_index = 0;
|
||||||
auto separator_index = path.find(directory_separator);
|
auto separator_index = path.find(delim);
|
||||||
|
|
||||||
while(separator_index != std::string::npos)
|
while(separator_index != std::string::npos)
|
||||||
{
|
{
|
||||||
split.push_back(path.substr(previous_index, separator_index));
|
auto part = path.substr(previous_index, separator_index - previous_index);
|
||||||
|
if(part != "..")
|
||||||
|
{
|
||||||
|
split.push_back(part);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
split.pop_back();
|
||||||
|
}
|
||||||
previous_index = separator_index + 1;
|
previous_index = separator_index + 1;
|
||||||
separator_index = path.find(previous_index, directory_separator);
|
separator_index = path.find(delim, previous_index);
|
||||||
}
|
}
|
||||||
|
|
||||||
split.push_back(path.substr(previous_index));
|
split.push_back(path.substr(previous_index));
|
||||||
|
|
||||||
|
if(split.size() == 1 && delim == directory_separator)
|
||||||
|
{
|
||||||
|
auto alternative = split_path(path, alt_directory_separator);
|
||||||
|
if(alternative.size() > 1)
|
||||||
|
{
|
||||||
|
return alternative;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return split;
|
return split;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -156,7 +179,7 @@ zip_file::~zip_file()
|
||||||
void zip_file::load(std::istream &stream)
|
void zip_file::load(std::istream &stream)
|
||||||
{
|
{
|
||||||
reset();
|
reset();
|
||||||
buffer_.assign(std::istreambuf_iterator<char>(stream), {});
|
buffer_.assign(std::istreambuf_iterator<char>(stream), std::istreambuf_iterator<char>());
|
||||||
remove_comment();
|
remove_comment();
|
||||||
start_read();
|
start_read();
|
||||||
}
|
}
|
||||||
|
@ -229,7 +252,7 @@ void zip_file::append_comment()
|
||||||
{
|
{
|
||||||
if(!comment.empty())
|
if(!comment.empty())
|
||||||
{
|
{
|
||||||
uint16_t comment_length = comment.length();
|
auto comment_length = std::min((uint16_t)comment.length(), std::numeric_limits<uint16_t>::max());
|
||||||
buffer_[buffer_.size() - 2] = comment_length & 0xFF;
|
buffer_[buffer_.size() - 2] = comment_length & 0xFF;
|
||||||
buffer_[buffer_.size() - 1] = comment_length >> 8 & 0xFF;
|
buffer_[buffer_.size() - 1] = comment_length >> 8 & 0xFF;
|
||||||
std::copy(comment.begin(), comment.end(), std::back_inserter(buffer_));
|
std::copy(comment.begin(), comment.end(), std::back_inserter(buffer_));
|
||||||
|
@ -476,7 +499,7 @@ void zip_file::writestr(const std::string &arcname, const std::string &bytes)
|
||||||
start_write();
|
start_write();
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!mz_zip_writer_add_mem(archive_.get(), arcname.c_str(), bytes.data(), bytes.size(), MZ_DEFAULT_COMPRESSION))
|
if(!mz_zip_writer_add_mem(archive_.get(), arcname.c_str(), bytes.data(), bytes.size(), MZ_BEST_COMPRESSION))
|
||||||
{
|
{
|
||||||
throw std::runtime_error("write error");
|
throw std::runtime_error("write error");
|
||||||
}
|
}
|
||||||
|
@ -496,7 +519,7 @@ void zip_file::writestr(const zip_info &info, const std::string &bytes)
|
||||||
|
|
||||||
auto crc = crc32buf(bytes.c_str(), bytes.size());
|
auto crc = crc32buf(bytes.c_str(), bytes.size());
|
||||||
|
|
||||||
if(!mz_zip_writer_add_mem_ex(archive_.get(), info.filename.c_str(), bytes.data(), bytes.size(), info.comment.c_str(), (mz_uint16)info.comment.size(), MZ_DEFAULT_COMPRESSION, 0, crc))
|
if(!mz_zip_writer_add_mem_ex(archive_.get(), info.filename.c_str(), bytes.data(), bytes.size(), info.comment.c_str(), (mz_uint16)info.comment.size(), MZ_BEST_COMPRESSION, 0, crc))
|
||||||
{
|
{
|
||||||
throw std::runtime_error("write error");
|
throw std::runtime_error("write error");
|
||||||
}
|
}
|
||||||
|
@ -520,6 +543,23 @@ std::string zip_file::read(const std::string &name)
|
||||||
return read(getinfo(name));
|
return read(getinfo(name));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool zip_file::has_file(const std::string &name)
|
||||||
|
{
|
||||||
|
if(archive_->m_zip_mode != MZ_ZIP_MODE_READING)
|
||||||
|
{
|
||||||
|
start_read();
|
||||||
|
}
|
||||||
|
|
||||||
|
int index = mz_zip_reader_locate_file(archive_.get(), name.c_str(), nullptr, 0);
|
||||||
|
|
||||||
|
return index != -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool zip_file::has_file(const zip_info &name)
|
||||||
|
{
|
||||||
|
return has_file(name.filename);
|
||||||
|
}
|
||||||
|
|
||||||
std::vector<zip_info> zip_file::infolist()
|
std::vector<zip_info> zip_file::infolist()
|
||||||
{
|
{
|
||||||
if(archive_->m_zip_mode != MZ_ZIP_MODE_READING)
|
if(archive_->m_zip_mode != MZ_ZIP_MODE_READING)
|
||||||
|
|
|
@ -21,7 +21,7 @@ int main( int argc, char *argv[] ) {
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
bool suite_test_cell_init = false;
|
bool suite_test_cell_init = false;
|
||||||
#include "/Users/thomas/Development/xlnt/tests/test_cell.hpp"
|
#include "C:\Users\taf656\Development\xlnt\tests\test_cell.hpp"
|
||||||
|
|
||||||
static test_cell suite_test_cell;
|
static test_cell suite_test_cell;
|
||||||
|
|
||||||
|
@ -256,7 +256,7 @@ public:
|
||||||
void runTest() { suite_test_cell.test_cell_offset(); }
|
void runTest() { suite_test_cell.test_cell_offset(); }
|
||||||
} testDescription_suite_test_cell_test_cell_offset;
|
} testDescription_suite_test_cell_test_cell_offset;
|
||||||
|
|
||||||
#include "/Users/thomas/Development/xlnt/tests/test_chart.hpp"
|
#include "C:\Users\taf656\Development\xlnt\tests\test_chart.hpp"
|
||||||
|
|
||||||
static test_chart suite_test_chart;
|
static test_chart suite_test_chart;
|
||||||
|
|
||||||
|
@ -347,7 +347,7 @@ public:
|
||||||
void runTest() { suite_test_chart.test_write_chart_scatter(); }
|
void runTest() { suite_test_chart.test_write_chart_scatter(); }
|
||||||
} testDescription_suite_test_chart_test_write_chart_scatter;
|
} testDescription_suite_test_chart_test_write_chart_scatter;
|
||||||
|
|
||||||
#include "/Users/thomas/Development/xlnt/tests/test_named_range.hpp"
|
#include "C:\Users\taf656\Development\xlnt\tests\test_named_range.hpp"
|
||||||
|
|
||||||
static test_named_range suite_test_named_range;
|
static test_named_range suite_test_named_range;
|
||||||
|
|
||||||
|
@ -438,7 +438,7 @@ public:
|
||||||
void runTest() { suite_test_named_range.test_can_be_saved(); }
|
void runTest() { suite_test_named_range.test_can_be_saved(); }
|
||||||
} testDescription_suite_test_named_range_test_can_be_saved;
|
} testDescription_suite_test_named_range_test_can_be_saved;
|
||||||
|
|
||||||
#include "/Users/thomas/Development/xlnt/tests/test_number_format.hpp"
|
#include "C:\Users\taf656\Development\xlnt\tests\test_number_format.hpp"
|
||||||
|
|
||||||
static test_number_format suite_test_number_format;
|
static test_number_format suite_test_number_format;
|
||||||
|
|
||||||
|
@ -541,7 +541,7 @@ public:
|
||||||
void runTest() { suite_test_number_format.test_mac_date(); }
|
void runTest() { suite_test_number_format.test_mac_date(); }
|
||||||
} testDescription_suite_test_number_format_test_mac_date;
|
} testDescription_suite_test_number_format_test_mac_date;
|
||||||
|
|
||||||
#include "/Users/thomas/Development/xlnt/tests/test_props.hpp"
|
#include "C:\Users\taf656\Development\xlnt\tests\test_props.hpp"
|
||||||
|
|
||||||
static test_props suite_test_props;
|
static test_props suite_test_props;
|
||||||
|
|
||||||
|
@ -584,7 +584,7 @@ public:
|
||||||
void runTest() { suite_test_props.test_write_properties_app(); }
|
void runTest() { suite_test_props.test_write_properties_app(); }
|
||||||
} testDescription_suite_test_props_test_write_properties_app;
|
} testDescription_suite_test_props_test_write_properties_app;
|
||||||
|
|
||||||
#include "/Users/thomas/Development/xlnt/tests/test_read.hpp"
|
#include "C:\Users\taf656\Development\xlnt\tests\test_read.hpp"
|
||||||
|
|
||||||
static test_read suite_test_read;
|
static test_read suite_test_read;
|
||||||
|
|
||||||
|
@ -777,7 +777,7 @@ public:
|
||||||
void runTest() { suite_test_read.test_bad_formats_no(); }
|
void runTest() { suite_test_read.test_bad_formats_no(); }
|
||||||
} testDescription_suite_test_read_test_bad_formats_no;
|
} testDescription_suite_test_read_test_bad_formats_no;
|
||||||
|
|
||||||
#include "/Users/thomas/Development/xlnt/tests/test_strings.hpp"
|
#include "C:\Users\taf656\Development\xlnt\tests\test_strings.hpp"
|
||||||
|
|
||||||
static test_strings suite_test_strings;
|
static test_strings suite_test_strings;
|
||||||
|
|
||||||
|
@ -808,7 +808,7 @@ public:
|
||||||
void runTest() { suite_test_strings.test_formatted_string_table(); }
|
void runTest() { suite_test_strings.test_formatted_string_table(); }
|
||||||
} testDescription_suite_test_strings_test_formatted_string_table;
|
} testDescription_suite_test_strings_test_formatted_string_table;
|
||||||
|
|
||||||
#include "/Users/thomas/Development/xlnt/tests/test_style.hpp"
|
#include "C:\Users\taf656\Development\xlnt\tests\test_style.hpp"
|
||||||
|
|
||||||
static test_style suite_test_style;
|
static test_style suite_test_style;
|
||||||
|
|
||||||
|
@ -917,7 +917,7 @@ public:
|
||||||
void runTest() { suite_test_style.test_protection(); }
|
void runTest() { suite_test_style.test_protection(); }
|
||||||
} testDescription_suite_test_style_test_protection;
|
} testDescription_suite_test_style_test_protection;
|
||||||
|
|
||||||
#include "/Users/thomas/Development/xlnt/tests/test_theme.hpp"
|
#include "C:\Users\taf656\Development\xlnt\tests\test_theme.hpp"
|
||||||
|
|
||||||
static test_theme suite_test_theme;
|
static test_theme suite_test_theme;
|
||||||
|
|
||||||
|
@ -930,7 +930,7 @@ public:
|
||||||
void runTest() { suite_test_theme.test_write_theme(); }
|
void runTest() { suite_test_theme.test_write_theme(); }
|
||||||
} testDescription_suite_test_theme_test_write_theme;
|
} testDescription_suite_test_theme_test_write_theme;
|
||||||
|
|
||||||
#include "/Users/thomas/Development/xlnt/tests/test_workbook.hpp"
|
#include "C:\Users\taf656\Development\xlnt\tests\test_workbook.hpp"
|
||||||
|
|
||||||
static test_workbook suite_test_workbook;
|
static test_workbook suite_test_workbook;
|
||||||
|
|
||||||
|
@ -1051,7 +1051,7 @@ public:
|
||||||
void runTest() { suite_test_workbook.test_write_regular_float(); }
|
void runTest() { suite_test_workbook.test_write_regular_float(); }
|
||||||
} testDescription_suite_test_workbook_test_write_regular_float;
|
} testDescription_suite_test_workbook_test_write_regular_float;
|
||||||
|
|
||||||
#include "/Users/thomas/Development/xlnt/tests/test_worksheet.hpp"
|
#include "C:\Users\taf656\Development\xlnt\tests\test_worksheet.hpp"
|
||||||
|
|
||||||
static test_worksheet suite_test_worksheet;
|
static test_worksheet suite_test_worksheet;
|
||||||
|
|
||||||
|
@ -1102,197 +1102,197 @@ public:
|
||||||
|
|
||||||
static class TestDescription_suite_test_worksheet_test_worksheet_dimension : public CxxTest::RealTestDescription {
|
static class TestDescription_suite_test_worksheet_test_worksheet_dimension : public CxxTest::RealTestDescription {
|
||||||
public:
|
public:
|
||||||
TestDescription_suite_test_worksheet_test_worksheet_dimension() : CxxTest::RealTestDescription( Tests_test_worksheet, suiteDescription_test_worksheet, 61, "test_worksheet_dimension" ) {}
|
TestDescription_suite_test_worksheet_test_worksheet_dimension() : CxxTest::RealTestDescription( Tests_test_worksheet, suiteDescription_test_worksheet, 62, "test_worksheet_dimension" ) {}
|
||||||
void runTest() { suite_test_worksheet.test_worksheet_dimension(); }
|
void runTest() { suite_test_worksheet.test_worksheet_dimension(); }
|
||||||
} testDescription_suite_test_worksheet_test_worksheet_dimension;
|
} testDescription_suite_test_worksheet_test_worksheet_dimension;
|
||||||
|
|
||||||
static class TestDescription_suite_test_worksheet_test_worksheet_range : public CxxTest::RealTestDescription {
|
static class TestDescription_suite_test_worksheet_test_worksheet_range : public CxxTest::RealTestDescription {
|
||||||
public:
|
public:
|
||||||
TestDescription_suite_test_worksheet_test_worksheet_range() : CxxTest::RealTestDescription( Tests_test_worksheet, suiteDescription_test_worksheet, 70, "test_worksheet_range" ) {}
|
TestDescription_suite_test_worksheet_test_worksheet_range() : CxxTest::RealTestDescription( Tests_test_worksheet, suiteDescription_test_worksheet, 71, "test_worksheet_range" ) {}
|
||||||
void runTest() { suite_test_worksheet.test_worksheet_range(); }
|
void runTest() { suite_test_worksheet.test_worksheet_range(); }
|
||||||
} testDescription_suite_test_worksheet_test_worksheet_range;
|
} testDescription_suite_test_worksheet_test_worksheet_range;
|
||||||
|
|
||||||
static class TestDescription_suite_test_worksheet_test_worksheet_named_range : public CxxTest::RealTestDescription {
|
static class TestDescription_suite_test_worksheet_test_worksheet_named_range : public CxxTest::RealTestDescription {
|
||||||
public:
|
public:
|
||||||
TestDescription_suite_test_worksheet_test_worksheet_named_range() : CxxTest::RealTestDescription( Tests_test_worksheet, suiteDescription_test_worksheet, 78, "test_worksheet_named_range" ) {}
|
TestDescription_suite_test_worksheet_test_worksheet_named_range() : CxxTest::RealTestDescription( Tests_test_worksheet, suiteDescription_test_worksheet, 79, "test_worksheet_named_range" ) {}
|
||||||
void runTest() { suite_test_worksheet.test_worksheet_named_range(); }
|
void runTest() { suite_test_worksheet.test_worksheet_named_range(); }
|
||||||
} testDescription_suite_test_worksheet_test_worksheet_named_range;
|
} testDescription_suite_test_worksheet_test_worksheet_named_range;
|
||||||
|
|
||||||
static class TestDescription_suite_test_worksheet_test_bad_named_range : public CxxTest::RealTestDescription {
|
static class TestDescription_suite_test_worksheet_test_bad_named_range : public CxxTest::RealTestDescription {
|
||||||
public:
|
public:
|
||||||
TestDescription_suite_test_worksheet_test_bad_named_range() : CxxTest::RealTestDescription( Tests_test_worksheet, suiteDescription_test_worksheet, 88, "test_bad_named_range" ) {}
|
TestDescription_suite_test_worksheet_test_bad_named_range() : CxxTest::RealTestDescription( Tests_test_worksheet, suiteDescription_test_worksheet, 89, "test_bad_named_range" ) {}
|
||||||
void runTest() { suite_test_worksheet.test_bad_named_range(); }
|
void runTest() { suite_test_worksheet.test_bad_named_range(); }
|
||||||
} testDescription_suite_test_worksheet_test_bad_named_range;
|
} testDescription_suite_test_worksheet_test_bad_named_range;
|
||||||
|
|
||||||
static class TestDescription_suite_test_worksheet_test_named_range_wrong_sheet : public CxxTest::RealTestDescription {
|
static class TestDescription_suite_test_worksheet_test_named_range_wrong_sheet : public CxxTest::RealTestDescription {
|
||||||
public:
|
public:
|
||||||
TestDescription_suite_test_worksheet_test_named_range_wrong_sheet() : CxxTest::RealTestDescription( Tests_test_worksheet, suiteDescription_test_worksheet, 94, "test_named_range_wrong_sheet" ) {}
|
TestDescription_suite_test_worksheet_test_named_range_wrong_sheet() : CxxTest::RealTestDescription( Tests_test_worksheet, suiteDescription_test_worksheet, 95, "test_named_range_wrong_sheet" ) {}
|
||||||
void runTest() { suite_test_worksheet.test_named_range_wrong_sheet(); }
|
void runTest() { suite_test_worksheet.test_named_range_wrong_sheet(); }
|
||||||
} testDescription_suite_test_worksheet_test_named_range_wrong_sheet;
|
} testDescription_suite_test_worksheet_test_named_range_wrong_sheet;
|
||||||
|
|
||||||
static class TestDescription_suite_test_worksheet_test_cell_offset : public CxxTest::RealTestDescription {
|
static class TestDescription_suite_test_worksheet_test_cell_offset : public CxxTest::RealTestDescription {
|
||||||
public:
|
public:
|
||||||
TestDescription_suite_test_worksheet_test_cell_offset() : CxxTest::RealTestDescription( Tests_test_worksheet, suiteDescription_test_worksheet, 102, "test_cell_offset" ) {}
|
TestDescription_suite_test_worksheet_test_cell_offset() : CxxTest::RealTestDescription( Tests_test_worksheet, suiteDescription_test_worksheet, 103, "test_cell_offset" ) {}
|
||||||
void runTest() { suite_test_worksheet.test_cell_offset(); }
|
void runTest() { suite_test_worksheet.test_cell_offset(); }
|
||||||
} testDescription_suite_test_worksheet_test_cell_offset;
|
} testDescription_suite_test_worksheet_test_cell_offset;
|
||||||
|
|
||||||
static class TestDescription_suite_test_worksheet_test_range_offset : public CxxTest::RealTestDescription {
|
static class TestDescription_suite_test_worksheet_test_range_offset : public CxxTest::RealTestDescription {
|
||||||
public:
|
public:
|
||||||
TestDescription_suite_test_worksheet_test_range_offset() : CxxTest::RealTestDescription( Tests_test_worksheet, suiteDescription_test_worksheet, 108, "test_range_offset" ) {}
|
TestDescription_suite_test_worksheet_test_range_offset() : CxxTest::RealTestDescription( Tests_test_worksheet, suiteDescription_test_worksheet, 109, "test_range_offset" ) {}
|
||||||
void runTest() { suite_test_worksheet.test_range_offset(); }
|
void runTest() { suite_test_worksheet.test_range_offset(); }
|
||||||
} testDescription_suite_test_worksheet_test_range_offset;
|
} testDescription_suite_test_worksheet_test_range_offset;
|
||||||
|
|
||||||
static class TestDescription_suite_test_worksheet_test_cell_alternate_coordinates : public CxxTest::RealTestDescription {
|
static class TestDescription_suite_test_worksheet_test_cell_alternate_coordinates : public CxxTest::RealTestDescription {
|
||||||
public:
|
public:
|
||||||
TestDescription_suite_test_worksheet_test_cell_alternate_coordinates() : CxxTest::RealTestDescription( Tests_test_worksheet, suiteDescription_test_worksheet, 117, "test_cell_alternate_coordinates" ) {}
|
TestDescription_suite_test_worksheet_test_cell_alternate_coordinates() : CxxTest::RealTestDescription( Tests_test_worksheet, suiteDescription_test_worksheet, 118, "test_cell_alternate_coordinates" ) {}
|
||||||
void runTest() { suite_test_worksheet.test_cell_alternate_coordinates(); }
|
void runTest() { suite_test_worksheet.test_cell_alternate_coordinates(); }
|
||||||
} testDescription_suite_test_worksheet_test_cell_alternate_coordinates;
|
} testDescription_suite_test_worksheet_test_cell_alternate_coordinates;
|
||||||
|
|
||||||
static class TestDescription_suite_test_worksheet_test_cell_range_name : public CxxTest::RealTestDescription {
|
static class TestDescription_suite_test_worksheet_test_cell_range_name : public CxxTest::RealTestDescription {
|
||||||
public:
|
public:
|
||||||
TestDescription_suite_test_worksheet_test_cell_range_name() : CxxTest::RealTestDescription( Tests_test_worksheet, suiteDescription_test_worksheet, 124, "test_cell_range_name" ) {}
|
TestDescription_suite_test_worksheet_test_cell_range_name() : CxxTest::RealTestDescription( Tests_test_worksheet, suiteDescription_test_worksheet, 125, "test_cell_range_name" ) {}
|
||||||
void runTest() { suite_test_worksheet.test_cell_range_name(); }
|
void runTest() { suite_test_worksheet.test_cell_range_name(); }
|
||||||
} testDescription_suite_test_worksheet_test_cell_range_name;
|
} testDescription_suite_test_worksheet_test_cell_range_name;
|
||||||
|
|
||||||
static class TestDescription_suite_test_worksheet_test_garbage_collect : public CxxTest::RealTestDescription {
|
static class TestDescription_suite_test_worksheet_test_garbage_collect : public CxxTest::RealTestDescription {
|
||||||
public:
|
public:
|
||||||
TestDescription_suite_test_worksheet_test_garbage_collect() : CxxTest::RealTestDescription( Tests_test_worksheet, suiteDescription_test_worksheet, 136, "test_garbage_collect" ) {}
|
TestDescription_suite_test_worksheet_test_garbage_collect() : CxxTest::RealTestDescription( Tests_test_worksheet, suiteDescription_test_worksheet, 137, "test_garbage_collect" ) {}
|
||||||
void runTest() { suite_test_worksheet.test_garbage_collect(); }
|
void runTest() { suite_test_worksheet.test_garbage_collect(); }
|
||||||
} testDescription_suite_test_worksheet_test_garbage_collect;
|
} testDescription_suite_test_worksheet_test_garbage_collect;
|
||||||
|
|
||||||
static class TestDescription_suite_test_worksheet_test_hyperlink_relationships : public CxxTest::RealTestDescription {
|
static class TestDescription_suite_test_worksheet_test_hyperlink_relationships : public CxxTest::RealTestDescription {
|
||||||
public:
|
public:
|
||||||
TestDescription_suite_test_worksheet_test_hyperlink_relationships() : CxxTest::RealTestDescription( Tests_test_worksheet, suiteDescription_test_worksheet, 173, "test_hyperlink_relationships" ) {}
|
TestDescription_suite_test_worksheet_test_hyperlink_relationships() : CxxTest::RealTestDescription( Tests_test_worksheet, suiteDescription_test_worksheet, 174, "test_hyperlink_relationships" ) {}
|
||||||
void runTest() { suite_test_worksheet.test_hyperlink_relationships(); }
|
void runTest() { suite_test_worksheet.test_hyperlink_relationships(); }
|
||||||
} testDescription_suite_test_worksheet_test_hyperlink_relationships;
|
} testDescription_suite_test_worksheet_test_hyperlink_relationships;
|
||||||
|
|
||||||
static class TestDescription_suite_test_worksheet_test_bad_relationship_type : public CxxTest::RealTestDescription {
|
static class TestDescription_suite_test_worksheet_test_bad_relationship_type : public CxxTest::RealTestDescription {
|
||||||
public:
|
public:
|
||||||
TestDescription_suite_test_worksheet_test_bad_relationship_type() : CxxTest::RealTestDescription( Tests_test_worksheet, suiteDescription_test_worksheet, 193, "test_bad_relationship_type" ) {}
|
TestDescription_suite_test_worksheet_test_bad_relationship_type() : CxxTest::RealTestDescription( Tests_test_worksheet, suiteDescription_test_worksheet, 194, "test_bad_relationship_type" ) {}
|
||||||
void runTest() { suite_test_worksheet.test_bad_relationship_type(); }
|
void runTest() { suite_test_worksheet.test_bad_relationship_type(); }
|
||||||
} testDescription_suite_test_worksheet_test_bad_relationship_type;
|
} testDescription_suite_test_worksheet_test_bad_relationship_type;
|
||||||
|
|
||||||
static class TestDescription_suite_test_worksheet_test_append_list : public CxxTest::RealTestDescription {
|
static class TestDescription_suite_test_worksheet_test_append_list : public CxxTest::RealTestDescription {
|
||||||
public:
|
public:
|
||||||
TestDescription_suite_test_worksheet_test_append_list() : CxxTest::RealTestDescription( Tests_test_worksheet, suiteDescription_test_worksheet, 198, "test_append_list" ) {}
|
TestDescription_suite_test_worksheet_test_append_list() : CxxTest::RealTestDescription( Tests_test_worksheet, suiteDescription_test_worksheet, 199, "test_append_list" ) {}
|
||||||
void runTest() { suite_test_worksheet.test_append_list(); }
|
void runTest() { suite_test_worksheet.test_append_list(); }
|
||||||
} testDescription_suite_test_worksheet_test_append_list;
|
} testDescription_suite_test_worksheet_test_append_list;
|
||||||
|
|
||||||
static class TestDescription_suite_test_worksheet_test_append_dict_letter : public CxxTest::RealTestDescription {
|
static class TestDescription_suite_test_worksheet_test_append_dict_letter : public CxxTest::RealTestDescription {
|
||||||
public:
|
public:
|
||||||
TestDescription_suite_test_worksheet_test_append_dict_letter() : CxxTest::RealTestDescription( Tests_test_worksheet, suiteDescription_test_worksheet, 208, "test_append_dict_letter" ) {}
|
TestDescription_suite_test_worksheet_test_append_dict_letter() : CxxTest::RealTestDescription( Tests_test_worksheet, suiteDescription_test_worksheet, 209, "test_append_dict_letter" ) {}
|
||||||
void runTest() { suite_test_worksheet.test_append_dict_letter(); }
|
void runTest() { suite_test_worksheet.test_append_dict_letter(); }
|
||||||
} testDescription_suite_test_worksheet_test_append_dict_letter;
|
} testDescription_suite_test_worksheet_test_append_dict_letter;
|
||||||
|
|
||||||
static class TestDescription_suite_test_worksheet_test_append_dict_index : public CxxTest::RealTestDescription {
|
static class TestDescription_suite_test_worksheet_test_append_dict_index : public CxxTest::RealTestDescription {
|
||||||
public:
|
public:
|
||||||
TestDescription_suite_test_worksheet_test_append_dict_index() : CxxTest::RealTestDescription( Tests_test_worksheet, suiteDescription_test_worksheet, 218, "test_append_dict_index" ) {}
|
TestDescription_suite_test_worksheet_test_append_dict_index() : CxxTest::RealTestDescription( Tests_test_worksheet, suiteDescription_test_worksheet, 219, "test_append_dict_index" ) {}
|
||||||
void runTest() { suite_test_worksheet.test_append_dict_index(); }
|
void runTest() { suite_test_worksheet.test_append_dict_index(); }
|
||||||
} testDescription_suite_test_worksheet_test_append_dict_index;
|
} testDescription_suite_test_worksheet_test_append_dict_index;
|
||||||
|
|
||||||
static class TestDescription_suite_test_worksheet_test_append_2d_list : public CxxTest::RealTestDescription {
|
static class TestDescription_suite_test_worksheet_test_append_2d_list : public CxxTest::RealTestDescription {
|
||||||
public:
|
public:
|
||||||
TestDescription_suite_test_worksheet_test_append_2d_list() : CxxTest::RealTestDescription( Tests_test_worksheet, suiteDescription_test_worksheet, 228, "test_append_2d_list" ) {}
|
TestDescription_suite_test_worksheet_test_append_2d_list() : CxxTest::RealTestDescription( Tests_test_worksheet, suiteDescription_test_worksheet, 229, "test_append_2d_list" ) {}
|
||||||
void runTest() { suite_test_worksheet.test_append_2d_list(); }
|
void runTest() { suite_test_worksheet.test_append_2d_list(); }
|
||||||
} testDescription_suite_test_worksheet_test_append_2d_list;
|
} testDescription_suite_test_worksheet_test_append_2d_list;
|
||||||
|
|
||||||
static class TestDescription_suite_test_worksheet_test_rows : public CxxTest::RealTestDescription {
|
static class TestDescription_suite_test_worksheet_test_rows : public CxxTest::RealTestDescription {
|
||||||
public:
|
public:
|
||||||
TestDescription_suite_test_worksheet_test_rows() : CxxTest::RealTestDescription( Tests_test_worksheet, suiteDescription_test_worksheet, 243, "test_rows" ) {}
|
TestDescription_suite_test_worksheet_test_rows() : CxxTest::RealTestDescription( Tests_test_worksheet, suiteDescription_test_worksheet, 244, "test_rows" ) {}
|
||||||
void runTest() { suite_test_worksheet.test_rows(); }
|
void runTest() { suite_test_worksheet.test_rows(); }
|
||||||
} testDescription_suite_test_worksheet_test_rows;
|
} testDescription_suite_test_worksheet_test_rows;
|
||||||
|
|
||||||
static class TestDescription_suite_test_worksheet_test_cols : public CxxTest::RealTestDescription {
|
static class TestDescription_suite_test_worksheet_test_cols : public CxxTest::RealTestDescription {
|
||||||
public:
|
public:
|
||||||
TestDescription_suite_test_worksheet_test_cols() : CxxTest::RealTestDescription( Tests_test_worksheet, suiteDescription_test_worksheet, 258, "test_cols" ) {}
|
TestDescription_suite_test_worksheet_test_cols() : CxxTest::RealTestDescription( Tests_test_worksheet, suiteDescription_test_worksheet, 259, "test_cols" ) {}
|
||||||
void runTest() { suite_test_worksheet.test_cols(); }
|
void runTest() { suite_test_worksheet.test_cols(); }
|
||||||
} testDescription_suite_test_worksheet_test_cols;
|
} testDescription_suite_test_worksheet_test_cols;
|
||||||
|
|
||||||
static class TestDescription_suite_test_worksheet_test_auto_filter : public CxxTest::RealTestDescription {
|
static class TestDescription_suite_test_worksheet_test_auto_filter : public CxxTest::RealTestDescription {
|
||||||
public:
|
public:
|
||||||
TestDescription_suite_test_worksheet_test_auto_filter() : CxxTest::RealTestDescription( Tests_test_worksheet, suiteDescription_test_worksheet, 273, "test_auto_filter" ) {}
|
TestDescription_suite_test_worksheet_test_auto_filter() : CxxTest::RealTestDescription( Tests_test_worksheet, suiteDescription_test_worksheet, 274, "test_auto_filter" ) {}
|
||||||
void runTest() { suite_test_worksheet.test_auto_filter(); }
|
void runTest() { suite_test_worksheet.test_auto_filter(); }
|
||||||
} testDescription_suite_test_worksheet_test_auto_filter;
|
} testDescription_suite_test_worksheet_test_auto_filter;
|
||||||
|
|
||||||
static class TestDescription_suite_test_worksheet_test_getitem : public CxxTest::RealTestDescription {
|
static class TestDescription_suite_test_worksheet_test_getitem : public CxxTest::RealTestDescription {
|
||||||
public:
|
public:
|
||||||
TestDescription_suite_test_worksheet_test_getitem() : CxxTest::RealTestDescription( Tests_test_worksheet, suiteDescription_test_worksheet, 287, "test_getitem" ) {}
|
TestDescription_suite_test_worksheet_test_getitem() : CxxTest::RealTestDescription( Tests_test_worksheet, suiteDescription_test_worksheet, 288, "test_getitem" ) {}
|
||||||
void runTest() { suite_test_worksheet.test_getitem(); }
|
void runTest() { suite_test_worksheet.test_getitem(); }
|
||||||
} testDescription_suite_test_worksheet_test_getitem;
|
} testDescription_suite_test_worksheet_test_getitem;
|
||||||
|
|
||||||
static class TestDescription_suite_test_worksheet_test_setitem : public CxxTest::RealTestDescription {
|
static class TestDescription_suite_test_worksheet_test_setitem : public CxxTest::RealTestDescription {
|
||||||
public:
|
public:
|
||||||
TestDescription_suite_test_worksheet_test_setitem() : CxxTest::RealTestDescription( Tests_test_worksheet, suiteDescription_test_worksheet, 294, "test_setitem" ) {}
|
TestDescription_suite_test_worksheet_test_setitem() : CxxTest::RealTestDescription( Tests_test_worksheet, suiteDescription_test_worksheet, 295, "test_setitem" ) {}
|
||||||
void runTest() { suite_test_worksheet.test_setitem(); }
|
void runTest() { suite_test_worksheet.test_setitem(); }
|
||||||
} testDescription_suite_test_worksheet_test_setitem;
|
} testDescription_suite_test_worksheet_test_setitem;
|
||||||
|
|
||||||
static class TestDescription_suite_test_worksheet_test_getslice : public CxxTest::RealTestDescription {
|
static class TestDescription_suite_test_worksheet_test_getslice : public CxxTest::RealTestDescription {
|
||||||
public:
|
public:
|
||||||
TestDescription_suite_test_worksheet_test_getslice() : CxxTest::RealTestDescription( Tests_test_worksheet, suiteDescription_test_worksheet, 301, "test_getslice" ) {}
|
TestDescription_suite_test_worksheet_test_getslice() : CxxTest::RealTestDescription( Tests_test_worksheet, suiteDescription_test_worksheet, 302, "test_getslice" ) {}
|
||||||
void runTest() { suite_test_worksheet.test_getslice(); }
|
void runTest() { suite_test_worksheet.test_getslice(); }
|
||||||
} testDescription_suite_test_worksheet_test_getslice;
|
} testDescription_suite_test_worksheet_test_getslice;
|
||||||
|
|
||||||
static class TestDescription_suite_test_worksheet_test_freeze : public CxxTest::RealTestDescription {
|
static class TestDescription_suite_test_worksheet_test_freeze : public CxxTest::RealTestDescription {
|
||||||
public:
|
public:
|
||||||
TestDescription_suite_test_worksheet_test_freeze() : CxxTest::RealTestDescription( Tests_test_worksheet, suiteDescription_test_worksheet, 311, "test_freeze" ) {}
|
TestDescription_suite_test_worksheet_test_freeze() : CxxTest::RealTestDescription( Tests_test_worksheet, suiteDescription_test_worksheet, 312, "test_freeze" ) {}
|
||||||
void runTest() { suite_test_worksheet.test_freeze(); }
|
void runTest() { suite_test_worksheet.test_freeze(); }
|
||||||
} testDescription_suite_test_worksheet_test_freeze;
|
} testDescription_suite_test_worksheet_test_freeze;
|
||||||
|
|
||||||
static class TestDescription_suite_test_worksheet_test_write_empty : public CxxTest::RealTestDescription {
|
static class TestDescription_suite_test_worksheet_test_write_empty : public CxxTest::RealTestDescription {
|
||||||
public:
|
public:
|
||||||
TestDescription_suite_test_worksheet_test_write_empty() : CxxTest::RealTestDescription( Tests_test_worksheet, suiteDescription_test_worksheet, 328, "test_write_empty" ) {}
|
TestDescription_suite_test_worksheet_test_write_empty() : CxxTest::RealTestDescription( Tests_test_worksheet, suiteDescription_test_worksheet, 329, "test_write_empty" ) {}
|
||||||
void runTest() { suite_test_worksheet.test_write_empty(); }
|
void runTest() { suite_test_worksheet.test_write_empty(); }
|
||||||
} testDescription_suite_test_worksheet_test_write_empty;
|
} testDescription_suite_test_worksheet_test_write_empty;
|
||||||
|
|
||||||
static class TestDescription_suite_test_worksheet_test_page_margins : public CxxTest::RealTestDescription {
|
static class TestDescription_suite_test_worksheet_test_page_margins : public CxxTest::RealTestDescription {
|
||||||
public:
|
public:
|
||||||
TestDescription_suite_test_worksheet_test_page_margins() : CxxTest::RealTestDescription( Tests_test_worksheet, suiteDescription_test_worksheet, 359, "test_page_margins" ) {}
|
TestDescription_suite_test_worksheet_test_page_margins() : CxxTest::RealTestDescription( Tests_test_worksheet, suiteDescription_test_worksheet, 360, "test_page_margins" ) {}
|
||||||
void runTest() { suite_test_worksheet.test_page_margins(); }
|
void runTest() { suite_test_worksheet.test_page_margins(); }
|
||||||
} testDescription_suite_test_worksheet_test_page_margins;
|
} testDescription_suite_test_worksheet_test_page_margins;
|
||||||
|
|
||||||
static class TestDescription_suite_test_worksheet_test_merge : public CxxTest::RealTestDescription {
|
static class TestDescription_suite_test_worksheet_test_merge : public CxxTest::RealTestDescription {
|
||||||
public:
|
public:
|
||||||
TestDescription_suite_test_worksheet_test_merge() : CxxTest::RealTestDescription( Tests_test_worksheet, suiteDescription_test_worksheet, 397, "test_merge" ) {}
|
TestDescription_suite_test_worksheet_test_merge() : CxxTest::RealTestDescription( Tests_test_worksheet, suiteDescription_test_worksheet, 398, "test_merge" ) {}
|
||||||
void runTest() { suite_test_worksheet.test_merge(); }
|
void runTest() { suite_test_worksheet.test_merge(); }
|
||||||
} testDescription_suite_test_worksheet_test_merge;
|
} testDescription_suite_test_worksheet_test_merge;
|
||||||
|
|
||||||
static class TestDescription_suite_test_worksheet_test_printer_settings : public CxxTest::RealTestDescription {
|
static class TestDescription_suite_test_worksheet_test_printer_settings : public CxxTest::RealTestDescription {
|
||||||
public:
|
public:
|
||||||
TestDescription_suite_test_worksheet_test_printer_settings() : CxxTest::RealTestDescription( Tests_test_worksheet, suiteDescription_test_worksheet, 506, "test_printer_settings" ) {}
|
TestDescription_suite_test_worksheet_test_printer_settings() : CxxTest::RealTestDescription( Tests_test_worksheet, suiteDescription_test_worksheet, 507, "test_printer_settings" ) {}
|
||||||
void runTest() { suite_test_worksheet.test_printer_settings(); }
|
void runTest() { suite_test_worksheet.test_printer_settings(); }
|
||||||
} testDescription_suite_test_worksheet_test_printer_settings;
|
} testDescription_suite_test_worksheet_test_printer_settings;
|
||||||
|
|
||||||
static class TestDescription_suite_test_worksheet_test_header_footer : public CxxTest::RealTestDescription {
|
static class TestDescription_suite_test_worksheet_test_header_footer : public CxxTest::RealTestDescription {
|
||||||
public:
|
public:
|
||||||
TestDescription_suite_test_worksheet_test_header_footer() : CxxTest::RealTestDescription( Tests_test_worksheet, suiteDescription_test_worksheet, 547, "test_header_footer" ) {}
|
TestDescription_suite_test_worksheet_test_header_footer() : CxxTest::RealTestDescription( Tests_test_worksheet, suiteDescription_test_worksheet, 550, "test_header_footer" ) {}
|
||||||
void runTest() { suite_test_worksheet.test_header_footer(); }
|
void runTest() { suite_test_worksheet.test_header_footer(); }
|
||||||
} testDescription_suite_test_worksheet_test_header_footer;
|
} testDescription_suite_test_worksheet_test_header_footer;
|
||||||
|
|
||||||
static class TestDescription_suite_test_worksheet_test_positioning_point : public CxxTest::RealTestDescription {
|
static class TestDescription_suite_test_worksheet_test_positioning_point : public CxxTest::RealTestDescription {
|
||||||
public:
|
public:
|
||||||
TestDescription_suite_test_worksheet_test_positioning_point() : CxxTest::RealTestDescription( Tests_test_worksheet, suiteDescription_test_worksheet, 624, "test_positioning_point" ) {}
|
TestDescription_suite_test_worksheet_test_positioning_point() : CxxTest::RealTestDescription( Tests_test_worksheet, suiteDescription_test_worksheet, 627, "test_positioning_point" ) {}
|
||||||
void runTest() { suite_test_worksheet.test_positioning_point(); }
|
void runTest() { suite_test_worksheet.test_positioning_point(); }
|
||||||
} testDescription_suite_test_worksheet_test_positioning_point;
|
} testDescription_suite_test_worksheet_test_positioning_point;
|
||||||
|
|
||||||
static class TestDescription_suite_test_worksheet_test_positioning_roundtrip : public CxxTest::RealTestDescription {
|
static class TestDescription_suite_test_worksheet_test_positioning_roundtrip : public CxxTest::RealTestDescription {
|
||||||
public:
|
public:
|
||||||
TestDescription_suite_test_worksheet_test_positioning_roundtrip() : CxxTest::RealTestDescription( Tests_test_worksheet, suiteDescription_test_worksheet, 630, "test_positioning_roundtrip" ) {}
|
TestDescription_suite_test_worksheet_test_positioning_roundtrip() : CxxTest::RealTestDescription( Tests_test_worksheet, suiteDescription_test_worksheet, 633, "test_positioning_roundtrip" ) {}
|
||||||
void runTest() { suite_test_worksheet.test_positioning_roundtrip(); }
|
void runTest() { suite_test_worksheet.test_positioning_roundtrip(); }
|
||||||
} testDescription_suite_test_worksheet_test_positioning_roundtrip;
|
} testDescription_suite_test_worksheet_test_positioning_roundtrip;
|
||||||
|
|
||||||
static class TestDescription_suite_test_worksheet_test_page_setup : public CxxTest::RealTestDescription {
|
static class TestDescription_suite_test_worksheet_test_page_setup : public CxxTest::RealTestDescription {
|
||||||
public:
|
public:
|
||||||
TestDescription_suite_test_worksheet_test_page_setup() : CxxTest::RealTestDescription( Tests_test_worksheet, suiteDescription_test_worksheet, 638, "test_page_setup" ) {}
|
TestDescription_suite_test_worksheet_test_page_setup() : CxxTest::RealTestDescription( Tests_test_worksheet, suiteDescription_test_worksheet, 641, "test_page_setup" ) {}
|
||||||
void runTest() { suite_test_worksheet.test_page_setup(); }
|
void runTest() { suite_test_worksheet.test_page_setup(); }
|
||||||
} testDescription_suite_test_worksheet_test_page_setup;
|
} testDescription_suite_test_worksheet_test_page_setup;
|
||||||
|
|
||||||
static class TestDescription_suite_test_worksheet_test_page_options : public CxxTest::RealTestDescription {
|
static class TestDescription_suite_test_worksheet_test_page_options : public CxxTest::RealTestDescription {
|
||||||
public:
|
public:
|
||||||
TestDescription_suite_test_worksheet_test_page_options() : CxxTest::RealTestDescription( Tests_test_worksheet, suiteDescription_test_worksheet, 646, "test_page_options" ) {}
|
TestDescription_suite_test_worksheet_test_page_options() : CxxTest::RealTestDescription( Tests_test_worksheet, suiteDescription_test_worksheet, 649, "test_page_options" ) {}
|
||||||
void runTest() { suite_test_worksheet.test_page_options(); }
|
void runTest() { suite_test_worksheet.test_page_options(); }
|
||||||
} testDescription_suite_test_worksheet_test_page_options;
|
} testDescription_suite_test_worksheet_test_page_options;
|
||||||
|
|
||||||
#include "/Users/thomas/Development/xlnt/tests/test_write.hpp"
|
#include "C:\Users\taf656\Development\xlnt\tests\test_write.hpp"
|
||||||
|
|
||||||
static test_write suite_test_write;
|
static test_write suite_test_write;
|
||||||
|
|
||||||
|
@ -1377,12 +1377,6 @@ public:
|
||||||
void runTest() { suite_test_write.test_write_hyperlink_rels(); }
|
void runTest() { suite_test_write.test_write_hyperlink_rels(); }
|
||||||
} testDescription_suite_test_write_test_write_hyperlink_rels;
|
} testDescription_suite_test_write_test_write_hyperlink_rels;
|
||||||
|
|
||||||
static class TestDescription_suite_test_write_test_write_hyperlink_image_rels : public CxxTest::RealTestDescription {
|
|
||||||
public:
|
|
||||||
TestDescription_suite_test_write_test_write_hyperlink_image_rels() : CxxTest::RealTestDescription( Tests_test_write, suiteDescription_test_write, 143, "test_write_hyperlink_image_rels" ) {}
|
|
||||||
void runTest() { suite_test_write.test_write_hyperlink_image_rels(); }
|
|
||||||
} testDescription_suite_test_write_test_write_hyperlink_image_rels;
|
|
||||||
|
|
||||||
static class TestDescription_suite_test_write_test_hyperlink_value : public CxxTest::RealTestDescription {
|
static class TestDescription_suite_test_write_test_hyperlink_value : public CxxTest::RealTestDescription {
|
||||||
public:
|
public:
|
||||||
TestDescription_suite_test_write_test_hyperlink_value() : CxxTest::RealTestDescription( Tests_test_write, suiteDescription_test_write, 148, "test_hyperlink_value" ) {}
|
TestDescription_suite_test_write_test_hyperlink_value() : CxxTest::RealTestDescription( Tests_test_write, suiteDescription_test_write, 148, "test_hyperlink_value" ) {}
|
||||||
|
@ -1437,13 +1431,7 @@ public:
|
||||||
void runTest() { suite_test_write.test_short_number(); }
|
void runTest() { suite_test_write.test_short_number(); }
|
||||||
} testDescription_suite_test_write_test_short_number;
|
} testDescription_suite_test_write_test_short_number;
|
||||||
|
|
||||||
static class TestDescription_suite_test_write_test_write_images : public CxxTest::RealTestDescription {
|
#include "C:\Users\taf656\Development\xlnt\tests\test_zip_file.hpp"
|
||||||
public:
|
|
||||||
TestDescription_suite_test_write_test_write_images() : CxxTest::RealTestDescription( Tests_test_write, suiteDescription_test_write, 223, "test_write_images" ) {}
|
|
||||||
void runTest() { suite_test_write.test_write_images(); }
|
|
||||||
} testDescription_suite_test_write_test_write_images;
|
|
||||||
|
|
||||||
#include "/Users/thomas/Development/xlnt/tests/test_zip_file.hpp"
|
|
||||||
|
|
||||||
static test_zip_file suite_test_zip_file;
|
static test_zip_file suite_test_zip_file;
|
||||||
|
|
||||||
|
@ -1566,13 +1554,13 @@ public:
|
||||||
|
|
||||||
static class TestDescription_suite_test_zip_file_test_writestr : public CxxTest::RealTestDescription {
|
static class TestDescription_suite_test_zip_file_test_writestr : public CxxTest::RealTestDescription {
|
||||||
public:
|
public:
|
||||||
TestDescription_suite_test_zip_file_test_writestr() : CxxTest::RealTestDescription( Tests_test_zip_file, suiteDescription_test_zip_file, 234, "test_writestr" ) {}
|
TestDescription_suite_test_zip_file_test_writestr() : CxxTest::RealTestDescription( Tests_test_zip_file, suiteDescription_test_zip_file, 244, "test_writestr" ) {}
|
||||||
void runTest() { suite_test_zip_file.test_writestr(); }
|
void runTest() { suite_test_zip_file.test_writestr(); }
|
||||||
} testDescription_suite_test_zip_file_test_writestr;
|
} testDescription_suite_test_zip_file_test_writestr;
|
||||||
|
|
||||||
static class TestDescription_suite_test_zip_file_test_comment : public CxxTest::RealTestDescription {
|
static class TestDescription_suite_test_zip_file_test_comment : public CxxTest::RealTestDescription {
|
||||||
public:
|
public:
|
||||||
TestDescription_suite_test_zip_file_test_comment() : CxxTest::RealTestDescription( Tests_test_zip_file, suiteDescription_test_zip_file, 252, "test_comment" ) {}
|
TestDescription_suite_test_zip_file_test_comment() : CxxTest::RealTestDescription( Tests_test_zip_file, suiteDescription_test_zip_file, 263, "test_comment" ) {}
|
||||||
void runTest() { suite_test_zip_file.test_comment(); }
|
void runTest() { suite_test_zip_file.test_comment(); }
|
||||||
} testDescription_suite_test_zip_file_test_comment;
|
} testDescription_suite_test_zip_file_test_comment;
|
||||||
|
|
||||||
|
|
|
@ -14,17 +14,17 @@ public:
|
||||||
auto now = xlnt::datetime::now();
|
auto now = xlnt::datetime::now();
|
||||||
auto ws = workbook_.get_active_sheet();
|
auto ws = workbook_.get_active_sheet();
|
||||||
ws.get_cell("A1").set_value("12.34%"); // 2
|
ws.get_cell("A1").set_value("12.34%"); // 2
|
||||||
ws.get_cell("B4").set_value(now); // 3
|
ws.get_cell("B1").set_value(now); // 3
|
||||||
ws.get_cell("B5").set_value(now);
|
ws.get_cell("C1").set_value(now);
|
||||||
ws.get_cell("C14").set_value("This is a test"); // 1
|
ws.get_cell("D1").set_value("This is a test"); // 1
|
||||||
ws.get_cell("D9").set_value("31.31415"); // 3
|
ws.get_cell("E1").set_value("31.31415"); // 3
|
||||||
xlnt::style st;
|
xlnt::style st; // 4
|
||||||
st.set_number_format(xlnt::number_format(xlnt::number_format::format::number_00));
|
st.set_number_format(xlnt::number_format(xlnt::number_format::format::number_00));
|
||||||
st.set_protection(xlnt::protection(xlnt::protection::type::unprotected));
|
st.set_protection(xlnt::protection(xlnt::protection::type::unprotected));
|
||||||
ws.get_cell("D9").set_style(st);
|
ws.get_cell("F1").set_style(st);
|
||||||
xlnt::style st2;
|
xlnt::style st2; // 5
|
||||||
st.set_protection(xlnt::protection(xlnt::protection::type::unprotected));
|
st.set_protection(xlnt::protection(xlnt::protection::type::unprotected));
|
||||||
ws.get_cell("E1").set_style(st2);
|
ws.get_cell("G1").set_style(st2);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -35,9 +35,9 @@ public:
|
||||||
|
|
||||||
void test_write_style_table()
|
void test_write_style_table()
|
||||||
{
|
{
|
||||||
auto path = PathHelper::GetDataDirectory("/expected/simple-styles.xml");
|
auto path = PathHelper::GetDataDirectory("/writer/expected/simple-styles.xml");
|
||||||
pugi::xml_document expected;
|
pugi::xml_document expected;
|
||||||
expected.load(path.c_str());
|
expected.load_file(path.c_str());
|
||||||
|
|
||||||
auto content = writer_.write_table();
|
auto content = writer_.write_table();
|
||||||
pugi::xml_document observed;
|
pugi::xml_document observed;
|
||||||
|
|
|
@ -55,7 +55,8 @@ public:
|
||||||
|
|
||||||
void test_unique_sheet_title()
|
void test_unique_sheet_title()
|
||||||
{
|
{
|
||||||
TS_SKIP("not implemented");
|
auto ws = wb_.create_sheet("AGE");
|
||||||
|
TS_ASSERT_EQUALS(ws.unique_sheet_name("GE"), "GE");
|
||||||
}
|
}
|
||||||
|
|
||||||
void test_worksheet_dimension()
|
void test_worksheet_dimension()
|
||||||
|
@ -512,6 +513,8 @@ public:
|
||||||
ws.get_page_setup().set_fit_to_page(true);
|
ws.get_page_setup().set_fit_to_page(true);
|
||||||
ws.get_page_setup().set_fit_to_height(false);
|
ws.get_page_setup().set_fit_to_height(false);
|
||||||
ws.get_page_setup().set_fit_to_width(true);
|
ws.get_page_setup().set_fit_to_width(true);
|
||||||
|
ws.get_page_setup().set_horizontal_centered(true);
|
||||||
|
ws.get_page_setup().set_vertical_centered(true);
|
||||||
|
|
||||||
auto xml_string = xlnt::writer::write_worksheet(ws);
|
auto xml_string = xlnt::writer::write_worksheet(ws);
|
||||||
|
|
||||||
|
|
|
@ -140,7 +140,7 @@ public:
|
||||||
TS_ASSERT(Helper::EqualsFileContent(PathHelper::GetDataDirectory() + "/writer/expected/sheet1_hyperlink.xml.rels", content));
|
TS_ASSERT(Helper::EqualsFileContent(PathHelper::GetDataDirectory() + "/writer/expected/sheet1_hyperlink.xml.rels", content));
|
||||||
}
|
}
|
||||||
|
|
||||||
void test_write_hyperlink_image_rels()
|
void _test_write_hyperlink_image_rels()
|
||||||
{
|
{
|
||||||
TS_SKIP("not implemented");
|
TS_SKIP("not implemented");
|
||||||
}
|
}
|
||||||
|
@ -220,7 +220,7 @@ public:
|
||||||
TS_ASSERT(Helper::EqualsFileContent(PathHelper::GetDataDirectory() + "/writer/expected/short_number.xml", content));
|
TS_ASSERT(Helper::EqualsFileContent(PathHelper::GetDataDirectory() + "/writer/expected/short_number.xml", content));
|
||||||
}
|
}
|
||||||
|
|
||||||
void test_write_images()
|
void _test_write_images()
|
||||||
{
|
{
|
||||||
TS_SKIP("not implemented");
|
TS_SKIP("not implemented");
|
||||||
}
|
}
|
||||||
|
|
|
@ -55,7 +55,7 @@ public:
|
||||||
remove_temp_file();
|
remove_temp_file();
|
||||||
xlnt::zip_file f(existing_file);
|
xlnt::zip_file f(existing_file);
|
||||||
f.save(temp_file.GetFilename());
|
f.save(temp_file.GetFilename());
|
||||||
assert(files_equal(existing_file, temp_file.GetFilename()));
|
TS_ASSERT(files_equal(existing_file, temp_file.GetFilename()));
|
||||||
remove_temp_file();
|
remove_temp_file();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -68,7 +68,7 @@ public:
|
||||||
std::ofstream out_stream(temp_file.GetFilename(), std::ios::binary);
|
std::ofstream out_stream(temp_file.GetFilename(), std::ios::binary);
|
||||||
f.save(out_stream);
|
f.save(out_stream);
|
||||||
}
|
}
|
||||||
assert(files_equal(existing_file, temp_file.GetFilename()));
|
TS_ASSERT(files_equal(existing_file, temp_file.GetFilename()));
|
||||||
remove_temp_file();
|
remove_temp_file();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -91,7 +91,7 @@ public:
|
||||||
result_bytes = std::vector<unsigned char>();
|
result_bytes = std::vector<unsigned char>();
|
||||||
f2.save(result_bytes);
|
f2.save(result_bytes);
|
||||||
|
|
||||||
assert(source_bytes == result_bytes);
|
TS_ASSERT(source_bytes == result_bytes);
|
||||||
|
|
||||||
remove_temp_file();
|
remove_temp_file();
|
||||||
}
|
}
|
||||||
|
@ -100,7 +100,7 @@ public:
|
||||||
{
|
{
|
||||||
xlnt::zip_file f(existing_file);
|
xlnt::zip_file f(existing_file);
|
||||||
|
|
||||||
assert(!f.namelist().empty());
|
TS_ASSERT(!f.namelist().empty());
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -108,17 +108,17 @@ public:
|
||||||
}
|
}
|
||||||
catch(std::exception e)
|
catch(std::exception e)
|
||||||
{
|
{
|
||||||
assert(false);
|
TS_ASSERT(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
f.reset();
|
f.reset();
|
||||||
|
|
||||||
assert(f.namelist().empty());
|
TS_ASSERT(f.namelist().empty());
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
f.read("[Content_Types].xml");
|
f.read("[Content_Types].xml");
|
||||||
assert(false);
|
TS_ASSERT(false);
|
||||||
}
|
}
|
||||||
catch(std::exception e)
|
catch(std::exception e)
|
||||||
{
|
{
|
||||||
|
@ -129,19 +129,19 @@ public:
|
||||||
{
|
{
|
||||||
xlnt::zip_file f(existing_file);
|
xlnt::zip_file f(existing_file);
|
||||||
auto info = f.getinfo("[Content_Types].xml");
|
auto info = f.getinfo("[Content_Types].xml");
|
||||||
assert(info.filename == "[Content_Types].xml");
|
TS_ASSERT(info.filename == "[Content_Types].xml");
|
||||||
}
|
}
|
||||||
|
|
||||||
void test_infolist()
|
void test_infolist()
|
||||||
{
|
{
|
||||||
xlnt::zip_file f(existing_file);
|
xlnt::zip_file f(existing_file);
|
||||||
assert(f.infolist().size() == 14);
|
TS_ASSERT(f.infolist().size() == 14);
|
||||||
}
|
}
|
||||||
|
|
||||||
void test_namelist()
|
void test_namelist()
|
||||||
{
|
{
|
||||||
xlnt::zip_file f(existing_file);
|
xlnt::zip_file f(existing_file);
|
||||||
assert(f.namelist().size() == 14);
|
TS_ASSERT(f.namelist().size() == 14);
|
||||||
}
|
}
|
||||||
|
|
||||||
void test_open_by_name()
|
void test_open_by_name()
|
||||||
|
@ -150,7 +150,7 @@ public:
|
||||||
std::stringstream ss;
|
std::stringstream ss;
|
||||||
ss << f.open("[Content_Types].xml").rdbuf();
|
ss << f.open("[Content_Types].xml").rdbuf();
|
||||||
std::string result = ss.str();
|
std::string result = ss.str();
|
||||||
assert(result == expected_content_types_string);
|
TS_ASSERT(result == expected_content_types_string);
|
||||||
}
|
}
|
||||||
|
|
||||||
void test_open_by_info()
|
void test_open_by_info()
|
||||||
|
@ -159,7 +159,7 @@ public:
|
||||||
std::stringstream ss;
|
std::stringstream ss;
|
||||||
ss << f.open("[Content_Types].xml").rdbuf();
|
ss << f.open("[Content_Types].xml").rdbuf();
|
||||||
std::string result = ss.str();
|
std::string result = ss.str();
|
||||||
assert(result == expected_content_types_string);
|
TS_ASSERT(result == expected_content_types_string);
|
||||||
}
|
}
|
||||||
|
|
||||||
void test_extract_current_directory()
|
void test_extract_current_directory()
|
||||||
|
@ -198,20 +198,20 @@ public:
|
||||||
std::stringstream ss;
|
std::stringstream ss;
|
||||||
f.printdir(ss);
|
f.printdir(ss);
|
||||||
auto printed = ss.str();
|
auto printed = ss.str();
|
||||||
assert(printed == expected_printdir_string);
|
TS_ASSERT(printed == expected_printdir_string);
|
||||||
}
|
}
|
||||||
|
|
||||||
void test_read()
|
void test_read()
|
||||||
{
|
{
|
||||||
xlnt::zip_file f(existing_file);
|
xlnt::zip_file f(existing_file);
|
||||||
assert(f.read("[Content_Types].xml") == expected_content_types_string);
|
TS_ASSERT(f.read("[Content_Types].xml") == expected_content_types_string);
|
||||||
assert(f.read(f.getinfo("[Content_Types].xml")) == expected_content_types_string);
|
TS_ASSERT(f.read(f.getinfo("[Content_Types].xml")) == expected_content_types_string);
|
||||||
}
|
}
|
||||||
|
|
||||||
void test_testzip()
|
void test_testzip()
|
||||||
{
|
{
|
||||||
xlnt::zip_file f(existing_file);
|
xlnt::zip_file f(existing_file);
|
||||||
assert(f.testzip().first);
|
TS_ASSERT(f.testzip().first);
|
||||||
}
|
}
|
||||||
|
|
||||||
void test_write()
|
void test_write()
|
||||||
|
@ -225,8 +225,18 @@ public:
|
||||||
f.save(temp_file.GetFilename());
|
f.save(temp_file.GetFilename());
|
||||||
|
|
||||||
xlnt::zip_file f2(temp_file.GetFilename());
|
xlnt::zip_file f2(temp_file.GetFilename());
|
||||||
assert(f2.read(text_file) == expected_atxt_string);
|
|
||||||
assert(f2.read("sharedStrings2.xml") == expected_atxt_string);
|
for(auto &info : f2.infolist())
|
||||||
|
{
|
||||||
|
if(info.filename == "sharedStrings2.xml")
|
||||||
|
{
|
||||||
|
TS_ASSERT(f2.read(info) == expected_atxt_string);
|
||||||
|
}
|
||||||
|
else if(info.filename.substr(info.filename.size() - 17) == "sharedStrings.xml")
|
||||||
|
{
|
||||||
|
TS_ASSERT(f2.read(info) == expected_atxt_string);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
remove_temp_file();
|
remove_temp_file();
|
||||||
}
|
}
|
||||||
|
@ -239,12 +249,13 @@ public:
|
||||||
f.writestr("a.txt", "a\na");
|
f.writestr("a.txt", "a\na");
|
||||||
xlnt::zip_info info;
|
xlnt::zip_info info;
|
||||||
info.filename = "b.txt";
|
info.filename = "b.txt";
|
||||||
|
info.date_time.year = 2014;
|
||||||
f.writestr(info, "b\nb");
|
f.writestr(info, "b\nb");
|
||||||
f.save(temp_file.GetFilename());
|
f.save(temp_file.GetFilename());
|
||||||
|
|
||||||
xlnt::zip_file f2(temp_file.GetFilename());
|
xlnt::zip_file f2(temp_file.GetFilename());
|
||||||
assert(f2.read("a.txt") == "a\na");
|
TS_ASSERT(f2.read("a.txt") == "a\na");
|
||||||
assert(f2.read(f2.getinfo("b.txt")) == "b\nb");
|
TS_ASSERT(f2.read(f2.getinfo("b.txt")) == "b\nb");
|
||||||
|
|
||||||
remove_temp_file();
|
remove_temp_file();
|
||||||
}
|
}
|
||||||
|
@ -258,7 +269,7 @@ public:
|
||||||
f.save(temp_file.GetFilename());
|
f.save(temp_file.GetFilename());
|
||||||
|
|
||||||
xlnt::zip_file f2(temp_file.GetFilename());
|
xlnt::zip_file f2(temp_file.GetFilename());
|
||||||
assert(f2.comment == "comment");
|
TS_ASSERT(f2.comment == "comment");
|
||||||
|
|
||||||
remove_temp_file();
|
remove_temp_file();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user