ColdFusion 9.0 Resources |
SpreadsheetAddRowSee alsoSpreadsheetAddColumn, SpreadsheetAddImage, SpreadsheetAddRows, SpreadsheetDeleteRow, SpreadsheetDeleteRows, SpreadsheetFormatRow, SpreadsheetFormatRows, SpreadsheetShiftRows Parameters
ExampleThe following example adds a row of data as row 10. The data starts at column 2, and any existing row numbers 10 and higher increment by one. <!--- Get the spreadsheet data as a query. ---> <cfquery name="courses" datasource="cfdocexamples" cachedwithin="#CreateTimeSpan(0, 6, 0, 0)#"> SELECT CORNUMBER,DEPT_ID,COURSE_ID,CORNAME FROM COURSELIST </cfquery> <cfscript> ///We need an absolute path, so get the current directory path. theFile=GetDirectoryFromPath(GetCurrentTemplatePath()) & courses.xls"; //Create a new Spreadsheet object and add the query data. theSheet = SpreadsheetNew("CourseData"); SpreadsheetAddRows(theSheet,courses); //Insert a new eighth row to the sheet, with data starting in column 1. SpreadsheetAddRow(theSheet,"150,ENGL,95,Poetry 1",8,1); </cfscript> <!--- Write the spreadsheet to a file, replacing any existing file. ---> <cfspreadsheet action="write" filename="#theFile#" name="theSheet" sheet=1 sheetname="courses" overwrite=true> |