Change WIDTH and HEIGHT in class.Comment

Issue #978 resolved
tglaudel created an issue

Hello and thanks for openpyxl.

I need to change width and height to Comment in xlsx.

I try to overwrite class Comment like :

class OverwriteComment(Comment):
    """Overwrite Comment from openpyxl for change height and width"""

    def __init__(self, text, author, width='108pt', height='200pt'):
        """init OverwriteComment."""
        super(OverwriteComment, self).__init__(text, author)
        self.height = height
        self.width = width

But, doesn't work.

Do you have a tips for this ?

Sorry for my english, regards.


Comments (6)

  1. CharlieC

    I think the problem is that in OOXML comments are defined in three different ways: in the comment object, in the drawing object and in some VML. In practice, however, only the VML matters. The code for this is now readable but still largely hardcoded.

  2. MichaƂ Palczewski

    So, what can I do to change the comment dimensions? I need to fit comment box shape to its content, maybe somebody know any workaround :-)

  3. CharlieC

    You could always submit a PR. Ideally at some point there will be only a single way to define and render comments. I thought about add support for text boxes but it turns out these are tricky to do from scratch.

  4. Log in to comment