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