Skip to content

Fix #698 implements `__copy__` to create a detached copy of a `Comment`.

Bitbucket Importer requested to merge bitbucket/merged-pr-138 into branch/2.4

Created originally on Bitbucket by Tantale (Laurent LAPORTE)

Was already merged in Bitbucket before import, marked as merged by the import user

Here is a new PR based on the 2.4 branch (instead of default), to ensure .hgtags file is not modified.

To implement Cut/Copy/Paste on OpenPyXl, it it required to copy a comment (from one cell to another). This is the standard behavior in LibreOffice Calc 5.1 and Excel 2013: when you cut a cell, the comment is cutted too. When you copy a cell, the comment is copied once, then cloned the next times.

See issue 698 (details bellow):

  • Change in Comment class: the copy of a Comment now returns a detached clone (without parent Cell).

  • Minor change: remove unused import in openpyxl/comments/ and re-indent code.

Merge request reports