addProp( m, GROUPSHAPE__BORDERBOTTOMCOLOR, "groupshape.borderBottomColor" ); // 0x039D;
addProp( m, GROUPSHAPE__BORDERRIGHTCOLOR, "groupshape.borderRightColor" ); // 0x039E;
addProp( m, GROUPSHAPE__TABLEPROPERTIES, "groupshape.tableProperties" ); // 0x039F;
- addProp( m, GROUPSHAPE__TABLEROWPROPERTIES, "groupshape.tableRowProperties" ); // 0x03A0;
+ addProp( m, GROUPSHAPE__TABLEROWPROPERTIES, "groupshape.tableRowProperties", EscherPropertyMetaData.TYPE_ARRAY ); // 0x03A0;
addProp( m, GROUPSHAPE__WEBBOT, "groupshape.wzWebBot" ); // 0x03A5;
addProp( m, GROUPSHAPE__METROBLOB, "groupshape.metroBlob" ); // 0x03A9;
addProp( m, GROUPSHAPE__ZORDER, "groupshape.dhgt" ); // 0x03AA;
// assert ppt and pptx versions of the same table have the same shape
confirmTableShapeEqual(ts, tsx);
-
+
+ // change row height and validate again
+ tsx.setRowHeight(1, 50);
+ ts.setRowHeight(1, 50);
+ confirmTableShapeEqual(ts, tsx);
+
pptx.close();
ppt.close();
}
}
@Test
- public void textDirectionHSLF() throws IOException {
+ public void directionHSLF() throws IOException {
assumeFalse(xslfOnly);
SlideShow<?,?> ppt1 = new HSLFSlideShow();
testTextDirection(ppt1);
}
@Test
- public void textDirectionXSLF() throws IOException {
+ public void directionXSLF() throws IOException {
SlideShow<?,?> ppt1 = new XMLSlideShow();
testTextDirection(ppt1);
ppt1.close();
}
@Override
- public void setRowHeight(int row, double height) {
+ public void setRowHeight(int row, final double height) {
if (row < 0 || row >= cells.length) {
throw new IllegalArgumentException("Row index '"+row+"' is not within range [0-"+(cells.length-1)+"]");
}
- int pxHeight = Units.pointsToPixel(height);
- double currentHeight = cells[row][0].getAnchor().getHeight();
- double dy = pxHeight - currentHeight;
-
+ // update row height in the table properties
+ AbstractEscherOptRecord opt = getEscherChild(RecordTypes.EscherUserDefined.typeID);
+ EscherArrayProperty p = opt.lookup(EscherProperties.GROUPSHAPE__TABLEROWPROPERTIES);
+ byte[] masterBytes = p.getElement(row);
+ double currentHeight = Units.masterToPoints(LittleEndian.getInt(masterBytes, 0));
+ LittleEndian.putInt(masterBytes, 0, Units.pointsToMaster(height));
+ p.setElement(row, masterBytes);
+
+ // move the cells
+ double dy = height - currentHeight;
for (int i = row; i < cells.length; i++) {
- for (int j = 0; j < cells[i].length; j++) {
- Rectangle2D anchor = cells[i][j].getAnchor();
+ for (HSLFTableCell c : cells[i]) {
+ if (c == null) {
+ continue;
+ }
+ Rectangle2D anchor = c.getAnchor();
if(i == row) {
- anchor.setRect(anchor.getX(), anchor.getY(), anchor.getWidth(), pxHeight);
+ anchor.setRect(anchor.getX(), anchor.getY(), anchor.getWidth(), height);
} else {
- anchor.setRect(anchor.getX(), anchor.getY()+dy, anchor.getWidth(), pxHeight);
+ anchor.setRect(anchor.getX(), anchor.getY()+dy, anchor.getWidth(), anchor.getHeight());
}
- cells[i][j].setAnchor(anchor);
+ c.setAnchor(anchor);
}
}
Rectangle2D tblanchor = getAnchor();
tblanchor.setRect(tblanchor.getX(), tblanchor.getY(), tblanchor.getWidth(), tblanchor.getHeight() + dy);
setExteriorAnchor(tblanchor);
-
}
@Override
}
private void updateRowHeightsProperty() {
- AbstractEscherOptRecord opt = getEscherOptRecord();
+ AbstractEscherOptRecord opt = getEscherChild(RecordTypes.EscherUserDefined.typeID);
EscherArrayProperty p = opt.lookup(EscherProperties.GROUPSHAPE__TABLEROWPROPERTIES);
byte[] val = new byte[4];
for (int rowIdx = 0; rowIdx < cells.length; rowIdx++) {