diff --git a/easypoi-web/src/main/java/org/jeecgframework/poi/excel/html/convert/ExcelConverHtmlUtil.java b/easypoi-web/src/main/java/org/jeecgframework/poi/excel/html/convert/ExcelConverHtmlUtil.java
new file mode 100644
index 0000000..ec6822a
--- /dev/null
+++ b/easypoi-web/src/main/java/org/jeecgframework/poi/excel/html/convert/ExcelConverHtmlUtil.java
@@ -0,0 +1,54 @@
+package org.jeecgframework.poi.excel.html.convert;
+
+import java.util.Iterator;
+
+import org.apache.poi.ss.usermodel.Cell;
+import org.apache.poi.ss.usermodel.Row;
+import org.apache.poi.ss.usermodel.Sheet;
+import org.apache.poi.ss.usermodel.Workbook;
+
+/**
+ * Excel 转换成为Html
+ * @author JueYue
+ * @date 2015年5月7日 下午10:06:51
+ */
+public final class ExcelConverHtmlUtil {
+
+ private static final String STARTHTML = "";
+ private static final String HTML_TR_S = "";
+ private static final String HTML_TR_E = "
";
+ private static final String HTML_TD_S = "";
+ private static final String HTML_TD_E = " | ";
+
+ private ExcelConverHtmlUtil() {
+
+ }
+
+ public String convert(Workbook workbook, int... sheets) {
+ StringBuilder html = new StringBuilder(STARTHTML);
+ StringBuilder css = new StringBuilder();
+ StringBuilder body = new StringBuilder();
+ sheetConverToHtml(workbook.getSheetAt(sheets[0]), css, body);
+ html.append(css);
+ html.append(body);
+ return html.toString();
+ }
+
+ private void sheetConverToHtml(Sheet sheet, StringBuilder css, StringBuilder body) {
+ Iterator rows = sheet.rowIterator();
+ Iterator cells = null;
+ while (rows.hasNext()) {
+ Row row = rows.next();
+ cells = row.cellIterator();
+ body.append(HTML_TR_S);
+ while (cells.hasNext()) {
+ Cell cell = cells.next();
+ body.append(HTML_TD_S);
+ body.append(cell.toString());
+ body.append(HTML_TD_E);
+ }
+ body.append(HTML_TR_E);
+ }
+ }
+
+}
diff --git a/pom.xml b/pom.xml
index cfe838e..7685544 100644
--- a/pom.xml
+++ b/pom.xml
@@ -3,7 +3,7 @@
4.0.0
org.jeecgframework
easypoi
- 2.1.1-SNAPSHOT
+ 2.1.2-SNAPSHOT
pom
easypoi
@@ -24,7 +24,7 @@
- 2.1.1-SNAPSHOT
+ 2.1.2-SNAPSHOT
3.9
2.9.1
16.0.1
|