<!-- An example showing the different types available to each cell. The type "string" is always the default. --> <cf_xls_workbook SaveAsName="generate2.xls"> <!-- the columnwidths are set in roughly units of a character, so 25 holds around 25 characters in the default font. --> <cf_xls_sheet Name="Sheet1" columnwidths="25,25,25,25,25,25"> <cf_xls_row> <cf_xls_cell>Cell 1</cf_xls_cell> <cf_xls_cell>Cell 2 </cf_xls_cell> </cf_xls_row> <cf_xls_row> <cf_xls_cell>A Number</cf_xls_cell> <!-- Since 56 in a number we set the type to be number so excel handles it correctly. NOTICE we set a referenceID for this cell. The referenceID is myNum. By setting this we can refer to this cell of the sheet with out knowing the Excel naming convention. --> <cf_xls_cell id="myNum" type="number">56</cf_xls_cell> </cf_xls_row> <cf_xls_row> <cf_xls_cell>A Date</cf_xls_cell> <!-- To display a date you must specify the type as "date" and specify the dataFormat part of the style as a date format. A couple of these are "d-mmm-yy", "m/d/yy", "d-mmm", .... set documentation for more. \ --> <cf_xls_cell type="date" style="dataFormat:m/d/yy">April 12, 1952 12:12</cf_xls_cell> </cf_xls_row> <cf_xls_row> <cf_xls_cell>A Formula</cf_xls_cell> <!-- NOTICE there is no equals (=) sign for a formula.--> <cf_xls_cell type="formula">2*2</cf_xls_cell> </cf_xls_row> <cf_xls_row> <cf_xls_cell>A Formula w/ References</cf_xls_cell> <!-- Another formula that references another cell of the worksheet. Since we don't know the excel row column naming convention for the cell that holds the 56, we reference it with the id we set earlier. To put a reference to another cell use CFXL:referenceID; NOTICE the CFXLS must be capitalized and the colon (:) and semi-colon (;) must surround the referenceID. In this case the referenceID is myNum. However if you really think about it, the number 56 is in the second row, and the second column, so the formula 2*B2 would give you the same result and you wouldn't have to use the referenceIDs. However this is a bad idea. If you end up later adding a row above your cell that has the 56 in it, the B2 reference would not work, where as the referenceID method would continue to work. In conclusion it is best to use the referenceID when possible. --> <cf_xls_cell type="formula">2*CFXLS:myNum;</cf_xls_cell> </cf_xls_row> </cf_xls_sheet> </cf_xls_workbook>