aboutsummaryrefslogtreecommitdiffstats
path: root/poi-ooxml
diff options
context:
space:
mode:
authorPJ Fanning <fanningpj@apache.org>2021-12-21 14:41:50 +0000
committerPJ Fanning <fanningpj@apache.org>2021-12-21 14:41:50 +0000
commit134b7c1be5b834aec9c8d2a924c4f0c724568582 (patch)
treeeaca1f3ca5b918e5c46a298c4843f0151a20c9e1 /poi-ooxml
parentaeab91dce5bcc0556ec686fa417a550c2abda076 (diff)
downloadpoi-134b7c1be5b834aec9c8d2a924c4f0c724568582.tar.gz
poi-134b7c1be5b834aec9c8d2a924c4f0c724568582.zip
[bug-64732] add support for new line escaping when updating table names
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1896246 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'poi-ooxml')
-rw-r--r--poi-ooxml/src/main/java/org/apache/poi/xssf/usermodel/XSSFTable.java5
1 files changed, 4 insertions, 1 deletions
diff --git a/poi-ooxml/src/main/java/org/apache/poi/xssf/usermodel/XSSFTable.java b/poi-ooxml/src/main/java/org/apache/poi/xssf/usermodel/XSSFTable.java
index 7cf2472ca4..e140a1ec96 100644
--- a/poi-ooxml/src/main/java/org/apache/poi/xssf/usermodel/XSSFTable.java
+++ b/poi-ooxml/src/main/java/org/apache/poi/xssf/usermodel/XSSFTable.java
@@ -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++;
}