mirror of
https://gitee.com/dromara/hutool.git
synced 2025-05-02 20:02:49 +08:00
add test
This commit is contained in:
parent
3824c61596
commit
53545b7ddf
@ -600,6 +600,37 @@ public class ExcelWriteTest {
|
||||
writer.close();
|
||||
}
|
||||
|
||||
@Test
|
||||
@Ignore
|
||||
public void writeMultiSheetWithStyleTest() {
|
||||
ExcelWriter writer = ExcelUtil.getWriter("D:\\test\\multiSheetWithStyle.xlsx", "表格1");
|
||||
|
||||
// 表1
|
||||
List<Map<String, Object>> rows = new LinkedList<>();
|
||||
final HashMap<String, Object> map = MapUtil.newHashMap();
|
||||
map.put("k1", "v1");
|
||||
map.put("k2", "v2");
|
||||
map.put("k3", "v3");
|
||||
rows.add(map);
|
||||
writer.write(rows);
|
||||
|
||||
Font headFont = writer.createFont();
|
||||
headFont.setBold(true);
|
||||
headFont.setFontHeightInPoints((short)50);
|
||||
headFont.setFontName("Microsoft YaHei");
|
||||
writer.getStyleSet().getHeadCellStyle().setFont(headFont);
|
||||
|
||||
//表2
|
||||
writer.setSheet("表2");
|
||||
List<Map<String, Object>> rows2 = new LinkedList<>();
|
||||
final HashMap<String, Object> map2 = MapUtil.newHashMap();
|
||||
map2.put("x1", "v1");
|
||||
rows2.add(map2);
|
||||
writer.write(rows2);
|
||||
|
||||
writer.close();
|
||||
}
|
||||
|
||||
@Test
|
||||
@Ignore
|
||||
public void writeMapsTest() {
|
||||
|
Loading…
Reference in New Issue
Block a user