Version: 1.5 rc1 (using KDE 3.5.2, Gentoo) Compiler: gcc version 3.4.5 (Gentoo 3.4.5, ssp-3.4.5-1.0, pie-8.7.9) OS: Linux (i686) release 2.6.15-gentoo-r1n I just found that references to another sheet (same file) doesn't work if name of referenced sheet consists of numbers (works ok if sheet-name begins with character). see attached example for clarification (cell a1 from sheets #2 and #3, in #3 is ok, in #2 not ok).
Created an attachment (id=15371) [details] see bug description
I just upgraded to kspread 1.5 and can confirm the problem still persists.
On kspread 1.6beta1 the bug persists, i had my sheet named 2005_2006 and the other one (in which a cell have a reference to 2005_2006!M4) called 2006_2007, I renamed first sheet to "Feuille1" and by updating the reference, my cell displayed the correct number instead of "####" Nicolas
SVN commit 584601 by nikolaus: Formula Allow sheet names beginning with a number and fix an issue with quoted sheet names. BUGS: 124549 M +16 -3 branches/koffice/1.6/koffice/kspread/formula.cc M +5 -0 branches/koffice/1.6/koffice/kspread/tests/formula_tester.cc M +16 -3 trunk/koffice/kspread/Formula.cpp M +5 -0 trunk/koffice/kspread/tests/formula_tester.cc --- branches/koffice/1.6/koffice/kspread/formula.cc #584600:584601 @@ -533,7 +533,6 @@ { i++; state = InSheetOrAreaName; - tokenText.append( QChar( '\'' ) ); } // decimal dot ? @@ -688,8 +687,8 @@ else { - // the aposthrophe itself - tokenText.append( ex[i++] ); + // eat the aposthrophe itself + ++i; // must be followed by '!', otherwise we have a string in '' if( ex[i] == '!' ) { @@ -737,6 +736,20 @@ state = InExpIndicator; } + // reference sheet delimiter? + else if( ch == '!' ) + { + tokenText.append( ex[i++] ); + state = InCell; + } + + // identifier? + else if( isIdentifier( ch ) ) + { + // has to be a sheet or area name then + state = InIdentifier; + } + // we're done with integer number else { --- branches/koffice/1.6/koffice/kspread/tests/formula_tester.cc #584600:584601 @@ -129,7 +129,12 @@ // cell/range/identifier CHECK_PARSE( "A1", "c" ); CHECK_PARSE( "Sheet1!A1", "c" ); + CHECK_PARSE( "'Sheet1'!A1", "c" ); CHECK_PARSE( "'Sheet One'!A1", "c" ); + CHECK_PARSE( "2006!A1", "c" ); + CHECK_PARSE( "2006bak!A1", "c" ); + CHECK_PARSE( "2006bak2!A1", "c" ); + CHECK_PARSE( "'2006bak2'!A1", "c" ); CHECK_PARSE( "A1:B100", "r" ); CHECK_PARSE( "Sheet1!A1:B100", "r" ); CHECK_PARSE( "'Sheet One'!A1:B100", "r" ); --- trunk/koffice/kspread/Formula.cpp #584600:584601 @@ -533,7 +533,6 @@ { i++; state = InSheetOrAreaName; - tokenText.append( QChar( '\'' ) ); } // decimal dot ? @@ -687,8 +686,8 @@ else { - // the aposthrophe itself - tokenText.append( ex[i++] ); + // eat the aposthrophe itself + ++i; // must be followed by '!', otherwise we have a string in '' if( ex[i] == '!' ) { @@ -736,6 +735,20 @@ state = InExpIndicator; } + // reference sheet delimiter? + else if( ch == '!' ) + { + tokenText.append( ex[i++] ); + state = InCell; + } + + // identifier? + else if( isIdentifier( ch ) ) + { + // has to be a sheet or area name then + state = InIdentifier; + } + // we're done with integer number else { --- trunk/koffice/kspread/tests/formula_tester.cc #584600:584601 @@ -129,7 +129,12 @@ // cell/range/identifier CHECK_PARSE( "A1", "c" ); CHECK_PARSE( "Sheet1!A1", "c" ); + CHECK_PARSE( "'Sheet1'!A1", "c" ); CHECK_PARSE( "'Sheet One'!A1", "c" ); + CHECK_PARSE( "2006!A1", "c" ); + CHECK_PARSE( "2006bak!A1", "c" ); + CHECK_PARSE( "2006bak2!A1", "c" ); + CHECK_PARSE( "'2006bak2'!A1", "c" ); CHECK_PARSE( "A1:B100", "r" ); CHECK_PARSE( "Sheet1!A1:B100", "r" ); CHECK_PARSE( "'Sheet One'!A1:B100", "r" );
You need to log in before you can comment on or make changes to this bug.