From 07a1e558590b0d5aab30370a2ea13138fd91d94c Mon Sep 17 00:00:00 2001 From: Yegor Kozlov Date: Mon, 3 Nov 2008 19:19:39 +0000 Subject: [PATCH] fixed bug #46033: table cells had incorrect text type resulting in corrupted style info git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@710134 13f79535-47bb-0310-9956-ffa450edef68 --- src/scratchpad/src/org/apache/poi/hslf/model/TableCell.java | 4 ++-- .../testcases/org/apache/poi/hslf/model/TestTable.java | 5 +++++ 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/scratchpad/src/org/apache/poi/hslf/model/TableCell.java b/src/scratchpad/src/org/apache/poi/hslf/model/TableCell.java index 7fa69b1d0..71833678a 100755 --- a/src/scratchpad/src/org/apache/poi/hslf/model/TableCell.java +++ b/src/scratchpad/src/org/apache/poi/hslf/model/TableCell.java @@ -56,8 +56,8 @@ public class TableCell extends TextBox { super(parent); setShapeType(ShapeTypes.Rectangle); - _txtrun.setRunType(TextHeaderAtom.HALF_BODY_TYPE); - _txtrun.getRichTextRuns()[0].setFlag(false, 0, false); + //_txtrun.setRunType(TextHeaderAtom.HALF_BODY_TYPE); + //_txtrun.getRichTextRuns()[0].setFlag(false, 0, false); } protected EscherContainerRecord createSpContainer(boolean isChild){ diff --git a/src/scratchpad/testcases/org/apache/poi/hslf/model/TestTable.java b/src/scratchpad/testcases/org/apache/poi/hslf/model/TestTable.java index 7202ff345..8a9cf7da2 100755 --- a/src/scratchpad/testcases/org/apache/poi/hslf/model/TestTable.java +++ b/src/scratchpad/testcases/org/apache/poi/hslf/model/TestTable.java @@ -24,6 +24,7 @@ import java.awt.geom.Rectangle2D; import org.apache.poi.hslf.usermodel.SlideShow; import org.apache.poi.hslf.HSLFSlideShow; +import org.apache.poi.hslf.record.TextHeaderAtom; /** * Test Table object. @@ -43,6 +44,10 @@ public class TestTable extends TestCase { Table tbl = new Table(2, 5); slide.addShape(tbl); + TableCell cell = tbl.getCell(0, 0); + //table cells have type=TextHeaderAtom.OTHER_TYPE, see bug #46033 + assertEquals(TextHeaderAtom.OTHER_TYPE, cell.getTextRun().getRunType()); + assertTrue(slide.getShapes()[0] instanceof Table); Table tbl2 = (Table)slide.getShapes()[0]; assertEquals(tbl.getNumberOfColumns(), tbl2.getNumberOfColumns());