added features:

-background image for comment
-wrapText for HSSFSimpleShape
-few other improvements

git-svn-id: https://svn.apache.org/repos/asf/poi/branches/gsoc2012@1366636 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Evgeniy Berlog 2012-07-28 10:21:40 +00:00
parent 5e17fbb130
commit b7f92ea9ad
14 changed files with 123 additions and 53 deletions

View File

@ -154,6 +154,15 @@ public abstract class AbstractEscherOptRecord extends EscherRecord
sortProperties();
}
public void removeEscherProperty(int num){
for ( Iterator<EscherProperty> iterator = getEscherProperties().iterator(); iterator.hasNext(); ) {
EscherProperty prop = iterator.next();
if (prop.getPropertyNumber() == num){
iterator.remove();
}
}
}
/**
* Retrieve the string representation of this record.
*/

View File

@ -70,7 +70,7 @@ public class EscherBoolProperty
public String toXml(String tab){
StringBuilder builder = new StringBuilder();
builder.append(tab).append("<").append(getClass().getSimpleName()).append(" id=\"0x").append(HexDump.toHex(getId()))
.append("\" name=\"").append(getName()).append("\" blipId=\"")
.append("\" name=\"").append(getName()).append("\" simpleValue=\"").append(getPropertyValue()).append("\" blipId=\"")
.append(isBlipId()).append("\" value=\"").append(isTrue()).append("\"").append("/>\n");
return builder.toString();
}

View File

