Compare commits

...

10 Commits

21 changed files with 264 additions and 169 deletions

View File

@ -508,10 +508,8 @@ namespace formulasconvert {
void odf2oox_converter::Impl::split_distance_by(const std::wstring& expr, const std::wstring& by, std::vector<std::wstring>& out)
{
std::wstring workstr = expr;
boost::regex_replace(
workstr,
std::wstring workstr = boost::regex_replace(
expr,
boost::wregex(L"('.*?')|(\".*?\")"),
&convert_scobci, boost::match_default | boost::format_all);
@ -529,10 +527,8 @@ namespace formulasconvert {
std::wstring odf2oox_converter::Impl::convert_chart_distance(const std::wstring& expr)
{
std::wstring workstr = is_forbidden(expr);
boost::regex_replace(
workstr,
std::wstring workstr = boost::regex_replace(
is_forbidden(expr),
boost::wregex(L"('.*?')|(\".*?\")"),
&convert_scobci, boost::match_default | boost::format_all);

View File

@ -245,12 +245,16 @@ void oox_serialize_aLst(std::wostream & strm, const std::vector<odf_reader::_pro
{
names.push_back(L"adj1");
}
else if (std::wstring::npos != shapeGeomPreset.find(L"heptagon") ||
std::wstring::npos != shapeGeomPreset.find(L"decagon"))
{
values.clear();
}
//else if (std::wstring::npos != shapeGeomPreset.find(L"decagon"))
//{
// names.push_back(L"vf");
//}
//else if (std::wstring::npos != shapeGeomPreset.find(L"heptagon") ||
// std::wstring::npos != shapeGeomPreset.find(L"pentagon"))
//else if (std::wstring::npos != shapeGeomPreset.find(L"pentagon"))
//{
// names.push_back(L"hf");
// names.push_back(L"vf");

View File

@ -46,7 +46,6 @@ namespace oox {
xlsx_defined_names();
~xlsx_defined_names();
public:
void add(std::wstring const & name, std::wstring const & ref, bool formula, int tableId);
void xlsx_serialize(std::wostream & _Wostream);

View File

@ -218,13 +218,6 @@ void xlsx_xml_worksheet::write_to(std::wostream & strm)
CP_XML_ATTR(L"r:id",impl_->vml_drawingId_);
}
}
if (!impl_->tableParts_.str().empty())
{
CP_XML_NODE(L"tableParts")
{
CP_XML_STREAM() << impl_->tableParts_.str();
}
}
if (!impl_->ole_objects_.str().empty())
{
CP_XML_NODE(L"oleObjects")
@ -239,6 +232,13 @@ void xlsx_xml_worksheet::write_to(std::wostream & strm)
CP_XML_STREAM() << impl_->controls_.str();
}
}
if (!impl_->tableParts_.str().empty())
{
CP_XML_NODE(L"tableParts")
{
CP_XML_STREAM() << impl_->tableParts_.str();
}
}
CP_XML_STREAM() << impl_->picture_background_.str();
//CP_XML_NODE(L"headerFooter){}

View File

@ -302,12 +302,24 @@ void xlsx_pivots_context::Impl::calc_headers()
std::map<size_t, size_t>::iterator pFind;
//current_.bAxisCol = false;
//current_.bAxisRow = false;
size_t min_col = 0xffffff, min_row = 0xffffff;
size_t prev_col, prev_row;
for (size_t i = 0; i < current_.headers.size(); i++)//("F18","F19","F23","G21","H21")
{
size_t row = 0, col = 0;
oox::getCellAddressInv(current_.headers[i], col, row);
//if (i > 0)
//{
// if (col != prev_col)current_.bAxisCol = true;
// if (row != prev_row)current_.bAxisRow = true;
//}
prev_col = col;
prev_row = row;
if (col < min_col) min_col = col;
if (row < min_row) min_row = row;
@ -578,11 +590,17 @@ void xlsx_pivots_context::Impl::sort_fields()
i--;
}
}
if ((bAddRepeateCol || (count_items_col == 0 && current_.bAxisCol))/* && bShowEmptyCol*/) ///* || (bEmptyColCache && current_.grand_total < 0)*/?? Financial Execution (template).ods
bool data_col_repeate = false;
if ((bAddRepeateRow || (count_items_row == 0 && current_.bAxisRow)) && (current_.grand_total == 1 || current_.grand_total == 3 || current_.data_on_row))/* && bShowEmptyRow*/
{
current_.row_fields.push_back(-2);
data_col_repeate = true;
}
if (!data_col_repeate && (bAddRepeateCol || (count_items_col == 0 && current_.bAxisCol)) && (current_.grand_total == 1 || current_.grand_total == 2 || current_.data_fields.size() > 1 ))/* && bShowEmptyCol*/ ///* || (bEmptyColCache && current_.grand_total < 0)*/?? Financial Execution (template).ods
current_.col_fields.push_back(-2);
if ((bAddRepeateRow || (count_items_row == 0 && current_.bAxisRow))/* && bShowEmptyRow*/)
current_.row_fields.push_back(-2);
}
void xlsx_pivots_context::Impl::serialize_view(std::wostream & strm)
{

View File

@ -81,8 +81,8 @@ void xlsx_data_range::serialize_sort (std::wostream & _Wostream)
std::wstring ref1, ref2;
size_t col_1, row_1, col_2, row_2;
int pos = ref.find(L":");
if (pos >= 0)
size_t pos = ref.find(L":");
if (pos != std::wstring::npos)
{
ref1 = ref.substr(0, pos );
ref2 = ref.substr(pos + 1);

View File

@ -53,49 +53,20 @@ typedef _CP_PTR(xlsx_table_state) xlsx_table_state_ptr;
class xlsx_data_range;
typedef _CP_PTR(xlsx_data_range) xlsx_data_range_ptr;
class xlsx_data_range_values;
typedef _CP_PTR(xlsx_data_range_values) xlsx_data_range_values_ptr;
class xlsx_data_range_values
{
public:
xlsx_data_range_values(size_t row, size_t col1, size_t col2) : withHeader(false), filter(false), row_header(row), start_column(col1), end_column(col2)
{
for (size_t i = start_column; i <= end_column; i++)
values.push_back(L"");
}
size_t row_header;
size_t start_column;
size_t end_column;
bool withHeader;
bool filter;
std::vector<std::wstring> values;
void set_value(size_t col, size_t row, const std::wstring& value)
{
while (col - start_column + 1 >= values.size())
values.push_back(L"");
values[col - start_column] = value;
}
bool in_range(size_t col, size_t row) {return (row_header == row && (col >= start_column && col <= end_column));}
};
class xlsx_data_range
{
public:
xlsx_data_range() : byRow(true), filter(false), withHeader(false), cell_start(0,0), cell_end(0,0) {}
xlsx_data_range() : byRow(true), filter(false), bTablePart(true), withHeader(false), cell_start(0,0), cell_end(0,0) {}
std::wstring table_name;
std::wstring name;
std::wstring ref;
std::pair<int, int> cell_start;
std::pair<int, int> cell_end;
bool bTablePart;
bool byRow;
bool filter;
bool withHeader;
@ -104,6 +75,33 @@ public:
void serialize_sort (std::wostream & _Wostream);
void serialize_autofilter (std::wostream & _Wostream);
size_t row_header;
size_t start_column_header;
size_t end_column_header;
std::vector<std::wstring> header_values;
void set_header(size_t row, size_t col1, size_t col2)
{
row_header = row;
start_column_header = col1;
end_column_header = col2;
for (size_t i = start_column_header; i <= end_column_header; i++)
header_values.push_back(L"");
}
void set_header_value(size_t col, size_t row, const std::wstring& value)
{
while (col - start_column_header + 1 >= header_values.size())
header_values.push_back(L"");
header_values[col - start_column_header] = value;
}
bool in_header(size_t col, size_t row)
{
return (row_header == row && (col >= start_column_header && col <= end_column_header));
}
};
class xlsx_table_state

View File

@ -60,23 +60,20 @@ xlsx_table_state_ptr xlsx_table_context::state()
return xlsx_table_state_ptr();
}
void xlsx_table_context::start_database_range(std::wstring tableName, std::wstring ref)
bool xlsx_table_context::start_database_range(const std::wstring & name, const std::wstring & ref)
{
formulasconvert::odf2oox_converter convert;
ref = convert.convert_named_ref(ref);
std::wstring oox_ref = convert.convert_named_ref(ref);
std::wstring ref1, ref2;
size_t pos = ref.find(L":");
size_t pos = oox_ref.find(L":");
std::wstring xlsx_table_name;
if (pos != std::wstring::npos)
{
xlsx_data_ranges_.push_back(xlsx_data_range_ptr(new xlsx_data_range()));
xlsx_data_ranges_.back()->table_name = tableName;
ref1 = ref.substr(0, pos );
ref2 = ref.substr(pos + 1);
ref1 = oox_ref.substr(0, pos );
ref2 = oox_ref.substr(pos + 1);
pos = ref1.find(L"!");
if (pos > 0)
@ -88,25 +85,33 @@ void xlsx_table_context::start_database_range(std::wstring tableName, std::wstri
pos = ref2.find(L"!");
if (pos > 0) ref2 = ref2.substr(pos + 1);
xlsx_data_ranges_.back()->ref = ref1 + L":" + ref2;
size_t col1, col2, row1, row2;
getCellAddressInv(ref1, col1, row1);
xlsx_data_ranges_.back()->cell_start = std::pair<int, int>(col1, row1);
XmlUtils::replace_all( xlsx_table_name, L"'", L"");
getCellAddressInv(ref1, col1, row1);
getCellAddressInv(ref2, col2, row2);
xlsx_data_ranges_.push_back(xlsx_data_range_ptr(new xlsx_data_range()));
if (/*name.find(L"__Anonymous_Sheet_DB__") != std::wstring::npos ||*/ col1 == col2)
{//check range in pivots
xlsx_data_ranges_.back()->bTablePart = false;
}
xlsx_data_ranges_.back()->name = name;
xlsx_data_ranges_.back()->table_name = xlsx_table_name;
xlsx_data_ranges_.back()->ref = ref1 + L":" + ref2;
xlsx_data_ranges_.back()->cell_start = std::pair<int, int>(col1, row1);
xlsx_data_ranges_.back()->cell_end = std::pair<int, int>(col2, row2);
xlsx_data_ranges_values_.push_back(xlsx_data_range_values_ptr(new xlsx_data_range_values(row1, col1, col2)));
xlsx_data_ranges_.back()->set_header(row1, col1, col2);
}
if (!xlsx_table_name.empty())
{
XmlUtils::replace_all( xlsx_table_name, L"'", L"");
xlsx_data_ranges_map_.insert(std::pair<std::wstring, int> (xlsx_table_name, xlsx_data_ranges_.size() - 1));
}
return true;
}
void xlsx_table_context::set_database_orientation (bool val)
{
@ -119,14 +124,12 @@ void xlsx_table_context::set_database_header (bool val)
if (xlsx_data_ranges_.empty()) return;
xlsx_data_ranges_.back()->withHeader = val;
xlsx_data_ranges_values_.back()->withHeader = val;
}
void xlsx_table_context::set_database_filter (bool val)
{
if (xlsx_data_ranges_.empty()) return;
xlsx_data_ranges_.back()->filter = val;
xlsx_data_ranges_values_.back()->filter = val;
}
void xlsx_table_context::end_database_range()
{
@ -134,21 +137,55 @@ void xlsx_table_context::end_database_range()
void xlsx_table_context::set_database_range_value(int index, const std::wstring& value)
{
if (index < 0 || index > xlsx_data_ranges_.size()) return;
size_t col = state()->current_column();
size_t row = state()->current_row();
xlsx_data_ranges_values_[index]->set_value(col, row, value);
xlsx_data_ranges_[index]->set_header_value(col, row, value);
}
void xlsx_table_context::check_database_range_intersection(const std::wstring& table_name, const std::wstring& ref)
{
std::wstring ref1, ref2;
size_t col_1, row_1, col_2, row_2;
size_t pos = ref.find(L":");
if (pos != std::wstring::npos)
{
ref1 = ref.substr(0, pos );
ref2 = ref.substr(pos + 1);
}
getCellAddressInv(ref1, col_1, row_1);
getCellAddressInv(ref2, col_2, row_2);
for (size_t i = 0; i < xlsx_data_ranges_.size(); i++)
{
if (xlsx_data_ranges_[i]->table_name != table_name) continue;
//if ( xlsx_data_ranges_[i]->cell_start.second < row_2 || xlsx_data_ranges_[i]->cell_end.second > row_1
// || xlsx_data_ranges_[i]->cell_end.first < col_1 || xlsx_data_ranges_[i]->cell_start.first > col_2 )
if (((col_1 <= xlsx_data_ranges_[i]->cell_start.first && xlsx_data_ranges_[i]->cell_start.first <= col_2) ||
(xlsx_data_ranges_[i]->cell_start.first <= col_1 && col_1 <= xlsx_data_ranges_[i]->cell_end.first))
&&
(( row_1 <= xlsx_data_ranges_[i]->cell_start.second && xlsx_data_ranges_[i]->cell_start.second <= row_2) ||
(xlsx_data_ranges_[i]->cell_start.second <= row_1 && row_1 <= xlsx_data_ranges_[i]->cell_end.second )))
{
xlsx_data_ranges_[i]->bTablePart = false;
}
}
}
int xlsx_table_context::in_database_range()
{
int col = state()->current_column();
int row = state()->current_row();
for (size_t i = 0; i < xlsx_data_ranges_values_.size(); i++)
for (size_t i = 0; i < xlsx_data_ranges_.size(); i++)
{
if ((xlsx_data_ranges_values_[i]->withHeader || xlsx_data_ranges_values_[i]->filter)
&& xlsx_data_ranges_values_[i]->in_range(col, row))
if (xlsx_data_ranges_[i]->table_name != state()->get_table_name()) continue;
if (/*(xlsx_data_ranges_values_[i]->withHeader || xlsx_data_ranges_values_[i]->filter)&& */
xlsx_data_ranges_[i]->in_header(col, row))
{
return (int)i;
}
@ -282,6 +319,8 @@ void xlsx_table_context::serialize_sort(std::wostream & _Wostream)
for (std::multimap<std::wstring, int>::iterator it = range.first; it != range.second; ++it)
{
if (xlsx_data_ranges_[it->second]->bTablePart) continue;
xlsx_data_ranges_[it->second]->serialize_sort(_Wostream);
}
}
@ -291,10 +330,12 @@ void xlsx_table_context::serialize_tableParts(std::wostream & _Wostream, rels &
std::pair<std::multimap<std::wstring, int>::iterator, std::multimap<std::wstring, int>::iterator> range;
range = xlsx_data_ranges_map_.equal_range(state()->tableName_);
range = xlsx_data_ranges_map_.equal_range(state()->get_table_name());
for (std::multimap<std::wstring, int>::iterator it = range.first; it != range.second; ++it)
{
if (false == xlsx_data_ranges_[it->second]->bTablePart) continue;
size_t id = xlsx_conversion_context_->get_table_parts_size() + 1;
std::wstring rId = L"tprtId" + std::to_wstring(id);
@ -317,15 +358,15 @@ void xlsx_table_context::serialize_tableParts(std::wostream & _Wostream, rels &
CP_XML_ATTR(L"xmlns", L"http://schemas.openxmlformats.org/spreadsheetml/2006/main");
CP_XML_ATTR(L"id", id);
CP_XML_ATTR(L"name", xlsx_data_ranges_[it->second]->table_name);
CP_XML_ATTR(L"displayName", xlsx_data_ranges_[it->second]->table_name);
CP_XML_ATTR(L"name", xlsx_data_ranges_[it->second]->name);
CP_XML_ATTR(L"displayName", xlsx_data_ranges_[it->second]->name);
CP_XML_ATTR(L"ref", xlsx_data_ranges_[it->second]->ref);
if (xlsx_data_ranges_[it->second]->withHeader == false &&
xlsx_data_ranges_[it->second]->filter == false)
CP_XML_ATTR(L"headerRowCount", 0);
CP_XML_ATTR(L"totalsRowCount", 0);
//CP_XML_ATTR(L"totalsRowCount", 0);
CP_XML_ATTR(L"totalsRowShown", 0);
xlsx_data_ranges_[it->second]->serialize_autofilter(CP_XML_STREAM());
@ -340,7 +381,7 @@ void xlsx_table_context::serialize_tableParts(std::wostream & _Wostream, rels &
{
CP_XML_NODE(L"tableColumn")
{
std::wstring column_name = xlsx_data_ranges_values_[it->second]->values[id];
std::wstring column_name = xlsx_data_ranges_[it->second]->header_values[id];
if (column_name.empty())
{
column_name = L"Column_" + std::to_wstring(id + 1);
@ -377,6 +418,8 @@ void xlsx_table_context::serialize_autofilter(std::wostream & _Wostream)
for (std::multimap<std::wstring, int>::iterator it = range.first; it != range.second; ++it)
{
if (xlsx_data_ranges_[it->second]->bTablePart) continue;
if (xlsx_data_ranges_[it->second]->filter)
{
if (cell_start.first < 0 || xlsx_data_ranges_[it->second]->cell_start.first < cell_start.first )
@ -402,7 +445,7 @@ void xlsx_table_context::serialize_autofilter(std::wostream & _Wostream)
{
CP_XML_NODE(L"autoFilter")
{
//в автофильтре тока простые диапазоны .. для сложных нужно выделять tablePart - todooo
//в автофильтре тока простые диапазоны .. для сложных - tablePart
CP_XML_ATTR(L"ref", getCellAddress(cell_start.first, cell_start.second) + L":" + getCellAddress(cell_end.first, cell_end.second));
//CP_XML_ATTR(L"ref", ref);
}

View File

@ -112,23 +112,23 @@ public:
void dump_rels_hyperlinks (rels & Rels);
void dump_rels_ole_objects (rels & Rels);
void start_database_range(std::wstring table_name, std::wstring ref);
bool start_database_range(const std::wstring &table_name, const std::wstring &ref);
void set_database_orientation (bool val);
void set_database_header (bool val);
void set_database_filter (bool val);
void add_database_sort (int field_number, int order);
void add_database_sort (int field_number, int order);
void end_database_range();
int in_database_range();
void set_database_range_value(int index, const std::wstring& value);
void check_database_range_intersection(const std::wstring& table_name, const std::wstring& ref);
private:
xlsx_conversion_context *xlsx_conversion_context_;
xlsx_text_context &xlsx_text_context_;
std::vector<xlsx_table_state_ptr> xlsx_table_states_;
std::vector<xlsx_data_range_ptr> xlsx_data_ranges_;
std::vector<xlsx_data_range_values_ptr> xlsx_data_ranges_values_;
std::multimap<std::wstring, int> xlsx_data_ranges_map_;

View File

@ -477,8 +477,8 @@ void xlsx_conversion_context::end_table()
get_table_context().serialize_page_properties (current_sheet().page_properties());
get_table_context().serialize_conditionalFormatting (current_sheet().conditionalFormatting());
get_table_context().serialize_tableParts (current_sheet().tableParts(), current_sheet().sheet_rels());
//get_table_context().serialize_autofilter (current_sheet().autofilter());
//get_table_context().serialize_sort (current_sheet().sort());
get_table_context().serialize_autofilter (current_sheet().autofilter());
get_table_context().serialize_sort (current_sheet().sort());
get_table_context().serialize_merge_cells (current_sheet().mergeCells());
get_table_context().serialize_data_validation (current_sheet().dataValidations());

View File

@ -201,6 +201,7 @@ public:
mediaitems & get_mediaitems() { return mediaitems_; }
static std::unordered_map<std::wstring, int> mapExternalLink_;
std::map<std::wstring, int> mapUsedNames_;
private:
void create_new_sheet (std::wstring const & name);

View File

@ -284,6 +284,7 @@ void form_button::docx_convert(oox::docx_conversion_context & Context)
void form_button::xlsx_convert(oox::xlsx_conversion_context & Context)
{
Context.get_forms_context().start_element(1);
Context.get_forms_context().set_element(dynamic_cast<form_element*>(this));
form_element::xlsx_convert(Context);
}

View File

@ -87,6 +87,7 @@ void table_data_pilot_table::add_child_element( xml::sax * Reader, const std::ws
CP_CREATE_ELEMENT (source_);
}
void table_data_pilot_table::xlsx_convert(oox::xlsx_conversion_context & Context)
{
if (!source_) return;
@ -105,6 +106,8 @@ void table_data_pilot_table::xlsx_convert(oox::xlsx_conversion_context & Context
std::wstring ref = formulas_converter.convert_named_ref(*table_target_range_address_, false);
sheet_name = formulas_converter.get_table_name();
Context.get_table_context().check_database_range_intersection(sheet_name, ref);
Context.get_pivots_context().set_view_target_range(ref);
Context.get_pivots_context().set_view_target_table_name(sheet_name);
}

View File

@ -88,24 +88,43 @@ void table_database_range::add_child_element( xml::sax * Reader, const std::wstr
void table_database_range::xlsx_convert(oox::xlsx_conversion_context & Context)
{
if (!table_target_range_address_) return;
if (!table_name_) return;
Context.get_table_context().start_database_range(table_name_.get_value_or(L""), *table_target_range_address_);
if (table_display_filter_buttons_)
Context.get_table_context().set_database_filter(table_display_filter_buttons_->get());
std::wstring name = table_name_.get();
if (table_orientation_)
Context.get_table_context().set_database_orientation(table_orientation_->get_type() == table_orientation::row ? true : false);
if (table_contains_header_)
Context.get_table_context().set_database_header(table_contains_header_->get());
for (size_t i = 0; i < content_.size(); i++)
std::map<std::wstring, int>::iterator pFind = Context.mapUsedNames_.find(name);
if (pFind == Context.mapUsedNames_.end())
{
content_[i]->xlsx_convert(Context);
Context.mapUsedNames_.insert(std::make_pair(name, 1));
}
else
{
name += L"_" + std::to_wstring(pFind->second);
pFind->second++;
}
if (Context.get_table_context().start_database_range(name, *table_target_range_address_))
{
if (table_display_filter_buttons_)
Context.get_table_context().set_database_filter(table_display_filter_buttons_->get());
Context.get_table_context().end_database_range();
if (table_orientation_)
Context.get_table_context().set_database_orientation(table_orientation_->get_type() == table_orientation::row ? true : false);
if (table_contains_header_)
Context.get_table_context().set_database_header(table_contains_header_->get());
for (size_t i = 0; i < content_.size(); i++)
{
content_[i]->xlsx_convert(Context);
}
Context.get_table_context().end_database_range();
}
else
{
Context.get_xlsx_defined_names().add(name, table_target_range_address_.get(), false, -1);
}
}
//--------------------------------------------------------------------------------------------------

View File

@ -94,8 +94,19 @@ void table_named_range::xlsx_convert(oox::xlsx_conversion_context & Context)
{
tableId = Context.get_table_context().state()->get_table_id();
}
oox::xlsx_defined_names & ctx = Context.get_xlsx_defined_names();
ctx.add(table_name_.get(), table_cell_range_address_.get(), false, tableId);
std::wstring name = table_name_.get();
std::map<std::wstring, int>::iterator pFind = Context.mapUsedNames_.find(name);
if (pFind == Context.mapUsedNames_.end())
{
Context.mapUsedNames_.insert(std::make_pair(name, 1));
}
else
{
name += L"_" + std::to_wstring(pFind->second);
pFind->second++;
}
Context.get_xlsx_defined_names().add(name, table_cell_range_address_.get(), false, tableId);
}
}
@ -130,8 +141,18 @@ void table_named_expression::xlsx_convert(oox::xlsx_conversion_context & Context
{
tableId = Context.get_table_context().state()->get_table_id();
}
oox::xlsx_defined_names & ctx = Context.get_xlsx_defined_names();
ctx.add(table_name_.get(), table_expression_.get(), true, tableId);
std::wstring name = table_name_.get();
std::map<std::wstring, int>::iterator pFind = Context.mapUsedNames_.find(name);
if (pFind == Context.mapUsedNames_.end())
{
Context.mapUsedNames_.insert(std::make_pair(name, 1));
}
else
{
name += L"_" + std::to_wstring(pFind->second);
pFind->second++;
}
Context.get_xlsx_defined_names().add(name, table_expression_.get(), true, tableId);
}
}

View File

@ -73,18 +73,6 @@ int table_table_cell_content::xlsx_convert(oox::xlsx_conversion_context & Contex
const int sharedStrId = Context.get_table_context().end_cell_content();
int index = Context.get_table_context().in_database_range();
if (index >= 0)
{
std::wstringstream strm;
for (size_t i = 0 ; i < elements_.size(); i++)
{
elements_[i]->text_to_stream(strm);
}
Context.get_table_context().set_database_range_value(index, strm.str());
}
return sharedStrId;
}
@ -853,9 +841,31 @@ void table_table_cell::xlsx_convert(oox::xlsx_conversion_context & Context)
const int sharedStringId = content_.xlsx_convert(Context, &textFormatProperties);
if (t_val == oox::XlsxCellType::str && sharedStringId >= 0)
t_val = oox::XlsxCellType::s;//в случае текста, если он есть берем кэшированное значение
//---------------------------------------------------------------------------------------------------------
if (t_val == oox::XlsxCellType::str || t_val == oox::XlsxCellType::inlineStr)
{
int index = Context.get_table_context().in_database_range();
if (index >= 0)
{
if (sharedStringId >= 0)
{
std::wstringstream strm;
content_.text_to_stream(strm);
Context.get_table_context().set_database_range_value(index, strm.str());
}
else if (str_val)
{
Context.get_table_context().set_database_range_value(index, str_val.get());
}
}
}
if (t_val == oox::XlsxCellType::str && sharedStringId >= 0)
{
t_val = oox::XlsxCellType::s;//в случае текста, если он есть берем кэшированное значение
}
//---------------------------------------------------------------------------------------------------------
if (skip_next_cell)break;
// пустые ячейки пропускаем.
@ -1138,7 +1148,7 @@ void table_covered_table_cell::xlsx_convert(oox::xlsx_conversion_context & Conte
const int sharedStringId = content_.xlsx_convert(Context, &textFormatProperties);
if (t_val == oox::XlsxCellType::str && sharedStringId >=0)
if (t_val == oox::XlsxCellType::str && sharedStringId >= 0)
t_val = oox::XlsxCellType::s;//в случае текста, если он есть берем кэшированное значение
if (skip_next_cell)break;

View File

@ -37,7 +37,14 @@ mkdir "build"
fi
cef_binary=cef_binary
cef_arch=$cef_binary.7z
cef_url=http://d2ettrnqo7v976.cloudfront.net/cef/3163/$platform$arch/$cef_arch
cef_version="3163"
if [[ "$platform" == *"linux"* ]]
then
cef_version="3202"
fi
cef_url=http://d2ettrnqo7v976.cloudfront.net/cef/$cef_version/$platform$arch/$cef_arch
if [[ "$platform" == *"linux"* ]]
then

View File

@ -1 +1 @@
2.4.556.0
2.5.556.0

View File

@ -255,12 +255,12 @@ public:
double bottom;
public:
CDoubleRect()
CDoubleRect(double dLeft = 0.0, double dTop = 0.0, double dRight = 0.0, double dBottom = 0.0)
{
left = 0;
top = 0;
right = 0;
bottom = 0;
left = dLeft;
top = dTop;
right = dRight;
bottom = dBottom;
}
CDoubleRect& operator=(const CDoubleRect& oSrc)
{
@ -303,6 +303,11 @@ public:
return (top + bottom) / 2.0;
}
inline CDoublePoint GetCenter() const
{
return CDoublePoint((left + right) / 2.0, (top + bottom) / 2.0);
}
inline INT IsPointInside(const CDoublePoint& oPoint)
{
return IsPointInside(oPoint.x, oPoint.y);

View File

@ -398,9 +398,9 @@ int CHtmlFile::Convert(const std::vector<std::wstring>& arFiles, const std::wstr
const char* nenv[4];
nenv[0] = sLibraryDir.c_str();
nenv[1] = "LD_PRELOAD=./libcef.so";
nenv[2] = "DISPLAY=:0";
nenv[3] = NULL;
nenv[1] = "DISPLAY=:0";
nenv[2] = NULL;
nenv[3] = NULL;
execve(sProgramm.c_str(),
(char * const *)nargs,
@ -419,9 +419,8 @@ int CHtmlFile::Convert(const std::vector<std::wstring>& arFiles, const std::wstr
const char* nenv[4];
nenv[0] = sLibraryDir.c_str();
nenv[1] = "LD_PRELOAD=./libcef.so";
nenv[2] = NULL;//"DISPLAY=:99";
nenv[3] = NULL;
nenv[1] = NULL;//"DISPLAY=:99";
nenv[2] = NULL;
execve("/usr/bin/xvfb-run", (char * const *)nargs, (char * const *)nenv);
exit(EXIT_SUCCESS);

View File

@ -16,6 +16,11 @@ CONFIG -= debug_and_release debug_and_release_target
DEFINES += HTMLFILE_USE_DYNAMIC_LIBRARY
DEFINES += UNICODECONVERTER_USE_DYNAMIC_LIBRARY
CORE_ROOT_DIR = $$PWD/../..
PWD_ROOT_DIR = $$PWD
include($$CORE_ROOT_DIR/Common/base.pri)
include($$CORE_ROOT_DIR/Common/3dParty/icu/icu.pri)
CONFIG(debug, debug|release) {
DESTDIR = $$PWD/Debug
} else {
@ -25,41 +30,10 @@ CONFIG(debug, debug|release) {
CONFIG += c++11
TEMPLATE = app
############### destination path ###############
DESTINATION_SDK_PATH = $$PWD/../../build/lib
# WINDOWS
win32:contains(QMAKE_TARGET.arch, x86_64):{
CONFIG(debug, debug|release) {
DESTINATION_SDK_PATH = $$DESTINATION_SDK_PATH/win_64/DEBUG
} else {
DESTINATION_SDK_PATH = $$DESTINATION_SDK_PATH/win_64
}
}
win32:!contains(QMAKE_TARGET.arch, x86_64):{
CONFIG(debug, debug|release) {
DESTINATION_SDK_PATH = $$DESTINATION_SDK_PATH/win_32/DEBUG
} else {
DESTINATION_SDK_PATH = $$DESTINATION_SDK_PATH/win_32
}
}
linux-g++:contains(QMAKE_HOST.arch, x86_64):{
DESTINATION_SDK_PATH = $$DESTINATION_SDK_PATH/linux_64
}
linux-g++:!contains(QMAKE_HOST.arch, x86_64):{
DESTINATION_SDK_PATH = $$DESTINATION_SDK_PATH/linux_32
}
LIBS += -L$$DESTINATION_SDK_PATH -lHtmlFile
LIBS += -L$$DESTINATION_SDK_PATH -lUnicodeConverter
LIBS += -L$$DESTINATION_SDK_PATH -lgraphics
LIBS += -L$$CORE_BUILDS_LIBRARIES_PATH -lUnicodeConverter -lkernel -lgraphics -lHtmlFile
linux-g++ | linux-g++-64 | linux-g++-32 {
QMAKE_LFLAGS += -Wl,--rpath=./
LIBS += $$PWD/../../build/bin/icu/linux_64/libicuuc.so.55
LIBS += $$PWD/../../build/bin/icu/linux_64/libicudata.so.55
message(linux)
}
@ -67,9 +41,6 @@ win32 {
LIBS += -ladvapi32 \
-luser32 \
-lshell32
LIBS += -L$$PWD/../../build/bin/icu/win_64/ -licudt
LIBS += -L$$PWD/../../build/bin/icu/win_64/ -licuuc
}
SOURCES += main.cpp