Overview
To make use of ExcelUtils:- Create your templates in excel sheet.
- Prepare your context data in DynaBean or Map.
- Call ExcelUtils.export() method to parse the template and output stream.
Tags of ExcelUtils:
- ${model.name} means getting property of the name from the model object.
- ${!model.name} means that last cell and this cell merge if model.name value equals last cell value.
- #foreach model in ${list}£¬means that iterate list£¬modelId is implied index of the list.
- #each ${model} ${width1},${width2} on ${keys}£¬model can be a Map,JavaBean,Collection or Array object, #each key
will show all property of the model.${width?} means merge ${width?} cells. If only one
width, all property use the same width. If more than one, use the witdh in order, not set will use "1".${keys} can be Map,Array,List which contain field's name you want to display, it's not required. - ${list[0].name} means get the first object from list, then read the property of name.
- ${map(key)} get the value from the map by the key name.
- ${list[${index}].name} [] can be a variable.
- ${map(${key})} () can be a vriable.
- #sum qty on ${list} where name like/=str sum qty on ${list} collection by where condition.
- In net.sf.excelutils.tags Package, you can implement ITag to exentd Tag key. eg, FooTag will parse #foo.
- ExcelResult for webwork.
- ${model${index}} support.
- #call service.method("str", ${name}) call a method
- #formual SUM(C${currentRowNo}:F${currentRowNo}) means output excel formula SUM(C?:F?) ? means currentRowNo.
- #page tag to split page.
- #if tag support beanshell scripts.
¡¡