diff --git a/easypoi-annotation/.classpath b/easypoi-annotation/.classpath
new file mode 100644
index 0000000..4d455a3
--- /dev/null
+++ b/easypoi-annotation/.classpath
@@ -0,0 +1,36 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/easypoi-annotation/.project b/easypoi-annotation/.project
new file mode 100644
index 0000000..665aeec
--- /dev/null
+++ b/easypoi-annotation/.project
@@ -0,0 +1,23 @@
+
+
+ easypoi-annotation
+
+
+
+
+
+ org.eclipse.jdt.core.javabuilder
+
+
+
+
+ org.eclipse.m2e.core.maven2Builder
+
+
+
+
+
+ org.eclipse.jdt.core.javanature
+ org.eclipse.m2e.core.maven2Nature
+
+
diff --git a/easypoi-annotation/.settings/org.eclipse.core.resources.prefs b/easypoi-annotation/.settings/org.eclipse.core.resources.prefs
new file mode 100644
index 0000000..2e67b95
--- /dev/null
+++ b/easypoi-annotation/.settings/org.eclipse.core.resources.prefs
@@ -0,0 +1,3 @@
+eclipse.preferences.version=1
+encoding//src/main/java=UTF-8
+encoding//src/test/java=UTF-8
diff --git a/easypoi-annotation/.settings/org.eclipse.jdt.core.prefs b/easypoi-annotation/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 0000000..14f521d
--- /dev/null
+++ b/easypoi-annotation/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,5 @@
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
+org.eclipse.jdt.core.compiler.compliance=1.6
+org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
+org.eclipse.jdt.core.compiler.source=1.6
diff --git a/easypoi-annotation/.settings/org.eclipse.m2e.core.prefs b/easypoi-annotation/.settings/org.eclipse.m2e.core.prefs
new file mode 100644
index 0000000..14b697b
--- /dev/null
+++ b/easypoi-annotation/.settings/org.eclipse.m2e.core.prefs
@@ -0,0 +1,4 @@
+activeProfiles=
+eclipse.preferences.version=1
+resolveWorkspaceProjects=true
+version=1
diff --git a/easypoi-annotation/pom.xml b/easypoi-annotation/pom.xml
new file mode 100644
index 0000000..204194d
--- /dev/null
+++ b/easypoi-annotation/pom.xml
@@ -0,0 +1,11 @@
+
+ 4.0.0
+
+ org.jeecgframework
+ easypoi
+ 2.0.8-SNAPSHOT
+
+ easypoi-annotation
+ 基础注解类,解耦合
+
\ No newline at end of file
diff --git a/easypoi-base/src/main/java/org/jeecgframework/poi/excel/annotation/Excel.java b/easypoi-annotation/src/main/java/org/jeecgframework/poi/excel/annotation/Excel.java
similarity index 100%
rename from easypoi-base/src/main/java/org/jeecgframework/poi/excel/annotation/Excel.java
rename to easypoi-annotation/src/main/java/org/jeecgframework/poi/excel/annotation/Excel.java
diff --git a/easypoi-base/src/main/java/org/jeecgframework/poi/excel/annotation/ExcelCollection.java b/easypoi-annotation/src/main/java/org/jeecgframework/poi/excel/annotation/ExcelCollection.java
similarity index 100%
rename from easypoi-base/src/main/java/org/jeecgframework/poi/excel/annotation/ExcelCollection.java
rename to easypoi-annotation/src/main/java/org/jeecgframework/poi/excel/annotation/ExcelCollection.java
diff --git a/easypoi-base/src/main/java/org/jeecgframework/poi/excel/annotation/ExcelEntity.java b/easypoi-annotation/src/main/java/org/jeecgframework/poi/excel/annotation/ExcelEntity.java
similarity index 100%
rename from easypoi-base/src/main/java/org/jeecgframework/poi/excel/annotation/ExcelEntity.java
rename to easypoi-annotation/src/main/java/org/jeecgframework/poi/excel/annotation/ExcelEntity.java
diff --git a/easypoi-base/src/main/java/org/jeecgframework/poi/excel/annotation/ExcelIgnore.java b/easypoi-annotation/src/main/java/org/jeecgframework/poi/excel/annotation/ExcelIgnore.java
similarity index 100%
rename from easypoi-base/src/main/java/org/jeecgframework/poi/excel/annotation/ExcelIgnore.java
rename to easypoi-annotation/src/main/java/org/jeecgframework/poi/excel/annotation/ExcelIgnore.java
diff --git a/easypoi-base/src/main/java/org/jeecgframework/poi/excel/annotation/ExcelTarget.java b/easypoi-annotation/src/main/java/org/jeecgframework/poi/excel/annotation/ExcelTarget.java
similarity index 100%
rename from easypoi-base/src/main/java/org/jeecgframework/poi/excel/annotation/ExcelTarget.java
rename to easypoi-annotation/src/main/java/org/jeecgframework/poi/excel/annotation/ExcelTarget.java
diff --git a/easypoi-base/src/main/java/org/jeecgframework/poi/excel/annotation/ExcelVerify.java b/easypoi-annotation/src/main/java/org/jeecgframework/poi/excel/annotation/ExcelVerify.java
similarity index 100%
rename from easypoi-base/src/main/java/org/jeecgframework/poi/excel/annotation/ExcelVerify.java
rename to easypoi-annotation/src/main/java/org/jeecgframework/poi/excel/annotation/ExcelVerify.java
diff --git a/easypoi-base/pom.xml b/easypoi-base/pom.xml
index f1bbbae..0aadc81 100644
--- a/easypoi-base/pom.xml
+++ b/easypoi-base/pom.xml
@@ -47,5 +47,10 @@
org.slf4j
slf4j-api
+
+
+ org.jeecgframework
+ easypoi-annotation
+
\ No newline at end of file
diff --git a/easypoi-web/src/main/java/org/jeecgframework/poi/excel/view/JeecgMapExcelView.java b/easypoi-web/src/main/java/org/jeecgframework/poi/excel/view/JeecgMapExcelView.java
index 5013b8f..dc60a7c 100644
--- a/easypoi-web/src/main/java/org/jeecgframework/poi/excel/view/JeecgMapExcelView.java
+++ b/easypoi-web/src/main/java/org/jeecgframework/poi/excel/view/JeecgMapExcelView.java
@@ -4,15 +4,16 @@ import java.util.Collection;
import java.util.List;
import java.util.Map;
+import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
+import org.apache.poi.ss.usermodel.Workbook;
+import org.jeecgframework.poi.excel.ExcelExportUtil;
import org.jeecgframework.poi.excel.entity.ExportParams;
import org.jeecgframework.poi.excel.entity.params.ExcelExportEntity;
import org.jeecgframework.poi.excel.entity.vo.MapExcelConstants;
-import org.jeecgframework.poi.excel.export.ExcelExportServer;
-import org.springframework.web.servlet.view.document.AbstractExcelView;
/**
* Map 对象接口
@@ -21,31 +22,37 @@ import org.springframework.web.servlet.view.document.AbstractExcelView;
* @date 2014年11月25日 下午3:26:32
*/
@SuppressWarnings("unchecked")
-public class JeecgMapExcelView extends AbstractExcelView {
+public class JeecgMapExcelView extends MiniAbstractExcelView {
+
+ public JeecgMapExcelView() {
+ super();
+ }
@Override
- protected void buildExcelDocument(Map model, HSSFWorkbook hssfWorkbook,
- HttpServletRequest httpServletRequest,
- HttpServletResponse httpServletResponse) throws Exception {
- String codedFileName = "临时文件.xls";
+ protected void renderMergedOutputModel(Map model, HttpServletRequest request,
+ HttpServletResponse response) throws Exception {
+ String codedFileName = "临时文件";
+ Workbook workbook = ExcelExportUtil.exportExcel(
+ (ExportParams) model.get(MapExcelConstants.PARAMS),
+ (List) model.get(MapExcelConstants.ENTITY_LIST),
+ (Collection extends Map, ?>>) model.get(MapExcelConstants.MAP_LIST));
if (model.containsKey(MapExcelConstants.FILE_NAME)) {
- codedFileName = (String) model.get(MapExcelConstants.FILE_NAME) + ".xls";
+ codedFileName = (String) model.get(MapExcelConstants.FILE_NAME);
}
- if (isIE(httpServletRequest)) {
+ if (workbook instanceof HSSFWorkbook) {
+ codedFileName += HSSF;
+ } else {
+ codedFileName += XSSF;
+ }
+ if (isIE(request)) {
codedFileName = java.net.URLEncoder.encode(codedFileName, "UTF8");
} else {
codedFileName = new String(codedFileName.getBytes("UTF-8"), "ISO-8859-1");
}
- httpServletResponse
- .setHeader("content-disposition", "attachment;filename=" + codedFileName);
- new ExcelExportServer().createSheetForMap(hssfWorkbook,
- (ExportParams) model.get(MapExcelConstants.PARAMS),
- (List) model.get(MapExcelConstants.ENTITY_LIST),
- (Collection extends Map, ?>>) model.get(MapExcelConstants.MAP_LIST));
+ response.setHeader("content-disposition", "attachment;filename=" + codedFileName);
+ ServletOutputStream out = response.getOutputStream();
+ workbook.write(out);
+ out.flush();
}
- public boolean isIE(HttpServletRequest request) {
- return (request.getHeader("USER-AGENT").toLowerCase().indexOf("msie") > 0 || request
- .getHeader("USER-AGENT").toLowerCase().indexOf("rv:11.0") > 0) ? true : false;
- }
}
diff --git a/easypoi-web/src/main/java/org/jeecgframework/poi/excel/view/JeecgSingleExcelView.java b/easypoi-web/src/main/java/org/jeecgframework/poi/excel/view/JeecgSingleExcelView.java
index bb241be..5f05f90 100644
--- a/easypoi-web/src/main/java/org/jeecgframework/poi/excel/view/JeecgSingleExcelView.java
+++ b/easypoi-web/src/main/java/org/jeecgframework/poi/excel/view/JeecgSingleExcelView.java
@@ -4,55 +4,70 @@ import java.util.Collection;
import java.util.List;
import java.util.Map;
+import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
+import org.apache.poi.ss.usermodel.Workbook;
+import org.jeecgframework.poi.excel.ExcelExportUtil;
import org.jeecgframework.poi.excel.entity.ExportParams;
import org.jeecgframework.poi.excel.entity.vo.NormalExcelConstants;
import org.jeecgframework.poi.excel.export.ExcelExportServer;
-import org.springframework.web.servlet.view.document.AbstractExcelView;
/**
* @Author JueYue on 14-3-8. Excel 生成解析器,减少用户操作
*/
@SuppressWarnings("unchecked")
-public class JeecgSingleExcelView extends AbstractExcelView {
+public class JeecgSingleExcelView extends MiniAbstractExcelView {
+
+ public JeecgSingleExcelView() {
+ super();
+ }
@Override
- protected void buildExcelDocument(Map model, HSSFWorkbook hssfWorkbook,
- HttpServletRequest httpServletRequest,
- HttpServletResponse httpServletResponse) throws Exception {
- String codedFileName = "临时文件.xls";
- if (model.containsKey(NormalExcelConstants.FILE_NAME)) {
- codedFileName = (String) model.get(NormalExcelConstants.FILE_NAME) + ".xls";
- }
- if (isIE(httpServletRequest)) {
- codedFileName = java.net.URLEncoder.encode(codedFileName, "UTF8");
- } else {
- codedFileName = new String(codedFileName.getBytes("UTF-8"), "ISO-8859-1");
- }
- httpServletResponse
- .setHeader("content-disposition", "attachment;filename=" + codedFileName);
+ protected void renderMergedOutputModel(Map model, HttpServletRequest request,
+ HttpServletResponse response) throws Exception {
+ String codedFileName = "临时文件";
+ Workbook workbook = null;
if (model.containsKey(NormalExcelConstants.MAP_LIST)) {
List