Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature request: allow rich text formatting in cell comments #634

Open
klamann opened this issue Jun 20, 2019 · 3 comments
Open

Feature request: allow rich text formatting in cell comments #634

klamann opened this issue Jun 20, 2019 · 3 comments
Assignees
Labels
feature request someday May eventually be added.

Comments

@klamann
Copy link

klamann commented Jun 20, 2019

Please add support for richt text formatting as in write_rich_string for cell comments (write_comment). This is not covered in the current implementation, where you can set some basic formatting properties (like font size and background color) for the entire comment, but not for parts of it.

Use case: I would like to highlight certain portions of a long comment by changing formatting properties like bold, italic and font color.

@jmcnamara jmcnamara self-assigned this Jun 20, 2019
@jmcnamara jmcnamara added feature request someday May eventually be added. labels Jun 20, 2019
@messlinger
Copy link

I have implemented this in my xlsxwriter-fork for my current project, which uses comments extensively for documentation purposes. The required additions to the source code are actually quite small, since the formatting functionality is already implemented in Worksheet.write_rich_string(). Besides a new method Worksheet.write_rich_comment(), I needed a conditional branch in Comment._write_text() and an additional method XMLwriter._xml_data_element_unencoded() to insert the preformatted string into the XML stream without escaping the format-tags.
Let me know if this is of interest for you.

Best regards
Stephan

@klamann
Copy link
Author

klamann commented Aug 27, 2019

This sounds promising. Can you add a link to your forked version of xlsxwriter? I couldn't find it in your profile

@messlinger
Copy link

Here you are:
https://github.com/messlinger/XlsxWriter/tree/feature_formatted_comments

I also just noted that the docstring of Worksheet.write_rich_string() incorrectly states
"-2: String truncated to 32k characters.", while the string is really discarded in that case.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request someday May eventually be added.
Projects
None yet
Development

No branches or pull requests

3 participants