The following is an example of a personal Freemarker Excel export template that is used to export data to an Excel file with a. flt as an extension
<?xml version= "1.0"? ><?mso-application progid= "Excel.Sheet"? ><workbook xmlns= "urn: Schemas-microsoft-com:office:spreadsheet "xmlns:o=" Urn:schemas-microsoft-com:office:office "xmlns:x=" urn: Schemas-microsoft-com:office:excel "xmlns:ss=" Urn:schemas-microsoft-com:office:spreadsheet "xmlns:html="/HTTP/ Www.w3.org/TR/REC-html40 "> <documentproperties xmlns=" Urn:schemas-microsoft-com:office:office "> < Author>wpy</author> <LastAuthor>wpy</LastAuthor> <created>2015-04-10t18:30:22z</ created> <Version>1.00</Version> </DocumentProperties> <officedocumentsettings xmlns= "urn: Schemas-microsoft-com:office:office "> <AllowPNG/> </OfficeDocumentSettings> <excelworkbook xmlns = "Urn:schemas-microsoft-com:office:excel" > <WindowHeight>10005</WindowHeight> <WindowWidth> 10005</windowwidth> <WindowTopX>120</WindowTopX> <WindowTopY>135</WindowTopY> < ProtecTstructure>false</protectstructure> <ProtectWindows>False</ProtectWindows> </ excelworkbook> <Styles> <style ss:id= "Default" ss:name= "Normal" > <alignment ss:horizontal= "Center" Ss:vertical= "Center"/> <Borders/> <font ss:fontname= "song Body" x:charset= "134" ss:size= "one" ss:color= "#000000" /> <Interior/> <NumberFormat/> <Protection/> </Style> <style ss:id= "header" > &L T Font ss:fontname= "Song Body" x:charset= "134" ss:size= "one" ss:color= "#FFFFFF" ss:bold= "1"/> <interior ss:color= "#000000 "ss:pattern=" Solid "/> </Style> <style ss:id=" Content "> <Borders> <border ss:position=" Bott Om "ss:linestyle=" dot "ss:weight=" 1 "/> <border ss:position=" left "ss:linestyle=" dot "ss:weight=" 1 "/> <Bo Rder ss:position= "right" ss:linestyle= "dot" ss:weight= "1"/> <border ss:position= "Top" ss:linestyle= "dot" ss: weight= "1"/> </Borders> <interior SS:color= "#EEECE1" ss:pattern= "Solid"/> </Style> </Styles> < #if (serverspayexpendlist?size==0) > <worksheet ss:name= "${reportname!}" > <Table> <column ss:autofitwidth= "0" ss:width= "/> <column ss:autofitwidth=" 0 "ss:width=" 200 "/& Gt <column ss:autofitwidth= "0" ss:width= "$"/> <column ss:autofitwidth= "0" ss:width= "/>": Autofitwidth= "0" ss:width= "/><row" ss:autofitheight= "0" ><cell ss:styleid= "header" ><data SS: Type= "string" > Numbering </Data></Cell> <cell ss:styleid= "header" ><data ss:type= "string" > Server name </Data></Cell> <cell ss:styleid= "header" ><data ss:type= "String" > Top-up ingot collection </data></ cell> <cell ss:styleid= "header" ><data ss:type= "String" > Consumer ingot Summary </Data></Cell> <cell SS : styleid= "header" ><data ss:type= "String" > remaining ingot summary </Data></Cell></Row> </Table> </worksheet&gT </#if > < #list serverspayexpendlist as Serverspayexpend> < #if (serverspayexpend_index%50000==0) > <worksheet ss:name= "${reportname!} ${serverspayexpend_index/50000+1} "> <Table> <column ss:autofitwidth=" 0 "ss:width="/> <col Umn ss:autofitwidth= "0" ss:width= "/> <column ss:autofitwidth=" 0 "ss:width=" "/> <column ss:Aut Ofitwidth= "0" ss:width= "/>" <column ss:autofitwidth= "0" ss:width= "0"/><row ss:autofitheight= ><cell ss:styleid= "header" ><data ss:type= "String" > Numbering </Data></Cell> <cell ss:styleid= "Header" ><data ss:type= "String" > Server name </Data></Cell> <cell ss:styleid= "header" ><data Ss:type= "string" > Top-up Silver ingot summary </Data></Cell> <cell ss:styleid= "header" ><data ss:type= "string" > Consumer ingot Summary </Data></Cell> <cell ss:styleid= "header" ><data ss:type= "String" > remaining ingot Summary </data ></Cell></Row> </#if > <row ss:autofitheight= "0" > <cell < #if (serverspayexpend_index%2==0) >ss:styl eid= "Content" </#if >><data ss:type= "String" >${serversPayExpend_index+1}</Data></Cell> <cell < #if (serverspayexpend_index%2==0) >ss:styleid= "content" </#if >><data ss:type= "String" >${serverspayexpend.servername!} </data></cell><cell < #if (serverspayexpend_index%2==0) >ss:styleid= "content" </#if >> <data ss:type= "String" >${serverspayexpend.recharge!} </data></cell><cell < #if (serverspayexpend_index%2==0) >ss:styleid= "content" </#if >> <data ss:type= "String" >${serverspayexpend.expend!} </data></cell><cell < #if (serverspayexpend_index%2==0) >ss:styleid= "content" </#if >> <data ss:type= "String" >${serverspayexpend.remain!} </Data></Cell> </Row> < #if ((serverspayexpend_index+1)%50000==0) > </Table> </worksheet> </#if > </#list > < #if (serverspayexpendlist?size%50000!=0) > </Table> </ worksheet> </#if ></Workbook>
Refer to Human code for details on how to invoke Java code
Freemarker Example Explanation