https://issues.apache.org/bugzilla/show_bug.cgi?id=57571

Gennadiy Vaysman <[email protected]> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEEDINFO                    |NEW

--- Comment #4 from Gennadiy Vaysman <[email protected]> ---
I found root cause and workaround. 
Here is how I add comments. Notice two extra calls added that address the
problem. Now I can open spreadsheets in Excel
    private static void createComment(Drawing drawing, Cell cell)
    {
        CreationHelper factory = workBook.getCreationHelper();

        ClientAnchor anchor = factory.createClientAnchor();
        anchor.setCol1(cell.getColumnIndex());
        anchor.setCol2(cell.getColumnIndex() + 2);
        anchor.setRow1(cell.getRowIndex());
        anchor.setRow2(cell.getRowIndex()+1);

        Comment comment = drawing.createCellComment(anchor);
        comment.setAuthor("Tester");
        comment.setString(factory.createRichTextString("Cell " +
cell.getColumnIndex() + "x" + cell.getRowIndex() + " commment"));
        cell.setCellComment(comment);
        comment.setColumn(cell.getColumnIndex());   // <<<<<<<< fixes the
problem        comment.setRow(cell.getRowIndex());    // <<<<<<<< fixes the
problem
    }
Now, the diff on vmlDrawing1.xml highlighted the problem I have addressed by
those two extra calls. Observe that for SXSSF, <Row> and <Column> are always 0
for ALL comments:
  <v:shape id="_x0000_s1248" type="#_xssf_cell_comment"
style="position:absolute; visibility:hidden" fillcolor="#ffffe1"
o:insetmode="auto">
    <v:fill color="#ffffe1"/>
    <v:shadow on="t" color="black" obscured="t"/>
    <v:path o:connecttype="none"/>
    <v:textbox style="mso-direction-alt:auto"/>
    <x:ClientData ObjectType="Note">
      <x:MoveWithCells/>
      <x:SizeWithCells/>
      <x:Anchor>2, 0, 7500, 0, 4, 0, 7501, 0</x:Anchor>
      <x:AutoFill>False</x:AutoFill>
      <x:Row>0</x:Row>
      <x:Column>0</x:Column>
    </x:ClientData>
  </v:shape>
  <v:shape id="_x0000_s1249" type="#_xssf_cell_comment"
style="position:absolute; visibility:hidden" fillcolor="#ffffe1"
o:insetmode="auto">
    <v:fill color="#ffffe1"/>
    <v:shadow on="t" color="black" obscured="t"/>
    <v:path o:connecttype="none"/>
    <v:textbox style="mso-direction-alt:auto"/>
    <x:ClientData ObjectType="Note">
      <x:MoveWithCells/>
      <x:SizeWithCells/>
      <x:Anchor>4, 0, 7500, 0, 6, 0, 7501, 0</x:Anchor>
      <x:AutoFill>False</x:AutoFill>
      <x:Row>0</x:Row>
      <x:Column>0</x:Column>
    </x:ClientData>
  </v:shape>
Since workaround is good, I am lowering the severity of this bug

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to