ASF Bugzilla – Attachment 36560 Details for
Bug 62906
XSSFSheet.createTable(AreaReference) corrupts worksheet
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch to XSSFTable.setTableName()
file_62906.txt (text/plain), 1.82 KB, created by
David Gauntt
on 2019-05-04 16:24:48 UTC
(
hide
)
Description:
Patch to XSSFTable.setTableName()
Filename:
MIME Type:
Creator:
David Gauntt
Created:
2019-05-04 16:24:48 UTC
Size:
1.82 KB
patch
obsolete
> /** > * Changes the display name of the Table. > * <p> > * 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<XSSFName> names = workbook.getNames(displayName); > if (names != null && names.size() > 0) { > // name conflicts with an existing XSSFName > return true; > } > for (int n = workbook.getNumberOfSheets() - 1; n >= 0; --n) { > final XSSFSheet sheet = workbook.getSheetAt(n); > for (XSSFTable table : sheet.getTables()) { > if (displayName.equalsIgnoreCase(table.getDisplayName())) { > // name conflicts with a table > return true; > } > } > } > return false; > } >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 62906
:
36545
|
36546
|
36555
|
36559
| 36560 |
36561