mirror of
https://github.com/apache/poi.git
synced 2026-02-27 12:30:08 +08:00
Adjust parsing XSSFBuiltinTableStyle
In case of invalid enum-value keep the fallback-handling as before as otherwise some existing documents fail to parse
This commit is contained in:
parent
207d67c12b
commit
25a2dd9227
@ -841,15 +841,20 @@ public class StylesTable extends POIXMLDocumentPart implements Styles {
|
||||
* @return defined style, either explicit or built-in, or null if not found
|
||||
*
|
||||
* @since 3.17 beta 1
|
||||
* @throws IllegalArgumentException if there is no explicit table style but the name is an
|
||||
* unknown built-in style
|
||||
*/
|
||||
public TableStyle getTableStyle(String name) {
|
||||
if (name == null) return null;
|
||||
TableStyle tableStyle = getExplicitTableStyle(name);
|
||||
if (tableStyle == null)
|
||||
tableStyle = XSSFBuiltinTableStyle.valueOf(name).getStyle();
|
||||
return tableStyle;
|
||||
if (tableStyle != null) {
|
||||
return tableStyle;
|
||||
}
|
||||
|
||||
try {
|
||||
return XSSFBuiltinTableStyle.valueOf(name).getStyle();
|
||||
} catch (IllegalArgumentException e) {
|
||||
return getExplicitTableStyle(name);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
BIN
test-data/spreadsheet/xssf-enum.xltx.xlsx
Normal file
BIN
test-data/spreadsheet/xssf-enum.xltx.xlsx
Normal file
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user