refactor getTableStyle due to perf issues (#896)

This commit is contained in:
PJ Fanning 2025-09-09 23:12:08 +01:00 committed by GitHub
parent 28cd548f6b
commit 2b7f7074a0
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -841,14 +841,15 @@ 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;
try {
return XSSFBuiltinTableStyle.valueOf(name).getStyle();
} catch (IllegalArgumentException e) {
return getExplicitTableStyle(name);
}
TableStyle tableStyle = getExplicitTableStyle(name);
if (tableStyle == null)
tableStyle = XSSFBuiltinTableStyle.valueOf(name).getStyle();
return tableStyle;
}
/**