actually produce a working spreadsheet now

This commit is contained in:
Thomas Fussell 2014-07-28 17:55:57 -04:00
parent 16f8c3223a
commit 01b9a26510
6 changed files with 187 additions and 44 deletions

View File

@ -113,6 +113,7 @@ private:
void write_all();
std::string read_from_zip(const std::string &filename);
void write_to_zip(const std::string &filename, const std::string &content, bool append = true);
void write_directory_to_zip(const std::string &name, bool append = true);
void change_state(state new_state, bool append = true);
static bool file_exists(const std::string& name);
void start_read();

View File

@ -1,3 +1,6 @@
#include <sstream>
#include <pugixml.hpp>
#include "writer/style_writer.hpp"
#include "workbook/workbook.hpp"
#include "worksheet/worksheet.hpp"
@ -53,7 +56,84 @@ std::vector<style> style_writer::get_styles() const
std::string style_writer::write_table() const
{
return "";
pugi::xml_document doc;
auto style_sheet_node = doc.append_child("styleSheet");
style_sheet_node.append_attribute("xmlns").set_value("http://schemas.openxmlformats.org/spreadsheetml/2006/main");
style_sheet_node.append_attribute("xmlns:mc").set_value("http://schemas.openxmlformats.org/markup-compatibility/2006");
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");
auto fonts_node = style_sheet_node.append_child("fonts");
fonts_node.append_attribute("count").set_value(1);
fonts_node.append_attribute("x14ac:knownFonts").set_value(1);
auto font_node = fonts_node.append_child("font");
auto size_node = font_node.append_child("sz");
size_node.append_attribute("val").set_value(11);
auto color_node = font_node.append_child("color");
color_node.append_attribute("theme").set_value(1);
auto name_node = font_node.append_child("name");
name_node.append_attribute("val").set_value("Calibri");
auto family_node = font_node.append_child("family");
family_node.append_attribute("val").set_value(2);
auto scheme_node = font_node.append_child("scheme");
scheme_node.append_attribute("val").set_value("minor");
auto fills_node = style_sheet_node.append_child("fills");
fills_node.append_attribute("count").set_value(2);
fills_node.append_child("fill").append_child("patternFill").append_attribute("patternType").set_value("none");
fills_node.append_child("fill").append_child("patternFill").append_attribute("patternType").set_value("gray125");
auto borders_node = style_sheet_node.append_child("borders");
borders_node.append_attribute("count").set_value(1);
auto border_node = borders_node.append_child("border");
border_node.append_child("left");
border_node.append_child("right");
border_node.append_child("top");
border_node.append_child("bottom");
border_node.append_child("diagonal");
auto cell_style_xfs_node = style_sheet_node.append_child("cellStyleXfs");
cell_style_xfs_node.append_attribute("count").set_value(1);
auto xf_node = cell_style_xfs_node.append_child("xf");
xf_node.append_attribute("numFmtId").set_value(0);
xf_node.append_attribute("fontId").set_value(0);
xf_node.append_attribute("fillId").set_value(0);
xf_node.append_attribute("borderId").set_value(0);
auto cell_xfs_node = style_sheet_node.append_child("cellXfs");
cell_xfs_node.append_attribute("count").set_value(1);
xf_node = cell_xfs_node.append_child("xf");
xf_node.append_attribute("numFmtId").set_value(0);
xf_node.append_attribute("fontId").set_value(0);
xf_node.append_attribute("fillId").set_value(0);
xf_node.append_attribute("borderId").set_value(0);
xf_node.append_attribute("xfId").set_value(0);
auto cell_styles_node = style_sheet_node.append_child("cellStyles");
cell_styles_node.append_attribute("count").set_value(1);
auto cell_style_node = cell_styles_node.append_child("cellStyle");
cell_style_node.append_attribute("name").set_value("Normal");
cell_style_node.append_attribute("xfId").set_value(0);
cell_style_node.append_attribute("builtinId").set_value(0);
style_sheet_node.append_child("dxfs").append_attribute("count").set_value(0);
auto table_styles_node = style_sheet_node.append_child("tableStyles");
table_styles_node.append_attribute("count").set_value(0);
table_styles_node.append_attribute("defaultTableStyle").set_value("TableStyleMedium2");
table_styles_node.append_attribute("defaultPivotStyle").set_value("PivotStyleMedium9");
auto ext_list_node = style_sheet_node.append_child("extLst");
auto ext_node = ext_list_node.append_child("ext");
ext_node.append_attribute("uri").set_value("{EB79DEF2-80B8-43e5-95BD-54CBDDF9020C}");
ext_node.append_attribute("xmlns:x14").set_value("http://schemas.microsoft.com/office/spreadsheetml/2009/9/main");
ext_node.append_child("x14:slicerStyles").append_attribute("defaultSlicerStyle").set_value("SlicerStyleLight1");
std::stringstream ss;
doc.save(ss);
return ss.str();
}
} // namespace xlnt

