[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
This commit is contained in:
PJ Fanning 2021-12-21 14:41:50 +00:00
parent aeab91dce5
commit 134b7c1be5
1 changed files with 4 additions and 1 deletions

View File

@ -803,7 +803,10 @@ public class XSSFTable extends POIXMLDocumentPart implements Table {
for (CTTableColumn col : ctTableColumns.getTableColumnList()) { for (CTTableColumn col : ctTableColumns.getTableColumnList()) {
XSSFCell cell = row.getCell(cellnum); XSSFCell cell = row.getCell(cellnum);
if (cell != null) { 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++; cellnum++;
} }