Commit 2cc789f3 authored by Dmitry.Shahtanov's avatar Dmitry.Shahtanov Committed by Alexander.Trofimov

дополнительно для 56802

git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@56824 954022d7-b5bf-4e40-9824-e11837661b57
parent 9d9a0bc0
......@@ -578,8 +578,17 @@ parserHelper.prototype = {
// Возвращает ссылку на диапазон с листом (название листа экранируется)
get3DRef: function (sheet, range) {
var result = rx_test_ws_name.test(sheet) ? sheet : "'" + sheet.replace(/'/g, "''") + "'";
return result + '!' + range;
sheet = sheet.split(":");
var wsFrom = sheet[0],
wsTo = sheet[1] === undefined ? wsFrom : sheet[1];
if ( rx_test_ws_name.test( wsFrom ) && rx_test_ws_name.test( wsTo ) ) {
return (wsFrom !== wsTo ? wsFrom + ":" + wsTo : wsFrom) + "!" + range;
}
else{
wsFrom = wsFrom.replace( /'/g, "''" );
wsTo = wsTo.replace( /'/g, "''" );
return "'" + (wsFrom !== wsTo ? wsFrom + ":" + wsTo : wsFrom) + "'!" + range;
}
},
// Возвращает экранируемое название листа
......
......@@ -370,7 +370,7 @@
sData = data + "";
if ( Asc.c_oSerFormat.Signature === sData.substring( 0, Asc.c_oSerFormat.Signature.length ) ) {
var sUrlPath = "offlinedocs/";
wb = new Workbook( sUrlPath, new Asc.asc_CHandlersList(), {} );
wb = new Workbook( sUrlPath, new Asc.asc_CHandlersList(), {wb:{getWorksheet:function(){}}} );
History = new CHistory(wb);
......@@ -783,21 +783,15 @@
ok( oParser.parse() );
// strictEqual( oParser.parse(), true)
strictEqual( oParser.changeSheet( "Лист2", "Лист3" ).assemble(), "Лист3!A2" );
} )
test( "Test: rename sheet #2", function () {
oParser = new parserFormula( "Лист2:Лист3!A2", "A1", ws );
ok( oParser.parse() );
strictEqual( oParser.changeSheet( "Лист2", "Лист1" ).assemble(), "Лист1:Лист3!A2" );
} )
test( "Test: rename sheet #3", function () {
oParser = new parserFormula( "Лист2!A2:A5", "A1", ws );
ok( oParser.parse() );
strictEqual( oParser.changeSheet( "Лист2", "Лист3" ).assemble(), "Лист3!A2:A5" );
} )
test( "Test: rename sheet #4", function () {
ws = wb.getWorksheet( 0 );
ws.getRange2( "S95" ).setValue( "2" );
ws = wb.getWorksheet( 1 );
......@@ -3569,23 +3563,24 @@
}
oParser = new parserFormula( "IRR({-70000,12000,15000,18000,21000})", "A2", ws );
ok( oParser.parse() );
strictEqual( oParser.calculate().getValue(), irr( [-70000,12000,15000,18000,21000] ) );
strictEqual( oParser.calculate().getValue(), -0.021244848273410923 );
ws.getRange2( "A705" ).setValue( "43191" );
oParser = new parserFormula( "IRR({-70000,12000,15000,18000,21000,26000})", "A2", ws );
ok( oParser.parse() );
strictEqual( oParser.calculate().getValue(), irr([-70000,12000,15000,18000,21000,26000] ) );
strictEqual( oParser.calculate().getValue(), 0.08663094803653171 );
oParser = new parserFormula( "IRR({-70000,12000,15000},-0.1)", "A2", ws );
ok( oParser.parse() );
strictEqual( oParser.calculate().getValue(), irr([-70000,12000,15000],-0.1 ) );
strictEqual( oParser.calculate().getValue(), -0.44350694133450463 );
oParser = new parserFormula( "IRR({-70000},-0.1)", "A2", ws );
ok( oParser.parse() );
strictEqual( oParser.calculate().getValue(), irr([-70000],-0.1 ) );
strictEqual( oParser.calculate().getValue(), "#NUM!" );
} )
......@@ -4336,7 +4331,7 @@
res *= life+1-per;
res /= (life+1)*life;
return res;
return res < 0 ? "#NUM!" : res;
}
oParser = new parserFormula( "SYD(30000,7500,10,1)", "A2", ws );
......
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