View File

@ -22,6 +22,7 @@
#include "detail/cell_impl.hpp"
#include "detail/workbook_impl.hpp"
#include "detail/worksheet_impl.hpp"
#include "writer/style_writer.hpp"
static std::string CreateTemporaryFilename()
{
@ -535,7 +536,7 @@ bool workbook::save(const std::string &filename)
f.set_file_contents("xl/sharedStrings.xml", writer::write_shared_strings(shared_strings));
f.set_file_contents("xl/theme/theme1.xml", writer::write_theme());
//f.set_file_contents("xl/styles.xml", writer::wri)
f.set_file_contents("xl/styles.xml", style_writer(*this).write_table());
f.set_file_contents("_rels/.rels", writer::write_root_rels());
f.set_file_contents("xl/_rels/workbook.xml.rels", writer::write_workbook_rels(*this));
@ -578,6 +579,15 @@ std::vector<content_type> xlnt::workbook::get_content_types() const
content_types.push_back({ true, "xml", "", "application/xml" });
content_types.push_back({ true, "rels", "", "application/vnd.openxmlformats-package.relationships+xml" });
content_types.push_back({ false, "", "/xl/workbook.xml", "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet.main+xml" });
for(int i = 0; i < get_sheet_names().size(); i++)
{
content_types.push_back({false, "", "/xl/worksheets/sheet" + std::to_string(i + 1) + ".xml", "application/vnd.openxmlformats-officedocument.spreadsheetml.worksheet+xml"});
}
content_types.push_back({false, "", "/xl/theme/theme1.xml", "application/vnd.openxmlformats-officedocument.theme+xml"});
content_types.push_back({false, "", "/xl/styles.xml", "application/vnd.openxmlformats-officedocument.spreadsheetml.styles+xml"});
content_types.push_back({false, "", "/xl/sharedStrings.xml", "application/vnd.openxmlformats-officedocument.spreadsheetml.sharedStrings+xml"});
content_types.push_back({false, "", "/docProps/core.xml", "application/vnd.openxmlformats-package.core-properties+xml"});
content_types.push_back({false, "", "/docProps/app.xml", "application/vnd.openxmlformats-officedocument.extended-properties+xml"});
return content_types;
}

View File

