ASF Bugzilla – Attachment 30323 Details for
Bug 54920
[PATCH] XSSFDrawing.createCellComment causes CommentsTable to lose reference to comment in cell A1
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Proposed fix for
commit-9621579.patch (text/plain), 5.61 KB, created by
Dominik Stadler
on 2013-05-25 14:25:41 UTC
(
hide
)
Description:
Proposed fix for
Filename:
MIME Type:
Creator:
Dominik Stadler
Created:
2013-05-25 14:25:41 UTC
Size:
5.61 KB
patch
obsolete
>commit 9621579f69eca04b1739ea664c4bed56bb608235 >Author: Dominik Stadler <dominik.stadler@gmx.at> >Date: Sat May 25 16:17:26 2013 +0200 > > Proposed fix for Bug 54920: do not set column and row separatedely, but use a reference for newComment() > >diff --git a/src/ooxml/java/org/apache/poi/xssf/model/CommentsTable.java b/src/ooxml/java/org/apache/poi/xssf/model/CommentsTable.java >index d338e2a..6230b5c 100644 >--- a/src/ooxml/java/org/apache/poi/xssf/model/CommentsTable.java >+++ b/src/ooxml/java/org/apache/poi/xssf/model/CommentsTable.java >@@ -126,9 +126,9 @@ public class CommentsTable extends POIXMLDocumentPart { > return commentRefs.get(cellRef); > } > >- public CTComment newComment() { >+ public CTComment newComment(String ref) { > CTComment ct = comments.getCommentList().addNewComment(); >- ct.setRef("A1"); >+ ct.setRef(ref); > ct.setAuthorId(0); > > if(commentRefs != null) { >diff --git a/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFDrawing.java b/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFDrawing.java >index 43a1d2e..7541dba 100644 >--- a/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFDrawing.java >+++ b/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFDrawing.java >@@ -33,6 +33,7 @@ import org.apache.poi.openxml4j.opc.PackageRelationship; > import org.apache.poi.openxml4j.opc.TargetMode; > import org.apache.poi.ss.usermodel.ClientAnchor; > import org.apache.poi.ss.usermodel.Drawing; >+import org.apache.poi.ss.util.CellReference; > import org.apache.poi.util.Internal; > import org.apache.poi.xssf.model.CommentsTable; > import org.apache.xmlbeans.XmlCursor; >@@ -298,9 +299,10 @@ public final class XSSFDrawing extends POIXMLDocumentPart implements Drawing { > ca.getCol2() + ", 0, " + ca.getRow2() + ", 0"; > vmlShape.getClientDataArray(0).setAnchorArray(0, position); > } >- XSSFComment shape = new XSSFComment(comments, comments.newComment(), vmlShape); >- shape.setColumn(ca.getCol1()); >- shape.setRow(ca.getRow1()); >+ String ref = new CellReference(ca.getRow1(), ca.getCol1()).formatAsString(); >+ XSSFComment shape = new XSSFComment(comments, comments.newComment(ref), vmlShape); >+// shape.setColumn(ca.getCol1()); >+// shape.setRow(ca.getRow1()); > return shape; > } > >diff --git a/src/ooxml/testcases/org/apache/poi/xssf/model/TestCommentsTable.java b/src/ooxml/testcases/org/apache/poi/xssf/model/TestCommentsTable.java >index 293c4e8..9831fa3 100644 >--- a/src/ooxml/testcases/org/apache/poi/xssf/model/TestCommentsTable.java >+++ b/src/ooxml/testcases/org/apache/poi/xssf/model/TestCommentsTable.java >@@ -187,12 +187,12 @@ public class TestCommentsTable extends TestCase { > > public void testRemoveComment() throws Exception { > CommentsTable sheetComments = new CommentsTable(); >- CTComment a1 = sheetComments.newComment(); >- a1.setRef("A1"); >- CTComment a2 = sheetComments.newComment(); >- a2.setRef("A2"); >- CTComment a3 = sheetComments.newComment(); >- a3.setRef("A3"); >+ CTComment a1 = sheetComments.newComment("A1"); >+// a1.setRef("A1"); >+ CTComment a2 = sheetComments.newComment("A2"); >+// a2.setRef("A2"); >+ CTComment a3 = sheetComments.newComment("A3"); >+// a3.setRef("A3"); > > assertSame(a1, sheetComments.getCTComment("A1")); > assertSame(a2, sheetComments.getCTComment("A2")); >diff --git a/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFComment.java b/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFComment.java >index db9b0e6..889c0d8 100644 >--- a/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFComment.java >+++ b/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFComment.java >@@ -50,7 +50,7 @@ public final class TestXSSFComment extends BaseTestCellComment { > assertEquals(1, sheetComments.getCTComments().getAuthors().sizeOfAuthorArray()); > assertEquals(1, sheetComments.getNumberOfAuthors()); > >- CTComment ctComment = sheetComments.newComment(); >+ CTComment ctComment = sheetComments.newComment("A1"); > CTShape vmlShape = CTShape.Factory.newInstance(); > > XSSFComment comment = new XSSFComment(sheetComments, ctComment, vmlShape); >@@ -64,7 +64,7 @@ public final class TestXSSFComment extends BaseTestCellComment { > public void testGetSetCol() { > CommentsTable sheetComments = new CommentsTable(); > XSSFVMLDrawing vml = new XSSFVMLDrawing(); >- CTComment ctComment = sheetComments.newComment(); >+ CTComment ctComment = sheetComments.newComment("A1"); > CTShape vmlShape = vml.newCommentShape(); > > XSSFComment comment = new XSSFComment(sheetComments, ctComment, vmlShape); >@@ -82,7 +82,7 @@ public final class TestXSSFComment extends BaseTestCellComment { > public void testGetSetRow() { > CommentsTable sheetComments = new CommentsTable(); > XSSFVMLDrawing vml = new XSSFVMLDrawing(); >- CTComment ctComment = sheetComments.newComment(); >+ CTComment ctComment = sheetComments.newComment("A1"); > CTShape vmlShape = vml.newCommentShape(); > > XSSFComment comment = new XSSFComment(sheetComments, ctComment, vmlShape); >@@ -150,7 +150,7 @@ public final class TestXSSFComment extends BaseTestCellComment { > > public void testAuthor() { > CommentsTable sheetComments = new CommentsTable(); >- CTComment ctComment = sheetComments.newComment(); >+ CTComment ctComment = sheetComments.newComment("A1"); > > assertEquals(1, sheetComments.getNumberOfAuthors()); > XSSFComment comment = new XSSFComment(sheetComments, ctComment, null);
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 54920
:
30250
|
30322
| 30323