@@ -, +, @@ /** * Changes the display name of the Table. *
* If {@code name} is null, or is empty, or conflicts with the name of an existing XSSFTable
* or XSSFName, then an IllegalARgumentException is thrown.
* @param name to use
*/
public void setDisplayName(String name) {
if (name == null || name.isEmpty()) {
throw new IllegalArgumentException("Display name must not be null or empty");
}
final XSSFWorkbook workbook=getXSSFSheet().getWorkbook();
if(isInvalidTableName(workbook,name)) {
throw new IllegalArgumentException("setDisplayName("+name+"): name conflicts with XSSFName or XSSFTable");
}
ctTable.setDisplayName(name);
}
/**
* This method returns true if {@code displayName} conflicts with the name of any {@code XSSFName} or {@code XSSFTable}
* in {@code workbook}.
*
* @param workbook
* @param displayName
* @return
*/
static boolean isInvalidTableName(XSSFWorkbook workbook,String displayName) {
if(workbook==null)
throw new IllegalStateException("isInvalidTableName: getWorkbook returns null");
final Collection