Commit b63ab906 authored by Alexander.Trofimov's avatar Alexander.Trofimov

fix bug 34421

parent 5d3c555e
...@@ -1696,11 +1696,11 @@ parserHelp.setDigitSeparator(AscCommon.g_oDefaultCultureInfo.NumberDecimalSepara ...@@ -1696,11 +1696,11 @@ parserHelp.setDigitSeparator(AscCommon.g_oDefaultCultureInfo.NumberDecimalSepara
} }
if (this.oneColumnIndex) { if (this.oneColumnIndex) {
var columns_1 = this.oneColumnIndex.name.replace(/#/g, "'#") columns_1 = this.oneColumnIndex.name.replace(/([#[\]])/g, "'$1");
tblStr += "[" + columns_1 + "]"; tblStr += "[" + columns_1 + "]";
} else if (this.colStartIndex && this.colEndIndex) { } else if (this.colStartIndex && this.colEndIndex) {
columns_1 = this.colStartIndex.name.replace(/#/g, "'#"); columns_1 = this.colStartIndex.name.replace(/([#[\]])/g, "'$1");
columns_2 = this.colEndIndex.name.replace(/#/g, "'#"); columns_2 = this.colEndIndex.name.replace(/([#[\]])/g, "'$1");
tblStr += "[[" + columns_1 + "]:[" + columns_2 + "]]"; tblStr += "[[" + columns_1 + "]:[" + columns_2 + "]]";
} else if (null != this.reservedColumnIndex) { } else if (null != this.reservedColumnIndex) {
tblStr += "[" + this._buildLocalTableString(this.reservedColumnIndex, isLocal) + "]"; tblStr += "[" + this._buildLocalTableString(this.reservedColumnIndex, isLocal) + "]";
...@@ -1725,10 +1725,10 @@ parserHelp.setDigitSeparator(AscCommon.g_oDefaultCultureInfo.NumberDecimalSepara ...@@ -1725,10 +1725,10 @@ parserHelp.setDigitSeparator(AscCommon.g_oDefaultCultureInfo.NumberDecimalSepara
tblStr += FormulaSeparators.functionArgumentSeparatorDef; tblStr += FormulaSeparators.functionArgumentSeparatorDef;
} }
} }
var hdtcstart = this.hdtcstartIndex.name.replace(/#/g, "'#"); var hdtcstart = this.hdtcstartIndex.name.replace(/([#[\]])/g, "'$1");
tblStr += "[" + hdtcstart + "]"; tblStr += "[" + hdtcstart + "]";
if (this.hdtcendIndex) { if (this.hdtcendIndex) {
var hdtcend = this.hdtcendIndex.name.replace(/#/g, "'#"); var hdtcend = this.hdtcendIndex.name.replace(/([#[\]])/g, "'$1");
tblStr += ":[" + hdtcend + "]"; tblStr += ":[" + hdtcend + "]";
} }
} }
...@@ -1739,15 +1739,15 @@ parserHelp.setDigitSeparator(AscCommon.g_oDefaultCultureInfo.NumberDecimalSepara ...@@ -1739,15 +1739,15 @@ parserHelp.setDigitSeparator(AscCommon.g_oDefaultCultureInfo.NumberDecimalSepara
return tblStr; return tblStr;
}; };
cStrucTable.prototype._parseVal = function (val) { cStrucTable.prototype._parseVal = function (val) {
var bRes = true; var bRes = true, startCol, endCol;
this.tableName = val['tableName']; this.tableName = val['tableName'];
if (val['oneColumn']) { if (val['oneColumn']) {
var startCol = val['oneColumn'].replace(/'#/g, "#"); startCol = val['oneColumn'].replace(/'([#[\]])/g, '$1');
this.oneColumnIndex = this.wb.getTableIndexColumnByName(this.tableName, startCol); this.oneColumnIndex = this.wb.getTableIndexColumnByName(this.tableName, startCol);
bRes = !!this.oneColumnIndex; bRes = !!this.oneColumnIndex;
} else if (val['columnRange']) { } else if (val['columnRange']) {
var startCol = val['colStart'].replace(/'#/g, "#"); startCol = val['colStart'].replace(/'([#[\]])/g, '$1');
var endCol = val['colEnd'].replace(/'#/g, "#"); endCol = val['colEnd'].replace(/'([#[\]])/g, '$1');
if (!endCol) { if (!endCol) {
endCol = startCol; endCol = startCol;
} }
...@@ -1765,7 +1765,7 @@ parserHelp.setDigitSeparator(AscCommon.g_oDefaultCultureInfo.NumberDecimalSepara ...@@ -1765,7 +1765,7 @@ parserHelp.setDigitSeparator(AscCommon.g_oDefaultCultureInfo.NumberDecimalSepara
this.hdtIndexes = []; this.hdtIndexes = [];
var hdtcstart = val['hdtcstart']; var hdtcstart = val['hdtcstart'];
var hdtcend = val['hdtcend']; var hdtcend = val['hdtcend'];
var re = /\[(.*?)\]/ig, m, data, range; var re = /\[(.*?)\]/ig, m;
while (null !== (m = re.exec(val['hdt']))) { while (null !== (m = re.exec(val['hdt']))) {
var param = parserHelp.getColumnTypeByName(m[1]); var param = parserHelp.getColumnTypeByName(m[1]);
if (AscCommon.FormulaTablePartInfo.thisRow == param || if (AscCommon.FormulaTablePartInfo.thisRow == param ||
...@@ -1776,11 +1776,11 @@ parserHelp.setDigitSeparator(AscCommon.g_oDefaultCultureInfo.NumberDecimalSepara ...@@ -1776,11 +1776,11 @@ parserHelp.setDigitSeparator(AscCommon.g_oDefaultCultureInfo.NumberDecimalSepara
} }
if (hdtcstart) { if (hdtcstart) {
var startCol = hdtcstart.replace(/'#/g, "#"); startCol = hdtcstart.replace(/'([#[\]])/g, '$1');
this.hdtcstartIndex = this.wb.getTableIndexColumnByName(this.tableName, startCol); this.hdtcstartIndex = this.wb.getTableIndexColumnByName(this.tableName, startCol);
bRes = !!this.hdtcstartIndex; bRes = !!this.hdtcstartIndex;
if (bRes && hdtcend) { if (bRes && hdtcend) {
var endCol = hdtcend.replace(/'#/g, "#"); endCol = hdtcend.replace(/'([#[\]])/g, '$1');
this.hdtcendIndex = this.wb.getTableIndexColumnByName(this.tableName, endCol); this.hdtcendIndex = this.wb.getTableIndexColumnByName(this.tableName, endCol);
bRes = !!this.hdtcendIndex; bRes = !!this.hdtcendIndex;
} }
......
...@@ -728,12 +728,12 @@ function build_rx_table_cur(){ ...@@ -728,12 +728,12 @@ function build_rx_table_cur(){
loc_this_row = cStrucTableLocalColumns['tr'], loc_this_row = cStrucTableLocalColumns['tr'],
structured_tables_headata = new XRegExp('(?:\\[\\#'+loc_headers+'\\]\\'+FormulaSeparators.functionArgumentSeparator+'\\[\\#'+loc_data+'\\])'), structured_tables_headata = new XRegExp('(?:\\[\\#'+loc_headers+'\\]\\'+FormulaSeparators.functionArgumentSeparator+'\\[\\#'+loc_data+'\\])'),
structured_tables_datals = new XRegExp('(?:\\[\\#'+loc_data+'\\]\\'+FormulaSeparators.functionArgumentSeparator+'\\[\\#'+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|\\u0028|\\u0029|\\u002B)+'), structured_tables_userColumn = new XRegExp('(?:\'\\[|\'\\]|[^[\\]])+'),
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+')|@');
return XRegExp.build( '^(?<tableName>{{tableName}})\\[(?<columnName>{{columnName}})?\\]', { return XRegExp.build( '^(?<tableName>{{tableName}})\\[(?<columnName>{{columnName}})?\\]', {
"tableName" : new XRegExp( "^(:?[" + str_namedRanges + "][" + str_namedRanges + "\\d.]*)" ), "tableName" : new XRegExp( "^(:?[" + str_namedRanges + "][" + str_namedRanges + "\\d.]*)" ),
"columnName": XRegExp.build( '(?<reservedColumn>{{reservedColumn}})|(?<oneColumn>{{userColumn}})|(?<columnRange>{{userColumnRange}})|(?<hdtcc>{{hdtcc}})', { "columnName": XRegExp.build( '(?<oneColumn>{{userColumn}})|(?<columnRange>{{userColumnRange}})|(?<hdtcc>{{hdtcc}})', {
"userColumn" : structured_tables_userColumn, "userColumn" : structured_tables_userColumn,
"reservedColumn" : structured_tables_reservedColumn, "reservedColumn" : structured_tables_reservedColumn,
"userColumnRange": XRegExp.build( '\\[(?<colStart>{{uc}})\\]\\:\\[(?<colEnd>{{uc}})\\]', { "userColumnRange": XRegExp.build( '\\[(?<colStart>{{uc}})\\]\\:\\[(?<colEnd>{{uc}})\\]', {
......
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