@ -19,7 +19,6 @@ package org.apache.poi.hssf.usermodel;
import org.apache.poi.ddf.*;
import org.apache.poi.hssf.record.*;
import org.apache.poi.ss.usermodel.Comment;
import org.apache.poi.ss.usermodel.RichTextString;
/**
* Represents a cell comment - a sticky note associated with a cell.
@ -28,6 +27,9 @@ import org.apache.poi.ss.usermodel.RichTextString;
*/
public class HSSFComment extends HSSFTextbox implements Comment {
private final static int FILL_TYPE_SOLID = 0;
private final static int FILL_TYPE_PICTURE = 3;
/*
* TODO - make HSSFComment more consistent when created vs read from file.
* Currently HSSFComment has two main forms (corresponding to the two constructors). There
@ -77,10 +79,11 @@ public class HSSFComment extends HSSFTextbox implements Comment {
protected EscherContainerRecord createSpContainer() {
EscherContainerRecord spContainer = super.createSpContainer();
EscherOptRecord opt = spContainer.getChildById(EscherOptRecord.RECORD_ID);
removeEscherProperty(opt, EscherProperties.TEXT__TEXTLEFT);
removeEscherProperty(opt, EscherProperties.TEXT__TEXTRIGHT);
removeEscherProperty(opt, EscherProperties.TEXT__TEXTTOP);
removeEscherProperty(opt, EscherProperties.TEXT__TEXTBOTTOM);
opt.removeEscherProperty(EscherProperties.TEXT__TEXTLEFT);
opt.removeEscherProperty(EscherProperties.TEXT__TEXTRIGHT);
opt.removeEscherProperty(EscherProperties.TEXT__TEXTTOP);
opt.removeEscherProperty(EscherProperties.TEXT__TEXTBOTTOM);
opt.setEscherProperty(new EscherSimpleProperty(EscherProperties.GROUPSHAPE__PRINT, false, false, 655362));
return spContainer;
}
@ -215,7 +218,7 @@ public class HSSFComment extends HSSFTextbox implements Comment {
}
@Override
public HSSFShape cloneShape() {
protected HSSFShape cloneShape() {
TextObjectRecord txo = (TextObjectRecord) getTextObjectRecord().cloneViaReserialise();
EscherContainerRecord spContainer = new EscherContainerRecord();
byte [] inSp = getEscherContainer().serialize();
@ -224,4 +227,26 @@ public class HSSFComment extends HSSFTextbox implements Comment {
NoteRecord note = (NoteRecord) getNoteRecord().cloneViaReserialise();
return new HSSFComment(spContainer, obj, txo, note);
}
public void setBackgroundImage(int pictureIndex){
setPropertyValue(new EscherSimpleProperty( EscherProperties.FILL__PATTERNTEXTURE, false, true, pictureIndex));
setPropertyValue(new EscherSimpleProperty( EscherProperties.FILL__FILLTYPE, false, false, FILL_TYPE_PICTURE));
EscherBSERecord bse = _patriarch.getSheet().getWorkbook().getWorkbook().getBSERecord(pictureIndex);
bse.setRef(bse.getRef() + 1);
}
public void resetBackgroundImage(){
EscherSimpleProperty property = getOptRecord().lookup(EscherProperties.FILL__PATTERNTEXTURE);
if (null != property){
EscherBSERecord bse = _patriarch.getSheet().getWorkbook().getWorkbook().getBSERecord(property.getPropertyValue());
bse.setRef(bse.getRef() - 1);
getOptRecord().removeEscherProperty(EscherProperties.FILL__PATTERNTEXTURE);
}
setPropertyValue(new EscherSimpleProperty( EscherProperties.FILL__FILLTYPE, false, false, FILL_TYPE_SOLID));
}
public int getBackgroundImageId(){
EscherSimpleProperty property = getOptRecord().lookup(EscherProperties.FILL__PATTERNTEXTURE);
return property == null ? 0 : property.getPropertyValue();
}
}

View File

@ -136,7 +136,7 @@ public final class HSSFObjectData extends HSSFPicture {
}
@Override
public HSSFShape cloneShape() {
protected HSSFShape cloneShape() {
EscherContainerRecord spContainer = new EscherContainerRecord();
byte[] inSp = getEscherContainer().serialize();
spContainer.fillFields(inSp, 0, new DefaultEscherRecordFactory());

View File

@ -87,8 +87,8 @@ public class HSSFPicture extends HSSFSimpleShape implements Picture {
protected EscherContainerRecord createSpContainer() {
EscherContainerRecord spContainer = super.createSpContainer();
EscherOptRecord opt = spContainer.getChildById(EscherOptRecord.RECORD_ID);
removeEscherProperty(opt, EscherProperties.LINESTYLE__LINEDASHING);
removeEscherProperty(opt, EscherProperties.LINESTYLE__NOLINEDRAWDASH);
opt.removeEscherProperty(EscherProperties.LINESTYLE__LINEDASHING);
opt.removeEscherProperty(EscherProperties.LINESTYLE__NOLINEDRAWDASH);
spContainer.removeChildRecord(spContainer.getChildById(EscherTextboxRecord.RECORD_ID));
return spContainer;
}
@ -290,7 +290,7 @@ public class HSSFPicture extends HSSFSimpleShape implements Picture {
}
@Override
public HSSFShape cloneShape() {
protected HSSFShape cloneShape() {
EscherContainerRecord spContainer = new EscherContainerRecord();
byte [] inSp = getEscherContainer().serialize();
spContainer.fillFields(inSp, 0, new DefaultEscherRecordFactory());

View File

@ -90,15 +90,6 @@ public abstract class HSSFShape {
protected abstract void afterRemove(HSSFPatriarch patriarch);
protected void removeEscherProperty(EscherOptRecord opt, int num){
for ( Iterator<EscherProperty> iterator = opt.getEscherProperties().iterator(); iterator.hasNext(); ) {
EscherProperty prop = iterator.next();
if (prop.getPropertyNumber() == num){
iterator.remove();
}
}
}
void setShapeId(int shapeId){
EscherSpRecord spRecord = _escherContainer.getChildById(EscherSpRecord.RECORD_ID);
spRecord.setShapeId(shapeId);
@ -112,15 +103,15 @@ public abstract class HSSFShape {
abstract void afterInsert(HSSFPatriarch patriarch);
public EscherContainerRecord getEscherContainer() {
protected EscherContainerRecord getEscherContainer() {
return _escherContainer;
}
public ObjRecord getObjRecord() {
protected ObjRecord getObjRecord() {
return _objRecord;
}
public EscherOptRecord getOptRecord() {
protected EscherOptRecord getOptRecord() {
return _optRecord;
}
@ -353,5 +344,5 @@ public abstract class HSSFShape {
return 1;
}
public abstract HSSFShape cloneShape();
protected abstract HSSFShape cloneShape();
}

View File

@ -337,7 +337,7 @@ public class HSSFShapeGroup extends HSSFShape implements HSSFShapeContainer {
}
@Override
public HSSFShape cloneShape() {
protected HSSFShape cloneShape() {
throw new IllegalStateException("Use method cloneShape(HSSFPatriarch patriarch)");
}

View File

@ -57,6 +57,10 @@ public class HSSFSimpleShape extends HSSFShape
public final static short OBJECT_TYPE_COMMENT = 25;
// public final static short OBJECT_TYPE_MICROSOFT_OFFICE_DRAWING = 30;
public final static int WRAP_SQUARE = 0;
public final static int WRAP_BY_POINTS = 1;
public final static int WRAP_NONE = 2;
private static final Map <Short, Short> objTypeToShapeType = new HashMap<Short, Short>();
private TextObjectRecord _textObjectRecord;
@ -83,12 +87,14 @@ public class HSSFSimpleShape extends HSSFShape
_textObjectRecord = createTextObjRecord();
}
public TextObjectRecord getTextObjectRecord() {
protected TextObjectRecord getTextObjectRecord() {
return _textObjectRecord;
}
protected TextObjectRecord createTextObjRecord(){
TextObjectRecord obj = new TextObjectRecord();
obj.setHorizontalTextAlignment(2);
obj.setVerticalTextAlignment(2);
obj.setTextLocked(true);
obj.setTextOrientation(TextObjectRecord.TEXT_ORIENTATION_NONE);
obj.setStr(new HSSFRichTextString(""));
@ -194,7 +200,7 @@ public class HSSFSimpleShape extends HSSFShape
}
@Override
public HSSFShape cloneShape() {
protected HSSFShape cloneShape() {
TextObjectRecord txo = null;
EscherContainerRecord spContainer = new EscherContainerRecord();
byte [] inSp = getEscherContainer().serialize();
@ -243,4 +249,13 @@ public class HSSFSimpleShape extends HSSFShape
}
spRecord.setShapeType(objTypeToShapeType.get((short) shapeType));
}
public int getWrapText(){
EscherSimpleProperty property = getOptRecord().lookup(EscherProperties.TEXT__WRAPTEXT);
return null == property ? WRAP_SQUARE : property.getPropertyValue();
}
public void setWrapText(int value){
setPropertyValue(new EscherSimpleProperty(EscherProperties.TEXT__WRAPTEXT, false, false, value));
}
}

View File

@ -230,7 +230,7 @@ public class HSSFTextbox extends HSSFSimpleShape {
}
@Override
public HSSFShape cloneShape() {
protected HSSFShape cloneShape() {
TextObjectRecord txo = (TextObjectRecord) getTextObjectRecord().cloneViaReserialise();
EscherContainerRecord spContainer = new EscherContainerRecord();
byte[] inSp = getEscherContainer().serialize();

View File

@ -50,7 +50,7 @@ public class HSSFUnknownShape extends HSSFShape {
}
@Override
public HSSFShape cloneShape() {
protected HSSFShape cloneShape() {
return null;
}
}

View File

@ -120,7 +120,7 @@ public class TestDrawingShapes extends TestCase {
HSSFSheet sheet = wb.createSheet();
HSSFPatriarch drawing = sheet.createDrawingPatriarch();
HSSFClientAnchor anchor = new HSSFClientAnchor(10, 10, 200, 200, (short) 2, 2, (short) 15, 15);
HSSFClientAnchor anchor = new HSSFClientAnchor(10, 10, 50, 50, (short) 2, 2, (short) 4, 4);
anchor.setAnchorType(2);
assertEquals(anchor.getAnchorType(), 2);
@ -132,13 +132,16 @@ public class TestDrawingShapes extends TestCase {
assertEquals(10000, rectangle.getLineWidth());
rectangle.setLineStyle(10);
assertEquals(10, rectangle.getLineStyle());
assertEquals(rectangle.getWrapText(), HSSFSimpleShape.WRAP_SQUARE);
rectangle.setLineStyleColor(1111);
rectangle.setNoFill(true);
rectangle.setWrapText(HSSFSimpleShape.WRAP_NONE);
rectangle.setString(new HSSFRichTextString("teeeest"));
assertEquals(rectangle.getLineStyleColor(), 1111);
assertEquals(((EscherSimpleProperty)((EscherOptRecord)rectangle.getEscherContainer().getChildById(EscherOptRecord.RECORD_ID))
assertEquals(((EscherSimpleProperty)((EscherOptRecord)HSSFTestHelper.getEscherContainer(rectangle).getChildById(EscherOptRecord.RECORD_ID))
.lookup(EscherProperties.TEXT__TEXTID)).getPropertyValue(), "teeeest".hashCode());
assertEquals(rectangle.isNoFill(), true);
assertEquals(rectangle.getWrapText(), HSSFSimpleShape.WRAP_NONE);
assertEquals(rectangle.getString().getString(), "teeeest");
wb = HSSFTestDataSamples.writeOutAndReadBack(wb);
@ -157,6 +160,7 @@ public class TestDrawingShapes extends TestCase {
assertEquals(rectangle2.getFillColor(), 777);
assertEquals(rectangle2.isNoFill(), true);
assertEquals(rectangle2.getString().getString(), "teeeest");
assertEquals(rectangle.getWrapText(), HSSFSimpleShape.WRAP_NONE);
rectangle2.setFillColor(3333);
rectangle2.setLineStyle(9);
@ -167,6 +171,7 @@ public class TestDrawingShapes extends TestCase {
rectangle2.getAnchor().setDx2(3);
rectangle2.getAnchor().setDy1(4);
rectangle2.getAnchor().setDy2(5);
rectangle.setWrapText(HSSFSimpleShape.WRAP_BY_POINTS);
rectangle2.setString(new HSSFRichTextString("test22"));
wb = HSSFTestDataSamples.writeOutAndReadBack(wb);
@ -175,6 +180,7 @@ public class TestDrawingShapes extends TestCase {
assertEquals(1, drawing.getChildren().size());
rectangle2 = (HSSFSimpleShape) drawing.getChildren().get(0);
assertEquals(HSSFSimpleShape.OBJECT_TYPE_RECTANGLE, rectangle2.getShapeType());
assertEquals(rectangle.getWrapText(), HSSFSimpleShape.WRAP_BY_POINTS);
assertEquals(77, rectangle2.getLineWidth());
assertEquals(9, rectangle2.getLineStyle());
assertEquals(rectangle2.getLineStyleColor(), 4444);
@ -313,7 +319,7 @@ public class TestDrawingShapes extends TestCase {
HSSFTextbox textbox = patriarch.createTextbox(new HSSFClientAnchor());
EscherOptRecord opt1 = HSSFTestHelper.getOptRecord(textbox);
EscherOptRecord opt2 = textbox.getEscherContainer().getChildById(EscherOptRecord.RECORD_ID);
EscherOptRecord opt2 = HSSFTestHelper.getEscherContainer(textbox).getChildById(EscherOptRecord.RECORD_ID);
assertSame(opt1, opt2);
}
@ -328,13 +334,13 @@ public class TestDrawingShapes extends TestCase {
String opt1Str = opt.toXml();
textbox.setFillColor(textbox.getFillColor());
assertEquals(opt1Str, textbox.getEscherContainer().getChildById(EscherOptRecord.RECORD_ID).toXml());
assertEquals(opt1Str, HSSFTestHelper.getEscherContainer(textbox).getChildById(EscherOptRecord.RECORD_ID).toXml());
textbox.setLineStyle(textbox.getLineStyle());
assertEquals(opt1Str, textbox.getEscherContainer().getChildById(EscherOptRecord.RECORD_ID).toXml());
assertEquals(opt1Str, HSSFTestHelper.getEscherContainer(textbox).getChildById(EscherOptRecord.RECORD_ID).toXml());
textbox.setLineWidth(textbox.getLineWidth());
assertEquals(opt1Str, textbox.getEscherContainer().getChildById(EscherOptRecord.RECORD_ID).toXml());
assertEquals(opt1Str, HSSFTestHelper.getEscherContainer(textbox).getChildById(EscherOptRecord.RECORD_ID).toXml());
textbox.setLineStyleColor(textbox.getLineStyleColor());
assertEquals(opt1Str, textbox.getEscherContainer().getChildById(EscherOptRecord.RECORD_ID).toXml());
assertEquals(opt1Str, HSSFTestHelper.getEscherContainer(textbox).getChildById(EscherOptRecord.RECORD_ID).toXml());
}
public void testDgRecordNumShapes(){
@ -370,7 +376,7 @@ public class TestDrawingShapes extends TestCase {
shape.setString(new HSSFRichTextString("string1"));
assertEquals(shape.getString().getString(), "string1");
assertNotNull(shape.getEscherContainer().getChildById(EscherTextboxRecord.RECORD_ID));
assertNotNull(HSSFTestHelper.getEscherContainer(shape).getChildById(EscherTextboxRecord.RECORD_ID));
assertEquals(agg.getShapeToObjMapping().size(), 2);
wb = HSSFTestDataSamples.writeOutAndReadBack(wb);
@ -381,9 +387,9 @@ public class TestDrawingShapes extends TestCase {
shape = (HSSFSimpleShape) patriarch.getChildren().get(0);
assertNotNull(shape.getTextObjectRecord());
assertNotNull(HSSFTestHelper.getTextObjRecord(shape));
assertEquals(shape.getString().getString(), "string1");
assertNotNull(shape.getEscherContainer().getChildById(EscherTextboxRecord.RECORD_ID));
assertNotNull(HSSFTestHelper.getEscherContainer(shape).getChildById(EscherTextboxRecord.RECORD_ID));
assertEquals(agg.getShapeToObjMapping().size(), 2);
}
@ -396,8 +402,8 @@ public class TestDrawingShapes extends TestCase {
HSSFTestHelper.setShapeId(combobox, 1024);
ComboboxShape comboboxShape = new ComboboxShape(combobox, 1024);
assertTrue(Arrays.equals(comboboxShape.getSpContainer().serialize(), combobox.getEscherContainer().serialize()));
assertTrue(Arrays.equals(comboboxShape.getObjRecord().serialize(), combobox.getObjRecord().serialize()));
assertTrue(Arrays.equals(comboboxShape.getSpContainer().serialize(), HSSFTestHelper.getEscherContainer(combobox).serialize()));
assertTrue(Arrays.equals(comboboxShape.getObjRecord().serialize(), HSSFTestHelper.getObjRecord(combobox).serialize()));
}
public void testRemoveShapes(){

View File

@ -55,17 +55,17 @@ public class TestHSSFAnchor extends TestCase {
HSSFSimpleShape rectangle = (HSSFSimpleShape) drawing.getChildren().get(0);
assertEquals(rectangle.getEscherContainer().getChild(0).getRecordId(), EscherSpRecord.RECORD_ID);
assertEquals(rectangle.getEscherContainer().getChild(1).getRecordId(), EscherOptRecord.RECORD_ID);
assertEquals(rectangle.getEscherContainer().getChild(2).getRecordId(), EscherClientAnchorRecord.RECORD_ID);
assertEquals(rectangle.getEscherContainer().getChild(3).getRecordId(), EscherClientDataRecord.RECORD_ID);
assertEquals(HSSFTestHelper.getEscherContainer(rectangle).getChild(0).getRecordId(), EscherSpRecord.RECORD_ID);
assertEquals(HSSFTestHelper.getEscherContainer(rectangle).getChild(1).getRecordId(), EscherOptRecord.RECORD_ID);
assertEquals(HSSFTestHelper.getEscherContainer(rectangle).getChild(2).getRecordId(), EscherClientAnchorRecord.RECORD_ID);
assertEquals(HSSFTestHelper.getEscherContainer(rectangle).getChild(3).getRecordId(), EscherClientDataRecord.RECORD_ID);
rectangle.setAnchor(new HSSFClientAnchor());
assertEquals(rectangle.getEscherContainer().getChild(0).getRecordId(), EscherSpRecord.RECORD_ID);
assertEquals(rectangle.getEscherContainer().getChild(1).getRecordId(), EscherOptRecord.RECORD_ID);
assertEquals(" " + HexDump.toHex(rectangle.getEscherContainer().getChild(2).getRecordId()) + " ", rectangle.getEscherContainer().getChild(2).getRecordId(), EscherClientAnchorRecord.RECORD_ID);
assertEquals(rectangle.getEscherContainer().getChild(3).getRecordId(), EscherClientDataRecord.RECORD_ID);
assertEquals(HSSFTestHelper.getEscherContainer(rectangle).getChild(0).getRecordId(), EscherSpRecord.RECORD_ID);
assertEquals(HSSFTestHelper.getEscherContainer(rectangle).getChild(1).getRecordId(), EscherOptRecord.RECORD_ID);
assertEquals(HSSFTestHelper.getEscherContainer(rectangle).getChild(2).getRecordId(), EscherClientAnchorRecord.RECORD_ID);
assertEquals(HSSFTestHelper.getEscherContainer(rectangle).getChild(3).getRecordId(), EscherClientDataRecord.RECORD_ID);
}
public void testCreateClientAnchorFromContainer(){
@ -135,8 +135,8 @@ public class TestHSSFAnchor extends TestCase {
rectangle.setAnchor(anchor);
assertNotNull(anchor.getEscherAnchor());
assertNotNull(rectangle.getEscherContainer());
assertTrue(anchor.getEscherAnchor().equals(rectangle.getEscherContainer().getChildById(EscherClientAnchorRecord.RECORD_ID)));
assertNotNull(HSSFTestHelper.getEscherContainer(rectangle));
assertTrue(anchor.getEscherAnchor().equals(HSSFTestHelper.getEscherContainer(rectangle).getChildById(EscherClientAnchorRecord.RECORD_ID)));
}
public void testClientAnchorFromEscher(){

View File

@ -21,6 +21,8 @@ import org.apache.poi.hssf.model.DrawingManager2;
import org.apache.poi.hssf.model.InternalSheet;
import org.apache.poi.hssf.model.InternalWorkbook;
import org.apache.poi.hssf.record.EscherAggregate;
import org.apache.poi.hssf.record.ObjRecord;
import org.apache.poi.hssf.record.TextObjectRecord;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
@ -104,4 +106,16 @@ public class HSSFTestHelper {
public static void setShapeId(HSSFShape shape, int id){
shape.setShapeId(id);
}
public static EscherContainerRecord getEscherContainer(HSSFShape shape){
return shape.getEscherContainer();
}
public static TextObjectRecord getTextObjRecord(HSSFSimpleShape shape){
return shape.getTextObjectRecord();
}
public static ObjRecord getObjRecord(HSSFShape shape){
return shape.getObjRecord();
}
}

View File

@ -7,7 +7,7 @@ import org.apache.poi.hssf.model.CommentShape;
import org.apache.poi.hssf.model.HSSFTestModelHelper;
import org.apache.poi.hssf.record.*;
import java.io.IOException;
import java.io.*;
import java.util.Arrays;
/**
@ -91,11 +91,14 @@ public class TestComment extends TestCase {
HSSFWorkbook wb = new HSSFWorkbook();
HSSFSheet sh = wb.createSheet();
HSSFPatriarch patriarch = sh.createDrawingPatriarch();
int idx = wb.addPicture(new byte[]{1,2,3}, HSSFWorkbook.PICTURE_TYPE_PNG);
HSSFComment comment = patriarch.createCellComment(new HSSFClientAnchor());
comment.setString(new HSSFRichTextString("comment1"));
comment = patriarch.createCellComment(new HSSFClientAnchor());
comment = patriarch.createCellComment(new HSSFClientAnchor(0,0,100,100,(short)0,0,(short)10,10));
comment.setString(new HSSFRichTextString("comment2"));
comment.setBackgroundImage(idx);
assertEquals(comment.getBackgroundImageId(), idx);
assertEquals(patriarch.getChildren().size(), 2);
@ -103,6 +106,11 @@ public class TestComment extends TestCase {
sh = wb.getSheetAt(0);
patriarch = sh.getDrawingPatriarch();
comment = (HSSFComment) patriarch.getChildren().get(1);
assertEquals(comment.getBackgroundImageId(), idx);
comment.resetBackgroundImage();
assertEquals(comment.getBackgroundImageId(), 0);
assertEquals(patriarch.getChildren().size(), 2);
comment = patriarch.createCellComment(new HSSFClientAnchor());
comment.setString(new HSSFRichTextString("comment3"));
@ -111,6 +119,8 @@ public class TestComment extends TestCase {
wb = HSSFTestDataSamples.writeOutAndReadBack(wb);
sh = wb.getSheetAt(0);
patriarch = sh.getDrawingPatriarch();
comment = (HSSFComment) patriarch.getChildren().get(1);
assertEquals(comment.getBackgroundImageId(), 0);
assertEquals(patriarch.getChildren().size(), 3);
assertEquals(((HSSFComment) patriarch.getChildren().get(0)).getString().getString(), "comment1");
assertEquals(((HSSFComment) patriarch.getChildren().get(1)).getString().getString(), "comment2");