Skip to content

Commit

Permalink
Update Helper.java
Browse files Browse the repository at this point in the history
  • Loading branch information
youfanx committed Apr 22, 2024
1 parent ea09a69 commit 2050778
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions rxlib-x/src/main/java/org/rx/util/Helper.java
Original file line number Diff line number Diff line change
Expand Up @@ -144,14 +144,14 @@ public static Map<String, List<Object[]>> readExcel(InputStream in, boolean is20
return data;
}

public static void writeExcel(OutputStream out, boolean is2003File, Map<String, Iterable<Object[]>> data) {
writeExcel(out, is2003File, data, null);
public static void writeExcel(OutputStream out, boolean is2003File, Iterable<Object[]> sheetRows) {
writeExcel(out, is2003File, Collections.singletonMap("sheet1", sheetRows), null);
}

@SneakyThrows
public static void writeExcel(OutputStream out, boolean is2003File, Map<String, Iterable<Object[]>> data, Function<Row, Row> onRow) {
public static void writeExcel(OutputStream out, boolean is2003File, Map<String, Iterable<Object[]>> sheets, Function<Row, Row> onRow) {
try (Workbook workbook = is2003File ? new HSSFWorkbook() : new XSSFWorkbook()) {
for (Map.Entry<String, Iterable<Object[]>> entry : data.entrySet()) {
for (Map.Entry<String, Iterable<Object[]>> entry : sheets.entrySet()) {
Sheet sheet = workbook.getSheet(entry.getKey());
if (sheet == null) {
sheet = workbook.createSheet(entry.getKey());
Expand Down

0 comments on commit 2050778

Please sign in to comment.