Author: dnorth
Date: Wed Jun  3 12:50:10 2015
New Revision: 1683315

URL: http://svn.apache.org/r1683315
Log:
Use a different arbitrary value for the ID of the comment shape type. This 
appears to prevent Excel >= 2010 from turning POI-written comments into the 
wrong shape (giant curved arrow).

Fixes https://bz.apache.org/bugzilla/show_bug.cgi?id=55410

Modified:
    poi/site/src/documentation/content/xdocs/status.xml
    poi/trunk/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFVMLDrawing.java
    
poi/trunk/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFVMLDrawing.java

Modified: poi/site/src/documentation/content/xdocs/status.xml
URL: 
http://svn.apache.org/viewvc/poi/site/src/documentation/content/xdocs/status.xml?rev=1683315&r1=1683314&r2=1683315&view=diff
==============================================================================
--- poi/site/src/documentation/content/xdocs/status.xml (original)
+++ poi/site/src/documentation/content/xdocs/status.xml Wed Jun  3 12:50:10 2015
@@ -24,6 +24,7 @@
         <!-- in strict alphabetical order -->
         <person id="AB" name="Andreas Beeker" email="[email protected]" />
         <person id="AO" name="Andrew C. Oliver" 
email="[email protected]" />
+        <person id="DN" name="David North" email="[email protected]" />
         <person id="DS" name="Dominik Stadler" email="[email protected]" />
         <person id="GJS" name="Glen Stampoultzis" email="[email protected]" 
/>
         <person id="JM" name="Josh Micich" email="[email protected]" />
@@ -43,6 +44,7 @@
         <action dev="PD" type="fix" fixes-bug="57512">Fix potential NPE in 
DateUtil for invalid dates</action>
         <action dev="PD" type="fix" fixes-bug="57889">Fix potential NPE in 
XWPFParagraph.getNumFmt()</action>
         <action dev="PD" type="fix" fixes-bug="57951">Use BigDecimal in some 
cases in DataFormatter.formatRawCellContents, to avoid rounding problems on 
JDK8</action>
+        <action dev="DN" type="fix" fixes-bug="55410">Use specific ID value 
which prevents Excel from turning comments into giant curved arrows</action>
     </release>
 
     <release version="3.12" date="2015-05-11">

Modified: 
poi/trunk/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFVMLDrawing.java
URL: 
http://svn.apache.org/viewvc/poi/trunk/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFVMLDrawing.java?rev=1683315&r1=1683314&r2=1683315&view=diff
==============================================================================
--- poi/trunk/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFVMLDrawing.java 
(original)
+++ poi/trunk/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFVMLDrawing.java 
Wed Jun  3 12:50:10 2015
@@ -68,6 +68,7 @@ public final class XSSFVMLDrawing extend
     private static final QName QNAME_SHAPE_LAYOUT = new 
QName("urn:schemas-microsoft-com:office:office", "shapelayout");
     private static final QName QNAME_SHAPE_TYPE = new 
QName("urn:schemas-microsoft-com:vml", "shapetype");
     private static final QName QNAME_SHAPE = new 
QName("urn:schemas-microsoft-com:vml", "shape");
+    private static final String COMMENT_SHAPE_TYPE_ID = "_x0000_t202"; // this 
ID value seems to have significance to Excel >= 2010; see 
https://issues.apache.org/bugzilla/show_bug.cgi?id=55409
 
     /**
      * regexp to parse shape ids, in VML they have weird form of 
id="_x0000_s1026"
@@ -190,7 +191,7 @@ public final class XSSFVMLDrawing extend
         _qnames.add(QNAME_SHAPE_LAYOUT);
 
         CTShapetype shapetype = CTShapetype.Factory.newInstance();
-        _shapeTypeId = "_xssf_cell_comment";
+        _shapeTypeId = COMMENT_SHAPE_TYPE_ID;
         shapetype.setId(_shapeTypeId);
         shapetype.setCoordsize("21600,21600");
         shapetype.setSpt(202);

Modified: 
poi/trunk/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFVMLDrawing.java
URL: 
http://svn.apache.org/viewvc/poi/trunk/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFVMLDrawing.java?rev=1683315&r1=1683314&r2=1683315&view=diff
==============================================================================
--- 
poi/trunk/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFVMLDrawing.java
 (original)
+++ 
poi/trunk/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFVMLDrawing.java
 Wed Jun  3 12:50:10 2015
@@ -54,14 +54,14 @@ public class TestXSSFVMLDrawing extends
         assertEquals("21600,21600", type.getCoordsize());
         assertEquals(202.0f, type.getSpt());
         assertEquals("m,l,21600r21600,l21600,xe", type.getPath2());
-        assertEquals("_xssf_cell_comment", type.getId());
+        assertEquals("_x0000_t202", type.getId());
         assertEquals(STTrueFalse.T, type.getPathArray(0).getGradientshapeok());
         assertEquals(STConnectType.RECT, 
type.getPathArray(0).getConnecttype());
 
         CTShape shape = vml.newCommentShape();
         assertEquals(3, items.size());
         assertSame(items.get(2),  shape);
-        assertEquals("#_xssf_cell_comment", shape.getType());
+        assertEquals("#_x0000_t202", shape.getType());
         assertEquals("position:absolute; visibility:hidden", shape.getStyle());
         assertEquals("#ffffe1", shape.getFillcolor());
         assertEquals(STInsetMode.AUTO, shape.getInsetmode());



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

Reply via email to