Commit ed59c2b9 authored by ElenaSubbotina's avatar ElenaSubbotina

.

parent 925bca71
...@@ -189,6 +189,14 @@ namespace formulasconvert { ...@@ -189,6 +189,14 @@ namespace formulasconvert {
return c1 + (c3.empty() ? L"" : (L":" + c3) ); return c1 + (c3.empty() ? L"" : (L":" + c3) );
} }
} }
else if (sz == 5 && !what[1].matched)
{
const std::wstring c1 = what[2].str();
const std::wstring c2 = what[3].str(); //sheet name 2
const std::wstring c3 = what[4].str();
return c1 + (c3.empty() ? L"" : (L":" + c3) );
}
return L""; return L"";
} }
std::wstring odf2oox_converter::Impl::replace_named_ref_formater1(boost::wsmatch const & what) std::wstring odf2oox_converter::Impl::replace_named_ref_formater1(boost::wsmatch const & what)
...@@ -216,10 +224,10 @@ namespace formulasconvert { ...@@ -216,10 +224,10 @@ namespace formulasconvert {
void odf2oox_converter::Impl::replace_cells_range(std::wstring& expr, bool withTableName) void odf2oox_converter::Impl::replace_cells_range(std::wstring& expr, bool withTableName)
{ {
convert_with_TableName = withTableName; convert_with_TableName = withTableName;
//boost::wregex simpleRef(L"\\[\\.([a-zA-Z]+\\d+)(?::\\.([a-zA-Z]+\\d+)){0,1}\\]");
boost::wregex complexRef(L"\\[(?:\\$)?([^\\.]+?){0,1}\\.(\\${0,1}[a-zA-Z]*\\${0,1}\\d*)(?::\\.(\\${0,1}[a-zA-Z]*\\${0,1}\\d*)){0,1}\\]"); boost::wregex complexRef(L"\\[(?:\$)?([^\\.]+?){0,1}\\.(\\${0,1}[a-zA-Z]*\\${0,1}\\d*)(?::(\\${0,1}[^\\.]+?){0,1}\\.(\\${0,1}[a-zA-Z]*\\${0,1}\\d*)){0,1}\\]");
/* /*
[ $ Sheet2 . A1 : . B5 ] [ $ Sheet2 . A1 : ( $ Sheet2)? . B5 ]
*/ */
const std::wstring res = boost::regex_replace( const std::wstring res = boost::regex_replace(
...@@ -235,7 +243,7 @@ namespace formulasconvert { ...@@ -235,7 +243,7 @@ namespace formulasconvert {
//boost::wregex complexRef(L"\\${0,1}([^\\.]+?){0,1}\\.(\\${0,1}[a-zA-Z]+\\${0,1}\\d+)(?::\\.(\\${0,1}[a-zA-Z]+\\${0,1}\\d+)){0,1}"); //boost::wregex complexRef(L"\\${0,1}([^\\.]+?){0,1}\\.(\\${0,1}[a-zA-Z]+\\${0,1}\\d+)(?::\\.(\\${0,1}[a-zA-Z]+\\${0,1}\\d+)){0,1}");
boost::wregex complexRef(L"\\${0,1}([^\\.\\s]+?){0,1}\\.(\\${0,1}[a-zA-Z]*\\${0,1}\\d*)(?::\\${0,1}([^\\.\\s]+?){0,1}\\.(\\${0,1}[a-zA-Z]*\\${0,1}\\d*)){0,1}"); boost::wregex complexRef(L"\\${0,1}([^\\.\\s]+?){0,1}\\.(\\${0,1}[a-zA-Z]*\\${0,1}\\d*)(?::\\${0,1}([^\\.\\s]+?){0,1}\\.(\\${0,1}[a-zA-Z]*\\${0,1}\\d*)){0,1}");
const std::wstring res = boost::regex_replace( const std::wstring res = boost::regex_replace(
expr, expr,
complexRef, complexRef,
...@@ -590,34 +598,37 @@ namespace formulasconvert { ...@@ -590,34 +598,37 @@ namespace formulasconvert {
bool isFormula = impl_->check_formula(workstr); bool isFormula = impl_->check_formula(workstr);
boost::wregex complexRef(L"('(?!\\s\\'){0,1}.*?')");// поиск того что в апострофах и замена там if (isFormula)
{
workstr = impl_->convert(expr);
}
else
{
workstr = boost::regex_replace( boost::wregex complexRef(L"('(?!\\s\\'){0,1}.*?')");// поиск того что в апострофах и замена там
workstr,
complexRef,
&replace_point_space,
boost::match_default | boost::format_all);
XmlUtils::replace_all( workstr, L"'", L"APOSTROF"); workstr = boost::regex_replace(
workstr,
impl_->replace_cells_range(workstr, withTableName); complexRef,
impl_->replace_semicolons(workstr); &replace_point_space,
impl_->replace_vertical(workstr); boost::match_default | boost::format_all);
int res_find=0; XmlUtils::replace_all( workstr, L"'", L"APOSTROF");
if ((res_find = workstr.find(L"CONCATINATE")) > 0)
{ impl_->replace_cells_range(workstr, withTableName);
//могут быть частично заданы диапазоны impl_->replace_semicolons(workstr);
//todooo impl_->replace_vertical(workstr);
} int res_find=0;
XmlUtils::replace_all( workstr, L"PROBEL" , L" "); if ((res_find = workstr.find(L"CONCATINATE")) > 0)
XmlUtils::replace_all( workstr, L"APOSTROF" , L"'"); {
XmlUtils::replace_all( workstr, L"TOCHKA" , L"."); //могут быть частично заданы диапазоны
//todooo
if (!isFormula) }
{ XmlUtils::replace_all( workstr, L"PROBEL" , L" ");
workstr = L"\"" + workstr + L"\""; XmlUtils::replace_all( workstr, L"APOSTROF" , L"'");
XmlUtils::replace_all( workstr, L"TOCHKA" , L".");
} }
return workstr; return workstr;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment