]> source.dussan.org Git - poi.git/commitdiff
[bug-64732] add support for new line escaping when updating table names
authorPJ Fanning <fanningpj@apache.org>
Tue, 21 Dec 2021 14:41:50 +0000 (14:41 +0000)
committerPJ Fanning <fanningpj@apache.org>
Tue, 21 Dec 2021 14:41:50 +0000 (14:41 +0000)
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1896246 13f79535-47bb-0310-9956-ffa450edef68

poi-ooxml/src/main/java/org/apache/poi/xssf/usermodel/XSSFTable.java

index 7cf2472ca464784b497ddacc2fce9837d3f8c882..e140a1ec967bfd752292a574c316d7a5e6fc2a96 100644 (file)
@@ -803,7 +803,10 @@ public class XSSFTable extends POIXMLDocumentPart implements Table {
                 for (CTTableColumn col : ctTableColumns.getTableColumnList()) {
                     XSSFCell cell = row.getCell(cellnum);
                     if (cell != null) {
-                        col.setName(formatter.formatCellValue(cell));
+                        String colName = formatter.formatCellValue(cell);
+                        colName = colName.replace("\n", "_x000a_");
+                        colName = colName.replace("\r", "_x000d_");
+                        col.setName(colName);
                     }
                     cellnum++;
                 }