From 166b2776c97be38c14b419010d15ac2f39af1211 Mon Sep 17 00:00:00 2001 From: Krzysztof Rzymkowski Date: Mon, 22 Mar 2021 19:50:41 +0100 Subject: [PATCH 1/2] fix: multiple in workbook.xml when multiple sheets --- .../java/org/dhatim/fastexcel/Workbook.java | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/fastexcel-writer/src/main/java/org/dhatim/fastexcel/Workbook.java b/fastexcel-writer/src/main/java/org/dhatim/fastexcel/Workbook.java index bf426d6e..62d51b9c 100644 --- a/fastexcel-writer/src/main/java/org/dhatim/fastexcel/Workbook.java +++ b/fastexcel-writer/src/main/java/org/dhatim/fastexcel/Workbook.java @@ -203,19 +203,19 @@ private void writeWorkbookFile() throws IOException { /** Defining repeating rows and columns for the print setup... * This is defined for each sheet separately * (if there are any repeating rows or cols in the sheet at all) **/ - + + w.append(""); for (Worksheet ws : worksheets) { - int worksheetIndex = getIndex(ws) - 1; + int worksheetIndex = getIndex(ws) - 1; String defineName = Stream.of(ws.getRepeatingCols(),ws.getRepeatingRows()) .filter(Objects::nonNull) .map(r -> "'" + ws.getName() + "'!" + r.toString()) .collect(Collectors.joining(",")); - - w.append(""); + if (!defineName.isEmpty()) { - w.append("") .append(defineName) .append(""); @@ -224,8 +224,8 @@ private void writeWorkbookFile() throws IOException { for (Map.Entry nr : ws.getNamedRanges().entrySet()) { String rangeName = nr.getKey(); Range range = nr.getValue(); - w.append("'") @@ -251,8 +251,8 @@ private void writeWorkbookFile() throws IOException { .append("$" + Range.colToString(af.getRight()) + "$" + (1 + af.getBottom())) .append(""); } - w.append(""); } + w.append(""); w.append(""); }); } From 1e4c5ec0ff81f135ba71d602f2f32e26306e338e Mon Sep 17 00:00:00 2001 From: Krzysztof Rzymkowski Date: Mon, 22 Mar 2021 19:52:59 +0100 Subject: [PATCH 2/2] Fix: Error: The attribute 'rgb' has invalid value '000000'. The actual length according to datatype 'hexBinary' is not equal to the specified length. The expected length is 4. ContentType: application/vnd.openxmlformats-officedocument.spreadsheetml.styles+xml XPath: /x:styleSheet[1]/x:fonts[1]/x:font[1]/x:color[1] --- fastexcel-writer/src/main/java/org/dhatim/fastexcel/Font.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/fastexcel-writer/src/main/java/org/dhatim/fastexcel/Font.java b/fastexcel-writer/src/main/java/org/dhatim/fastexcel/Font.java index d8b77bae..8ca38ae5 100644 --- a/fastexcel-writer/src/main/java/org/dhatim/fastexcel/Font.java +++ b/fastexcel-writer/src/main/java/org/dhatim/fastexcel/Font.java @@ -84,11 +84,11 @@ class Font { * @param underlined Underlined flag. * @param name Font name. Defaults to "Calibri". * @param size Font size, in points. Defaults to 11.0. - * @param rgbColor RGB font color. Defaults to "000000". + * @param rgbColor RGB font color. Defaults to "FF000000". * @return New font object. */ static Font build(boolean bold, boolean italic, boolean underlined, String name, BigDecimal size, String rgbColor) { - return new Font(bold, italic, underlined, name == null ? "Calibri" : name, size == null ? BigDecimal.valueOf(11.0) : size, rgbColor == null ? "000000" : rgbColor); + return new Font(bold, italic, underlined, name == null ? "Calibri" : name, size == null ? BigDecimal.valueOf(11.0) : size, rgbColor == null ? "FF000000" : rgbColor); } @Override