mirror of https://github.com/apache/poi.git
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 git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1683315 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
f998d39515
commit
32e8fac65c
|
@ -68,6 +68,7 @@ public final class XSSFVMLDrawing extends POIXMLDocumentPart {
|
||||||
private static final QName QNAME_SHAPE_LAYOUT = new QName("urn:schemas-microsoft-com:office:office", "shapelayout");
|
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_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 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"
|
* regexp to parse shape ids, in VML they have weird form of id="_x0000_s1026"
|
||||||
|
@ -190,7 +191,7 @@ public final class XSSFVMLDrawing extends POIXMLDocumentPart {
|
||||||
_qnames.add(QNAME_SHAPE_LAYOUT);
|
_qnames.add(QNAME_SHAPE_LAYOUT);
|
||||||
|
|
||||||
CTShapetype shapetype = CTShapetype.Factory.newInstance();
|
CTShapetype shapetype = CTShapetype.Factory.newInstance();
|
||||||
_shapeTypeId = "_xssf_cell_comment";
|
_shapeTypeId = COMMENT_SHAPE_TYPE_ID;
|
||||||
shapetype.setId(_shapeTypeId);
|
shapetype.setId(_shapeTypeId);
|
||||||
shapetype.setCoordsize("21600,21600");
|
shapetype.setCoordsize("21600,21600");
|
||||||
shapetype.setSpt(202);
|
shapetype.setSpt(202);
|
||||||
|
|
|
@ -54,14 +54,14 @@ public class TestXSSFVMLDrawing extends TestCase {
|
||||||
assertEquals("21600,21600", type.getCoordsize());
|
assertEquals("21600,21600", type.getCoordsize());
|
||||||
assertEquals(202.0f, type.getSpt());
|
assertEquals(202.0f, type.getSpt());
|
||||||
assertEquals("m,l,21600r21600,l21600,xe", type.getPath2());
|
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(STTrueFalse.T, type.getPathArray(0).getGradientshapeok());
|
||||||
assertEquals(STConnectType.RECT, type.getPathArray(0).getConnecttype());
|
assertEquals(STConnectType.RECT, type.getPathArray(0).getConnecttype());
|
||||||
|
|
||||||
CTShape shape = vml.newCommentShape();
|
CTShape shape = vml.newCommentShape();
|
||||||
assertEquals(3, items.size());
|
assertEquals(3, items.size());
|
||||||
assertSame(items.get(2), shape);
|
assertSame(items.get(2), shape);
|
||||||
assertEquals("#_xssf_cell_comment", shape.getType());
|
assertEquals("#_x0000_t202", shape.getType());
|
||||||
assertEquals("position:absolute; visibility:hidden", shape.getStyle());
|
assertEquals("position:absolute; visibility:hidden", shape.getStyle());
|
||||||
assertEquals("#ffffe1", shape.getFillcolor());
|
assertEquals("#ffffe1", shape.getFillcolor());
|
||||||
assertEquals(STInsetMode.AUTO, shape.getInsetmode());
|
assertEquals(STInsetMode.AUTO, shape.getInsetmode());
|
||||||
|
|
Loading…
Reference in New Issue