目前功能: 创建workbook,指定文件名称 创建sheet,指定sheet名称,如果不设定, 使用poi的默认生成方式生成sheet中各个行列单元格内容, 参数为一个二维数组或是 List<List<String>>
的方式
class TestSupport { static void main(args) { def workbook = new WorkBookBuilder() def lst = [] lst << [] lst << ["人员信息", "", "", ""] lst << ["姓名", "年龄", "性别", "城市"] lst << ["张三", "30", "男", "北京"] lst << ["李四", "31", "女", "上海"] lst << ["王五", "32", "男", "广州"] lst << ["赵六", "33", "女", "深圳"] workbook (filename: "/Users/wangguangyu/temp/sample.xlsx") { cellStyle ( name: "first style", align: StyleWrapper.center, verticalAlign: StyleWrapper.vertical_top, //// align -> [center|left|right] //// verticalAlign -> [vertical_top|vertical_bottom|vertical_center] border: [bottom: StyleWrapper.border_thin, top: StyleWrapper.border_thin, left: StyleWrapper.border_thin, right: StyleWrapper.border_thin ], //// each of values -> [double|thin|medium|dash|hair|thick] borderColor: [bottom: StyleWrapper.black, top: StyleWrapper.black, left: StyleWrapper.black, right: StyleWrapper.black ] //// each of values -> color set ) font ( ) sheet (name: "人员信息", printSetup: [ pageStart: 0, paperSize: StyleWrapper.a4_plus_papersize ], printArea: [ startColumn: 0, endColumn: 1, startRow: 0, endRow: 1 ]) { mergedRegion (range: [1, 1, 2, 5]) rows(data: lst, withStyle: "first style", startIndex: 2) // forStyle (pos: [0, 10], style: "first style") } } workbook.save() } }