@ -63,13 +63,39 @@ std::string zip_file::get_file_contents(const std::string &filename) const
return files_.at(filename);
}
std::string dirname(const std::string &filename)
{
auto last_sep_index = filename.find_last_of('/');
if(last_sep_index != std::string::npos)
{
return filename.substr(0, last_sep_index + 1);
}
return "";
}
void zip_file::set_file_contents(const std::string &filename, const std::string &contents)
{
if(!has_file(filename) || files_[filename] != contents)
{
modified_ = true;
}
auto dir = dirname(filename);
while(dir != "")
{
auto matching_directory = std::find(directories_.begin(), directories_.end(), dir);
if(matching_directory == directories_.end())
{
directories_.push_back(dir);
}
dir = dirname(dir.substr(0, dir.length() - 1));
}
files_[filename] = contents;
}
@ -170,6 +196,11 @@ void zip_file::write_all()
change_state(state::write, false);
for(auto directory : directories_)
{
write_directory_to_zip(directory, true);
}
for(auto file : files_)
{
write_to_zip(file.first, file.second, true);
@ -229,6 +260,32 @@ std::string zip_file::read_from_zip(const std::string &filename)
return std::string(file_buffer.begin(), file_buffer.end());
}
void zip_file::write_directory_to_zip(const std::string &name, bool append)
{
if(!((int)access_ & (int)file_access::write))
{
throw std::runtime_error("don't have write access");
}
change_state(state::write, append);
zip_fileinfo file_info = {0};
int result = zipOpenNewFileInZip(zip_file_, name.c_str(), &file_info, nullptr, 0, nullptr, 0, nullptr, Z_DEFLATED, Z_DEFAULT_COMPRESSION);
if(result != UNZ_OK)
{
throw result;
}
result = zipCloseFileInZip(zip_file_);
if(result != UNZ_OK)
{
throw result;
}
}
void zip_file::write_to_zip(const std::string &filename, const std::string &content, bool append)
{
if(!((int)access_ & (int)file_access::write))
@ -238,7 +295,7 @@ void zip_file::write_to_zip(const std::string &filename, const std::string &cont
change_state(state::write, append);
zip_fileinfo file_info;
zip_fileinfo file_info = {0};
int result = zipOpenNewFileInZip(zip_file_, filename.c_str(), &file_info, nullptr, 0, nullptr, 0, nullptr, Z_DEFLATED, Z_DEFAULT_COMPRESSION);

View File

@ -21,7 +21,7 @@ int main( int argc, char *argv[] ) {
return status;
}
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;
@ -256,7 +256,7 @@ public:
void runTest() { 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;
@ -347,7 +347,7 @@ public:
void runTest() { 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;
@ -438,7 +438,7 @@ public:
void runTest() { 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;
@ -541,7 +541,7 @@ public:
void runTest() { 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;
@ -584,7 +584,7 @@ public:
void runTest() { 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;
@ -777,7 +777,7 @@ public:
void runTest() { 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;
@ -808,7 +808,7 @@ public:
void runTest() { 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;
@ -917,7 +917,7 @@ public:
void runTest() { 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;
@ -930,7 +930,7 @@ public:
void runTest() { 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;
@ -1051,7 +1051,7 @@ public:
void runTest() { 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;
@ -1292,7 +1292,7 @@ public:
void runTest() { 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;
@ -1307,139 +1307,139 @@ public:
static class TestDescription_suite_test_write_test_write_virtual_workbook : public CxxTest::RealTestDescription {
public:
TestDescription_suite_test_write_test_write_virtual_workbook() : CxxTest::RealTestDescription( Tests_test_write, suiteDescription_test_write, 31, "test_write_virtual_workbook" ) {}
TestDescription_suite_test_write_test_write_virtual_workbook() : CxxTest::RealTestDescription( Tests_test_write, suiteDescription_test_write, 34, "test_write_virtual_workbook" ) {}
void runTest() { suite_test_write.test_write_virtual_workbook(); }
} testDescription_suite_test_write_test_write_virtual_workbook;
static class TestDescription_suite_test_write_test_write_workbook_rels : public CxxTest::RealTestDescription {
public:
TestDescription_suite_test_write_test_write_workbook_rels() : CxxTest::RealTestDescription( Tests_test_write, suiteDescription_test_write, 40, "test_write_workbook_rels" ) {}
TestDescription_suite_test_write_test_write_workbook_rels() : CxxTest::RealTestDescription( Tests_test_write, suiteDescription_test_write, 43, "test_write_workbook_rels" ) {}
void runTest() { suite_test_write.test_write_workbook_rels(); }
} testDescription_suite_test_write_test_write_workbook_rels;
static class TestDescription_suite_test_write_test_write_workbook : public CxxTest::RealTestDescription {
public:
TestDescription_suite_test_write_test_write_workbook() : CxxTest::RealTestDescription( Tests_test_write, suiteDescription_test_write, 48, "test_write_workbook" ) {}
TestDescription_suite_test_write_test_write_workbook() : CxxTest::RealTestDescription( Tests_test_write, suiteDescription_test_write, 51, "test_write_workbook" ) {}
void runTest() { suite_test_write.test_write_workbook(); }
} testDescription_suite_test_write_test_write_workbook;
static class TestDescription_suite_test_write_test_write_string_table : public CxxTest::RealTestDescription {
public:
TestDescription_suite_test_write_test_write_string_table() : CxxTest::RealTestDescription( Tests_test_write, suiteDescription_test_write, 56, "test_write_string_table" ) {}
TestDescription_suite_test_write_test_write_string_table() : CxxTest::RealTestDescription( Tests_test_write, suiteDescription_test_write, 59, "test_write_string_table" ) {}
void runTest() { suite_test_write.test_write_string_table(); }
} testDescription_suite_test_write_test_write_string_table;
static class TestDescription_suite_test_write_test_write_worksheet : public CxxTest::RealTestDescription {
public:
TestDescription_suite_test_write_test_write_worksheet() : CxxTest::RealTestDescription( Tests_test_write, suiteDescription_test_write, 63, "test_write_worksheet" ) {}
TestDescription_suite_test_write_test_write_worksheet() : CxxTest::RealTestDescription( Tests_test_write, suiteDescription_test_write, 66, "test_write_worksheet" ) {}
void runTest() { suite_test_write.test_write_worksheet(); }
} testDescription_suite_test_write_test_write_worksheet;
static class TestDescription_suite_test_write_test_write_hidden_worksheet : public CxxTest::RealTestDescription {
public:
TestDescription_suite_test_write_test_write_hidden_worksheet() : CxxTest::RealTestDescription( Tests_test_write, suiteDescription_test_write, 71, "test_write_hidden_worksheet" ) {}
TestDescription_suite_test_write_test_write_hidden_worksheet() : CxxTest::RealTestDescription( Tests_test_write, suiteDescription_test_write, 74, "test_write_hidden_worksheet" ) {}
void runTest() { suite_test_write.test_write_hidden_worksheet(); }
} testDescription_suite_test_write_test_write_hidden_worksheet;
static class TestDescription_suite_test_write_test_write_bool : public CxxTest::RealTestDescription {
public:
TestDescription_suite_test_write_test_write_bool() : CxxTest::RealTestDescription( Tests_test_write, suiteDescription_test_write, 80, "test_write_bool" ) {}
TestDescription_suite_test_write_test_write_bool() : CxxTest::RealTestDescription( Tests_test_write, suiteDescription_test_write, 83, "test_write_bool" ) {}
void runTest() { suite_test_write.test_write_bool(); }
} testDescription_suite_test_write_test_write_bool;
static class TestDescription_suite_test_write_test_write_formula : public CxxTest::RealTestDescription {
public:
TestDescription_suite_test_write_test_write_formula() : CxxTest::RealTestDescription( Tests_test_write, suiteDescription_test_write, 89, "test_write_formula" ) {}
TestDescription_suite_test_write_test_write_formula() : CxxTest::RealTestDescription( Tests_test_write, suiteDescription_test_write, 92, "test_write_formula" ) {}
void runTest() { suite_test_write.test_write_formula(); }
} testDescription_suite_test_write_test_write_formula;
static class TestDescription_suite_test_write_test_write_style : public CxxTest::RealTestDescription {
public:
TestDescription_suite_test_write_test_write_style() : CxxTest::RealTestDescription( Tests_test_write, suiteDescription_test_write, 99, "test_write_style" ) {}
TestDescription_suite_test_write_test_write_style() : CxxTest::RealTestDescription( Tests_test_write, suiteDescription_test_write, 102, "test_write_style" ) {}
void runTest() { suite_test_write.test_write_style(); }
} testDescription_suite_test_write_test_write_style;
static class TestDescription_suite_test_write_test_write_height : public CxxTest::RealTestDescription {
public:
TestDescription_suite_test_write_test_write_height() : CxxTest::RealTestDescription( Tests_test_write, suiteDescription_test_write, 110, "test_write_height" ) {}
TestDescription_suite_test_write_test_write_height() : CxxTest::RealTestDescription( Tests_test_write, suiteDescription_test_write, 113, "test_write_height" ) {}
void runTest() { suite_test_write.test_write_height(); }
} testDescription_suite_test_write_test_write_height;
static class TestDescription_suite_test_write_test_write_hyperlink : public CxxTest::RealTestDescription {
public:
TestDescription_suite_test_write_test_write_hyperlink() : CxxTest::RealTestDescription( Tests_test_write, suiteDescription_test_write, 119, "test_write_hyperlink" ) {}
TestDescription_suite_test_write_test_write_hyperlink() : CxxTest::RealTestDescription( Tests_test_write, suiteDescription_test_write, 122, "test_write_hyperlink" ) {}
void runTest() { suite_test_write.test_write_hyperlink(); }
} testDescription_suite_test_write_test_write_hyperlink;
static class TestDescription_suite_test_write_test_write_hyperlink_rels : public CxxTest::RealTestDescription {
public:
TestDescription_suite_test_write_test_write_hyperlink_rels() : CxxTest::RealTestDescription( Tests_test_write, suiteDescription_test_write, 128, "test_write_hyperlink_rels" ) {}
TestDescription_suite_test_write_test_write_hyperlink_rels() : CxxTest::RealTestDescription( Tests_test_write, suiteDescription_test_write, 131, "test_write_hyperlink_rels" ) {}
void runTest() { 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, 142, "test_write_hyperlink_image_rels" ) {}
TestDescription_suite_test_write_test_write_hyperlink_image_rels() : CxxTest::RealTestDescription( Tests_test_write, suiteDescription_test_write, 145, "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 {
public:
TestDescription_suite_test_write_test_hyperlink_value() : CxxTest::RealTestDescription( Tests_test_write, suiteDescription_test_write, 147, "test_hyperlink_value" ) {}
TestDescription_suite_test_write_test_hyperlink_value() : CxxTest::RealTestDescription( Tests_test_write, suiteDescription_test_write, 150, "test_hyperlink_value" ) {}
void runTest() { suite_test_write.test_hyperlink_value(); }
} testDescription_suite_test_write_test_hyperlink_value;
static class TestDescription_suite_test_write_test_write_auto_filter : public CxxTest::RealTestDescription {
public:
TestDescription_suite_test_write_test_write_auto_filter() : CxxTest::RealTestDescription( Tests_test_write, suiteDescription_test_write, 156, "test_write_auto_filter" ) {}
TestDescription_suite_test_write_test_write_auto_filter() : CxxTest::RealTestDescription( Tests_test_write, suiteDescription_test_write, 159, "test_write_auto_filter" ) {}
void runTest() { suite_test_write.test_write_auto_filter(); }
} testDescription_suite_test_write_test_write_auto_filter;
static class TestDescription_suite_test_write_test_write_auto_filter_filter_column : public CxxTest::RealTestDescription {
public:
TestDescription_suite_test_write_test_write_auto_filter_filter_column() : CxxTest::RealTestDescription( Tests_test_write, suiteDescription_test_write, 169, "test_write_auto_filter_filter_column" ) {}
TestDescription_suite_test_write_test_write_auto_filter_filter_column() : CxxTest::RealTestDescription( Tests_test_write, suiteDescription_test_write, 172, "test_write_auto_filter_filter_column" ) {}
void runTest() { suite_test_write.test_write_auto_filter_filter_column(); }
} testDescription_suite_test_write_test_write_auto_filter_filter_column;
static class TestDescription_suite_test_write_test_write_auto_filter_sort_condition : public CxxTest::RealTestDescription {
public:
TestDescription_suite_test_write_test_write_auto_filter_sort_condition() : CxxTest::RealTestDescription( Tests_test_write, suiteDescription_test_write, 174, "test_write_auto_filter_sort_condition" ) {}
TestDescription_suite_test_write_test_write_auto_filter_sort_condition() : CxxTest::RealTestDescription( Tests_test_write, suiteDescription_test_write, 177, "test_write_auto_filter_sort_condition" ) {}
void runTest() { suite_test_write.test_write_auto_filter_sort_condition(); }
} testDescription_suite_test_write_test_write_auto_filter_sort_condition;
static class TestDescription_suite_test_write_test_freeze_panes_horiz : public CxxTest::RealTestDescription {
public:
TestDescription_suite_test_write_test_freeze_panes_horiz() : CxxTest::RealTestDescription( Tests_test_write, suiteDescription_test_write, 179, "test_freeze_panes_horiz" ) {}
TestDescription_suite_test_write_test_freeze_panes_horiz() : CxxTest::RealTestDescription( Tests_test_write, suiteDescription_test_write, 182, "test_freeze_panes_horiz" ) {}
void runTest() { suite_test_write.test_freeze_panes_horiz(); }
} testDescription_suite_test_write_test_freeze_panes_horiz;
static class TestDescription_suite_test_write_test_freeze_panes_vert : public CxxTest::RealTestDescription {
public:
TestDescription_suite_test_write_test_freeze_panes_vert() : CxxTest::RealTestDescription( Tests_test_write, suiteDescription_test_write, 188, "test_freeze_panes_vert" ) {}
TestDescription_suite_test_write_test_freeze_panes_vert() : CxxTest::RealTestDescription( Tests_test_write, suiteDescription_test_write, 191, "test_freeze_panes_vert" ) {}
void runTest() { suite_test_write.test_freeze_panes_vert(); }
} testDescription_suite_test_write_test_freeze_panes_vert;
static class TestDescription_suite_test_write_test_freeze_panes_both : public CxxTest::RealTestDescription {
public:
TestDescription_suite_test_write_test_freeze_panes_both() : CxxTest::RealTestDescription( Tests_test_write, suiteDescription_test_write, 197, "test_freeze_panes_both" ) {}
TestDescription_suite_test_write_test_freeze_panes_both() : CxxTest::RealTestDescription( Tests_test_write, suiteDescription_test_write, 200, "test_freeze_panes_both" ) {}
void runTest() { suite_test_write.test_freeze_panes_both(); }
} testDescription_suite_test_write_test_freeze_panes_both;
static class TestDescription_suite_test_write_test_long_number : public CxxTest::RealTestDescription {
public:
TestDescription_suite_test_write_test_long_number() : CxxTest::RealTestDescription( Tests_test_write, suiteDescription_test_write, 206, "test_long_number" ) {}
TestDescription_suite_test_write_test_long_number() : CxxTest::RealTestDescription( Tests_test_write, suiteDescription_test_write, 209, "test_long_number" ) {}
void runTest() { suite_test_write.test_long_number(); }
} testDescription_suite_test_write_test_long_number;
static class TestDescription_suite_test_write_test_short_number : public CxxTest::RealTestDescription {
public:
TestDescription_suite_test_write_test_short_number() : CxxTest::RealTestDescription( Tests_test_write, suiteDescription_test_write, 214, "test_short_number" ) {}
TestDescription_suite_test_write_test_short_number() : CxxTest::RealTestDescription( Tests_test_write, suiteDescription_test_write, 217, "test_short_number" ) {}
void runTest() { 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 {
public:
TestDescription_suite_test_write_test_write_images() : CxxTest::RealTestDescription( Tests_test_write, suiteDescription_test_write, 222, "test_write_images" ) {}
TestDescription_suite_test_write_test_write_images() : CxxTest::RealTestDescription( Tests_test_write, suiteDescription_test_write, 225, "test_write_images" ) {}
void runTest() { suite_test_write.test_write_images(); }
} testDescription_suite_test_write_test_write_images;

View File

@ -13,11 +13,6 @@ class test_write : public CxxTest::TestSuite
public:
void test_write_empty_workbook()
{
xlnt::workbook wbt;
auto ws = wbt.get_active_sheet();
ws.get_cell("A2").set_value("Thomas Fussell");
wbt.save("/Users/thomas/Desktop/a.xlsx");
if(PathHelper::FileExists(temp_file.GetFilename()))
{
PathHelper::DeleteFile(temp_file.GetFilename());