ASF Bugzilla – Attachment 19547 Details for
Bug 41198
HSSF: Support for excel cell comments
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Attempt to remove a comment
patch_to_HSSFCell_to_remove_comments (text/plain), 2.29 KB, created by
Brian Kalbfus
on 2007-02-08 08:15:44 UTC
(
hide
)
Description:
Attempt to remove a comment
Filename:
MIME Type:
Creator:
Brian Kalbfus
Created:
2007-02-08 08:15:44 UTC
Size:
2.29 KB
patch
obsolete
>Index: C:/workspace/poi/org/apache/poi/hssf/usermodel/HSSFCell.java >=================================================================== >--- C:/workspace/poi/org/apache/poi/hssf/usermodel/HSSFCell.java (revision 501957) >+++ C:/workspace/poi/org/apache/poi/hssf/usermodel/HSSFCell.java (working copy) >@@ -1016,4 +1016,60 @@ > } > return comment; > } >+ /** >+ * Returns the comment associated with this cell >+ * >+ * @return comment associated with this cell >+ */ >+ public void removeCellComment() { >+ int objectIndex = -1; >+ HashMap txshapes = new HashMap(); //map shapeId and TextObjectRecord >+ for (Iterator it = sheet.getRecords().iterator(); it.hasNext();) { >+ Record rec = (Record) it.next(); >+ objectIndex++; >+ if (rec instanceof NoteRecord) { >+ NoteRecord note = (NoteRecord) rec; >+ if (note.getRow() == record.getRow() >+ && note.getColumn() == record.getColumn()) { >+ it.remove(); // removes NoteRecord >+ >+// sheet.getRecords().remove(txshapes.get(new Integer(note >+// .getShapeId()))); >+ // remove the object records >+// for (int i = 0; i < vAssocObj.size(); i++) { >+// sheet.getRecords().remove( >+// ((Integer) vAssocObj.get(i)).intValue()); >+// } >+// sheet.getRecords().remove(objectIndex); // remove the note record >+ comment = null; >+ break; >+ >+ } >+ } else if (rec instanceof ObjRecord) { >+ ObjRecord obj = (ObjRecord) rec; >+ ObjRecord ObjParent = obj; >+ SubRecord sub = (SubRecord) obj.getSubRecords().get(0); >+ if (sub instanceof CommonObjectDataSubRecord) { >+ CommonObjectDataSubRecord cmo = (CommonObjectDataSubRecord) sub; >+ if (cmo.getObjectType() == CommonObjectDataSubRecord.OBJECT_TYPE_COMMENT) { >+ int parentObjectIndex = objectIndex; >+ //find the nearest TextObjectRecord which holds comment's text and map it to its shapeId >+ while (it.hasNext()) { >+ rec = (Record) it.next(); >+ objectIndex++; >+ if (rec instanceof TextObjectRecord) { >+ Vector vAssocObj = new Vector(); >+// vAssocObj.add(new Integer(objectIndex)); >+// vAssocObj.add(ew Integer(parentObjectIndex)); >+ txshapes.put(new Integer(cmo.getObjectId()), >+ ObjParent); >+ break; >+ } >+ } >+ >+ } >+ } >+ } >+ } >+ } > }
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 41198
:
19277
|
19278
|
19324
|
19325
| 19547 |
19613