Bug 61728 - Cell Comments created with Apache POI have transparent background
Summary: Cell Comments created with Apache POI have transparent background
Status: NEW
Alias: None
Product: POI
Classification: Unclassified
Component: XSSF (show other bugs)
Version: 3.17-FINAL
Hardware: PC All
: P2 normal (vote)
Target Milestone: ---
Assignee: POI Developers List
Depends on:
Reported: 2017-11-06 13:18 UTC by Evgenii Balakhonov
Modified: 2017-11-06 18:01 UTC (History)
1 user (show)

I use this file to add cells with comments (19.68 KB, application/vnd.ms-excel.sheet.macroEnabled.12)
2017-11-06 13:18 UTC, Evgenii Balakhonov
Example of generated file with transparent comments (33.78 KB, application/vnd.ms-excel.sheet.macroEnabled.12)
2017-11-06 16:36 UTC, Evgenii Balakhonov

Note You need to log in before you can comment on or make changes to this bug.
Description Evgenii Balakhonov 2017-11-06 13:18:24 UTC
Created attachment 35497 [details]
I use this file to add cells with comments

I am using Apache POI 3.17 to create cell comments.

I have a need to add cell comments to XSSF sheets.

I have tried the code, suggested in POI FAQ. But my cell comments have  transparent background.

The code is reproduced below.

protected void setCellComment(Cell cell, String message) {
    Drawing drawing = cell.getSheet().createDrawingPatriarch();
    CreationHelper factory = cell.getSheet().getWorkbook()
    // When the comment box is visible, have it show in a 1x3 space
    ClientAnchor anchor = factory.createClientAnchor();
    anchor.setCol2(cell.getColumnIndex() + 1);
    anchor.setRow2(cell.getRowIndex() + 1);

    // Create the comment and set the text+author
    Comment comment = drawing.createCellComment(anchor);
    RichTextString str = factory.createRichTextString(message);
    comment.setAuthor("Apache POI");
    // Assign the comment to the cell
How can I change the background to a yellow background?

NOTE: If one edits the apache-poi created comment in Excel, then it will appear with a yellow background temporarily. However if one tries to format this comment to change the background from within Excel, then one can't. (The Color and Lines menu does not appear)
Comment 1 Javen O'Neal 2017-11-06 16:33:17 UTC
What version of Excel are you using?
Comment 2 Evgenii Balakhonov 2017-11-06 16:36:51 UTC
Created attachment 35498 [details]
Example of generated file with transparent comments
Comment 3 Evgenii Balakhonov 2017-11-06 16:56:03 UTC
(In reply to Javen O'Neal from comment #1)
> What version of Excel are you using?

Excel 2013. I attached generated file with example of transparent comments.
Comment 4 PJ Fanning 2017-11-06 18:01:34 UTC
I added the first comment using Excel and the other one was already in comment-example.xlsm. The first comment appears as black text on a yellow background while the other one appears as black text on a transparent background.

   <comment ref="B178" authorId="1">
                    <sz val="10"/>
                    <color indexed="81"/>
                    <rFont val="Calibri"/>
                    <sz val="10"/>
                    <color indexed="81"/>
                    <rFont val="Calibri"/>
                <t xml:space="preserve">
    <comment ref="B191" authorId="0">
                    <sz val="11"/>
                    <color theme="1"/>
                    <rFont val="Calibri"/>
                    <family val="2"/>
                    <charset val="204"/>
                    <scheme val="minor"/>
                <t>Страна происхождения, где товар был изготовлен или обработан. Пример заполнения: Сделано в Германии. Данная информация отображается на упаковке товара.</t>