From 9b45f7829cae79d595705f8df18350e26260b9f4 Mon Sep 17 00:00:00 2001 From: abdennour Date: Wed, 3 Dec 2014 13:07:04 +0300 Subject: [PATCH 1/2] Add constructor Useful if we deal with Tmp file . i.e: `new XlsxExporter(File.createTempFile("temp",".tmp"))` --- src/groovy/pl/touk/excel/export/XlsxExporter.groovy | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/groovy/pl/touk/excel/export/XlsxExporter.groovy b/src/groovy/pl/touk/excel/export/XlsxExporter.groovy index b11baf3..8d211b0 100644 --- a/src/groovy/pl/touk/excel/export/XlsxExporter.groovy +++ b/src/groovy/pl/touk/excel/export/XlsxExporter.groovy @@ -38,7 +38,9 @@ class XlsxExporter implements SheetManipulator { this.workbook = createOrLoadWorkbook(destinationFileNameWithPath) setUp(workbook) } - + XlsxExporter(File f) { + XlsxExporter(f.path) + } private XSSFWorkbook createOrLoadWorkbook(String fileNameWithPath) { if(new File(fileNameWithPath).exists()) { zipPackage = OPCPackage.open(fileNameWithPath); @@ -139,4 +141,4 @@ class XlsxExporter implements SheetManipulator { } } } -} \ No newline at end of file +} From 550bccdf1bd4a625e733a188f9b7bd254fc1ef01 Mon Sep 17 00:00:00 2001 From: abdennour Date: Wed, 3 Dec 2014 13:09:16 +0300 Subject: [PATCH 2/2] Constructor with File instance Enhancement --- src/groovy/pl/touk/excel/export/XlsxExporter.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/groovy/pl/touk/excel/export/XlsxExporter.groovy b/src/groovy/pl/touk/excel/export/XlsxExporter.groovy index 8d211b0..3290c79 100644 --- a/src/groovy/pl/touk/excel/export/XlsxExporter.groovy +++ b/src/groovy/pl/touk/excel/export/XlsxExporter.groovy @@ -39,7 +39,7 @@ class XlsxExporter implements SheetManipulator { setUp(workbook) } XlsxExporter(File f) { - XlsxExporter(f.path) + this(f.path) } private XSSFWorkbook createOrLoadWorkbook(String fileNameWithPath) { if(new File(fileNameWithPath).exists()) {