main
黄海 2 years ago
parent 88db2e3373
commit 11290149f2

@ -34,7 +34,6 @@ public class MergeTableSameCotent {
//删除空白单元格所在的行 //删除空白单元格所在的行
for (int i = 0; i < rows.getCount(); i++) { for (int i = 0; i < rows.getCount(); i++) {
Cell start = table.getRows().get(i).getCells().get(col); Cell start = table.getRows().get(i).getCells().get(col);
//System.out.println(start.getText().charAt(0)-0);
if (start.getText().length() == 1) table.getRows().removeAt(i); if (start.getText().length() == 1) table.getRows().removeAt(i);
} }
//保存 //保存

@ -6,6 +6,7 @@ import com.aspose.cells.Worksheet;
import com.aspose.cells.WorksheetCollection; import com.aspose.cells.WorksheetCollection;
import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.ObjectMapper;
import com.jfinal.kit.StrKit; import com.jfinal.kit.StrKit;
import cn.hutool.core.io.FileUtil;
import java.io.File; import java.io.File;
import java.util.HashMap; import java.util.HashMap;
@ -37,8 +38,11 @@ public class ExcelToHtml {
workbook.save("c:/out/" + cnt + ".html"); workbook.save("c:/out/" + cnt + ".html");
workbook.dispose(); workbook.dispose();
} }
String filePath = "c:/out/map.json"; String content="";
ObjectMapper mapper = new ObjectMapper(); for (Integer key : _map.keySet()) {
mapper.writeValue(new File(filePath), _map); String value = _map.get(key);
content += "<a href='" + key + ".html'>" + value + "</a><br>\r\n";
}
FileUtil.writeString(content,"c:/Out/index.html", "UTF-8");
} }
} }

Loading…
Cancel
Save