teamcfadvance / cfspreadsheet-railo

My Railo Extension provider including CFPOI (<cfspreadsheet>)
24 stars 16 forks source link

SpreadsheetAddColumn error when adding data #2

Closed Leigh- closed 13 years ago

Leigh- commented 13 years ago

An error occurs when using SpreadsheetAddColumn to populate a column with data.

Code: <cfset sheet = SpreadsheetNew()> <cfset SpreadsheetAddColumn(sheet, "newcol1,newcol2,newcol3" )>

Error: Railo 3.2.1.000 Error (expression) Message: can't call method [GETCELL] on object, object is null Stacktrace: C:\xxxxx\WEB-INF\railo\components\org\cfpoi\spreadsheet\Spreadsheet.cfc: line 953 951: <cfif rowNum GT getActiveSheet().getLastRowNum() OR getActiveSheet().getRow(rowNum) EQ ""> 952: ---> 953: <cfif rowNum GT getActiveSheet().getLastRowNum() OR isNull(getActiveSheet().getRow(rowNum).getCell(1))> 954: 955: <cfset row = createRow(rowNum) />

Suggested Fix: Remove the last call to getCell() on line 953 because it causes an NPE when the row does not exist. ie Change to:

<cfif rowNum GT getActiveSheet().getLastRowNum() OR isNull(getActiveSheet().getRow(rowNum))>

andyj commented 13 years ago

Cheers Leigh. Im currently away with work till the weekend but will check out your fork and try and get it in there asap.

Leigh- commented 13 years ago

Sounds good! I have a few other patches to commit. Probably by tomorrow. (I will record the issues here so you have a description/repro case.)