diff --git a/src/ooxml/java/org/apache/poi/xssf/streaming/SheetDataWriter.java b/src/ooxml/java/org/apache/poi/xssf/streaming/SheetDataWriter.java index 524672863f..2e8e7a7887 100644 --- a/src/ooxml/java/org/apache/poi/xssf/streaming/SheetDataWriter.java +++ b/src/ooxml/java/org/apache/poi/xssf/streaming/SheetDataWriter.java @@ -283,7 +283,7 @@ public class SheetDataWriter implements Closeable { break; } _out.write(">"); - outputQuotedString(cell.getCellFormula()); + outputEscapedString(cell.getCellFormula()); _out.write(""); switch (cell.getCachedFormulaResultType()) { case NUMERIC: @@ -298,7 +298,7 @@ public class SheetDataWriter implements Closeable { String value = cell.getStringCellValue(); if(value != null && !value.isEmpty()) { _out.write(""); - outputQuotedString(value); + outputEscapedString(value); _out.write(""); } break; @@ -311,7 +311,7 @@ public class SheetDataWriter implements Closeable { FormulaError error = FormulaError.forInt(cell.getErrorCellValue()); _out.write(">"); - outputQuotedString(error.getString()); + outputEscapedString(error.getString()); _out.write(""); break; } @@ -334,7 +334,7 @@ public class SheetDataWriter implements Closeable { writeAttribute("xml:space", "preserve"); } _out.write(">"); - outputQuotedString(cell.getStringCellValue()); + outputEscapedString(cell.getStringCellValue()); _out.write(""); } break; @@ -358,7 +358,7 @@ public class SheetDataWriter implements Closeable { writeAttribute("t", "e"); _out.write(">"); - outputQuotedString(error.getString()); + outputEscapedString(error.getString()); _out.write(""); break; } @@ -390,7 +390,7 @@ public class SheetDataWriter implements Closeable { return false; } - protected void outputQuotedString(String s) throws IOException { + protected void outputEscapedString(String s) throws IOException { if (s == null || s.length() == 0) { return; } diff --git a/src/ooxml/testcases/org/apache/poi/xssf/streaming/TestSheetDataWriter.java b/src/ooxml/testcases/org/apache/poi/xssf/streaming/TestSheetDataWriter.java index e69aacf2d5..dabd8a882d 100644 --- a/src/ooxml/testcases/org/apache/poi/xssf/streaming/TestSheetDataWriter.java +++ b/src/ooxml/testcases/org/apache/poi/xssf/streaming/TestSheetDataWriter.java @@ -58,7 +58,7 @@ public final class TestSheetDataWriter { public void testWriteUnicodeSurrogates() throws IOException { SheetDataWriter writer = new SheetDataWriter(); try { - writer.outputQuotedString(unicodeSurrogates); + writer.outputEscapedString(unicodeSurrogates); writer.close(); File file = writer.getTempFile(); try (FileInputStream is = new FileInputStream(file)) { @@ -73,7 +73,7 @@ public final class TestSheetDataWriter { public void testWriteNewLines() throws IOException { SheetDataWriter writer = new SheetDataWriter(); try { - writer.outputQuotedString("\r\n"); + writer.outputEscapedString("\r\n"); writer.close(); File file = writer.getTempFile(); try (FileInputStream is = new FileInputStream(file)) {