Commit 49d646ef authored by Dmitry.Shahtanov's avatar Dmitry.Shahtanov Committed by Alexander.Trofimov

fix: Bug 30395 - TypeError: e.getMatrix при открытии XLSX файла...

fix: Bug 30395 - TypeError: e.getMatrix при открытии XLSX файла (http://bugzserver/show_bug.cgi?id=30395)

git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@64847 954022d7-b5bf-4e40-9824-e11837661b57
parent 4b44b215
...@@ -3851,7 +3851,8 @@ function cSUMIF() { ...@@ -3851,7 +3851,8 @@ function cSUMIF() {
noneFormat:-2 noneFormat:-2
}; };
this.numFormat = this.formatType.def; this.numFormat = this.formatType.def;
this.operatorRE = new RegExp( "^ *[<=> ]+ *" );
this.spaceRE = /\s/g;
} }
cSUMIF.prototype = Object.create( cBaseFunction.prototype ) cSUMIF.prototype = Object.create( cBaseFunction.prototype )
...@@ -3879,11 +3880,10 @@ cSUMIF.prototype.Calculate = function ( arg ) { ...@@ -3879,11 +3880,10 @@ cSUMIF.prototype.Calculate = function ( arg ) {
} }
arg1 = arg1.toString(); arg1 = arg1.toString();
var operators = new RegExp( "^ *[<=> ]+ *" ), match = arg1.match( operators ), var match = arg1.match( this.operatorRE ), search, oper, val;
search, oper, val;
if ( match ) { if ( match ) {
search = arg1.substr( match[0].length ); search = arg1.substr( match[0].length );
oper = match[0].replace( /\s/g, "" ); oper = match[0].replace( this.spaceRE, "" );
} }
else { else {
search = arg1; search = arg1;
...@@ -3894,7 +3894,7 @@ cSUMIF.prototype.Calculate = function ( arg ) { ...@@ -3894,7 +3894,7 @@ cSUMIF.prototype.Calculate = function ( arg ) {
for ( var i = 0; i < arg0Matrix.length; i++ ) { for ( var i = 0; i < arg0Matrix.length; i++ ) {
for ( var j = 0; j < arg0Matrix[i].length; j++ ) { for ( var j = 0; j < arg0Matrix[i].length; j++ ) {
valMatrix0 = arg0Matrix[i][j]; valMatrix0 = arg0Matrix[i][j];
valMatrix2 = arg2Matrix[i][j] ? arg2Matrix[i][j] : new cEmpty(); valMatrix2 = arg2Matrix[i]? (arg2Matrix[i][j] ? arg2Matrix[i][j] : new cEmpty()) : new cEmpty();
if ( matching( valMatrix0, valueForSearching, oper ) ) { if ( matching( valMatrix0, valueForSearching, oper ) ) {
if ( valMatrix2 instanceof cNumber ) { if ( valMatrix2 instanceof cNumber ) {
_sum += valMatrix2.getValue(); _sum += valMatrix2.getValue();
......
...@@ -1140,6 +1140,9 @@ cRef.prototype.getWS = function () { ...@@ -1140,6 +1140,9 @@ cRef.prototype.getWS = function () {
cRef.prototype.isValid = function () { cRef.prototype.isValid = function () {
return this._valid; return this._valid;
}; };
cRef.prototype.getMatrix = function () {
return [[this.getValue()]];
}
/** @constructor */ /** @constructor */
function cRef3D( val, _wsFrom, wb ) {/*Ref means Sheat1!A1 for example*/ function cRef3D( val, _wsFrom, wb ) {/*Ref means Sheat1!A1 for example*/
...@@ -1273,7 +1276,7 @@ cName.prototype.reInit = function () { ...@@ -1273,7 +1276,7 @@ cName.prototype.reInit = function () {
cName.prototype.toRef = function () { cName.prototype.toRef = function () {
if ( !this.defName || !this.defName.Ref ) { if ( !this.defName || !this.defName.Ref ) {
return new cError( "#NAME?" ); return new cError( cErrorType.wrong_name );
} }
var _3DRefTmp, ref = this.defName.Ref, _wsFrom, _wsTo; var _3DRefTmp, ref = this.defName.Ref, _wsFrom, _wsTo;
...@@ -1293,7 +1296,7 @@ cName.prototype.toRef = function () { ...@@ -1293,7 +1296,7 @@ cName.prototype.toRef = function () {
return new cRef3D( parserHelp.operand_str, _wsFrom, this.wb ); return new cRef3D( parserHelp.operand_str, _wsFrom, this.wb );
} }
} }
return new cError( "#NAME?" ); return new cError( cErrorType.wrong_name );
}; };
cName.prototype.toString = function () { cName.prototype.toString = function () {
if( this.defName ){ if( this.defName ){
......
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