Commit 81a3ba9f authored by konovalovsergey's avatar konovalovsergey

use functionArgumentSeparator dependent on locale for formulas with tables

parent c259b185
...@@ -1694,13 +1694,21 @@ cStrucTable.prototype.toLocaleString = function () { ...@@ -1694,13 +1694,21 @@ cStrucTable.prototype.toLocaleString = function () {
var i; var i;
for (i = 0; i < this.hdtIndexes.length; ++i) { for (i = 0; i < this.hdtIndexes.length; ++i) {
if (0 != i) { if (0 != i) {
tblStr += FormulaSeparators.functionArgumentSeparatorDef; if (isLocal) {
tblStr += FormulaSeparators.functionArgumentSeparator;
} else {
tblStr += FormulaSeparators.functionArgumentSeparatorDef;
}
} }
tblStr += "[" + this._buildLocalTableString(this.hdtIndexes[i], isLocal) + "]"; tblStr += "[" + this._buildLocalTableString(this.hdtIndexes[i], isLocal) + "]";
} }
if (this.hdtcstartIndex) { if (this.hdtcstartIndex) {
if (this.hdtIndexes.length > 0) { if (this.hdtIndexes.length > 0) {
tblStr += FormulaSeparators.functionArgumentSeparatorDef; if (isLocal) {
tblStr += FormulaSeparators.functionArgumentSeparator;
} else {
tblStr += FormulaSeparators.functionArgumentSeparatorDef;
}
} }
var hdtcstart = this.hdtcstartIndex.name.replace(/#/g, "'#"); var hdtcstart = this.hdtcstartIndex.name.replace(/#/g, "'#");
tblStr += "[" + hdtcstart + "]"; tblStr += "[" + hdtcstart + "]";
......
...@@ -818,7 +818,7 @@ ...@@ -818,7 +818,7 @@
var bbox = AscCommonExcel.g_oRangeCache.getActiveRange(this.options.cellName); var bbox = AscCommonExcel.g_oRangeCache.getActiveRange(this.options.cellName);
this._formula = new AscCommonExcel.parserFormula(s.substr(1), null, ws); this._formula = new AscCommonExcel.parserFormula(s.substr(1), null, ws);
this._formula.parse(); this._formula.parse(true, true);
var r, offset, _e, _s, wsName = null, refStr, isName = false, _sColorPos; var r, offset, _e, _s, wsName = null, refStr, isName = false, _sColorPos;
...@@ -943,7 +943,7 @@ ...@@ -943,7 +943,7 @@
var bbox = AscCommonExcel.g_oRangeCache.getActiveRange(this.options.cellName); var bbox = AscCommonExcel.g_oRangeCache.getActiveRange(this.options.cellName);
this._formula = new AscCommonExcel.parserFormula(s.substr(1), null, ws); this._formula = new AscCommonExcel.parserFormula(s.substr(1), null, ws);
this._formula.parse(); this._formula.parse(true, true);
if (this._formula.RefPos && this._formula.RefPos.length > 0) { if (this._formula.RefPos && this._formula.RefPos.length > 0) {
for (var index = 0; index < this._formula.RefPos.length; index++) { for (var index = 0; index < this._formula.RefPos.length; index++) {
......
...@@ -716,15 +716,18 @@ function build_local_rx(data){ ...@@ -716,15 +716,18 @@ function build_local_rx(data){
function build_rx_table_local(local){ function build_rx_table_local(local){
rx_table_local = build_rx_table(local); rx_table_local = build_rx_table(local);
} }
function build_rx_table(local){ function build_rx_table(local) {
cStrucTableLocalColumns = ( local ? local : {"h": "Headers", "d": "Data", "a": "All", "tr": "This row", "t": "Totals"} ); cStrucTableLocalColumns = ( local ? local : {"h": "Headers", "d": "Data", "a": "All", "tr": "This row", "t": "Totals"} );
return build_rx_table_cur();
}
function build_rx_table_cur(){
var loc_all = cStrucTableLocalColumns['a'], var loc_all = cStrucTableLocalColumns['a'],
loc_headers = cStrucTableLocalColumns['h'], loc_headers = cStrucTableLocalColumns['h'],
loc_data = cStrucTableLocalColumns['d'], loc_data = cStrucTableLocalColumns['d'],
loc_totals = cStrucTableLocalColumns['t'], loc_totals = cStrucTableLocalColumns['t'],
loc_this_row = cStrucTableLocalColumns['tr'], loc_this_row = cStrucTableLocalColumns['tr'],
structured_tables_headata = new XRegExp('(?:\\[\\#'+loc_headers+'\\]\\,\\[\\#'+loc_data+'\\])'), structured_tables_headata = new XRegExp('(?:\\[\\#'+loc_headers+'\\]\\'+FormulaSeparators.functionArgumentSeparator+'\\[\\#'+loc_data+'\\])'),
structured_tables_datals = new XRegExp('(?:\\[\\#'+loc_data+'\\]\\,\\[\\#'+loc_totals+'\\])' ), structured_tables_datals = new XRegExp('(?:\\[\\#'+loc_data+'\\]\\'+FormulaSeparators.functionArgumentSeparator+'\\[\\#'+loc_totals+'\\])' ),
structured_tables_userColumn = new XRegExp('(?:[' + str_namedRanges + '\\d.]|\\u0027[#\\[\\]\\u0027]|\\u0020|\\u0025)+'), structured_tables_userColumn = new XRegExp('(?:[' + str_namedRanges + '\\d.]|\\u0027[#\\[\\]\\u0027]|\\u0020|\\u0025)+'),
structured_tables_reservedColumn = new XRegExp('\\#(?:'+loc_all+'|'+loc_headers+'|'+loc_totals+'|'+loc_data+'|'+loc_this_row+')|@'); structured_tables_reservedColumn = new XRegExp('\\#(?:'+loc_all+'|'+loc_headers+'|'+loc_totals+'|'+loc_data+'|'+loc_this_row+')|@');
...@@ -736,7 +739,7 @@ function build_rx_table(local){ ...@@ -736,7 +739,7 @@ function build_rx_table(local){
"userColumnRange": XRegExp.build( '\\[(?<colStart>{{uc}})\\]\\:\\[(?<colEnd>{{uc}})\\]', { "userColumnRange": XRegExp.build( '\\[(?<colStart>{{uc}})\\]\\:\\[(?<colEnd>{{uc}})\\]', {
"uc": structured_tables_userColumn "uc": structured_tables_userColumn
} ), } ),
"hdtcc" : XRegExp.build( '(?<hdt>\\[{{rc}}\\]|{{hd}}|{{dt}})(?:\\,(?:\\[(?<hdtcstart>{{uc}})\\])(?:\\:(?:\\[(?<hdtcend>{{uc}})\\]))?)?', { "hdtcc" : XRegExp.build( '(?<hdt>\\[{{rc}}\\]|{{hd}}|{{dt}})(?:\\'+FormulaSeparators.functionArgumentSeparator+'(?:\\[(?<hdtcstart>{{uc}})\\])(?:\\:(?:\\[(?<hdtcend>{{uc}})\\]))?)?', {
"rc": structured_tables_reservedColumn, "rc": structured_tables_reservedColumn,
"hd": structured_tables_headata, "hd": structured_tables_headata,
"dt": structured_tables_datals, "dt": structured_tables_datals,
...@@ -1743,6 +1746,7 @@ parserHelper.prototype.setDigitSeparator = function( sep ){ ...@@ -1743,6 +1746,7 @@ parserHelper.prototype.setDigitSeparator = function( sep ){
// build_rx_array_local( cBoolLocal, digitSeparatorDef, null); // build_rx_array_local( cBoolLocal, digitSeparatorDef, null);
rx_arraySeparators = new RegExp("^ *["+FormulaSeparators.arrayRowSeparatorDef+"\\"+FormulaSeparators.arrayColSeparatorDef+"] *"); rx_arraySeparators = new RegExp("^ *["+FormulaSeparators.arrayRowSeparatorDef+"\\"+FormulaSeparators.arrayColSeparatorDef+"] *");
} }
rx_table_local = build_rx_table_cur();
}; };
parserHelper.prototype.getColumnTypeByName = function(value) { parserHelper.prototype.getColumnTypeByName = function(value) {
var res; var res;
......
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