#59686 - Error when trying to access XSLFTableCell properties like textHeight, lineWidth, etc.
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1747605 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
fe44b01cd3
commit
6e477490f9
@ -41,6 +41,7 @@ import org.openxmlformats.schemas.drawingml.x2006.main.CTPoint2D;
|
||||
import org.openxmlformats.schemas.drawingml.x2006.main.CTPositiveSize2D;
|
||||
import org.openxmlformats.schemas.drawingml.x2006.main.CTRegularTextRun;
|
||||
import org.openxmlformats.schemas.drawingml.x2006.main.CTSchemeColor;
|
||||
import org.openxmlformats.schemas.drawingml.x2006.main.CTShapeProperties;
|
||||
import org.openxmlformats.schemas.drawingml.x2006.main.CTSolidColorFillProperties;
|
||||
import org.openxmlformats.schemas.drawingml.x2006.main.CTTable;
|
||||
import org.openxmlformats.schemas.drawingml.x2006.main.CTTableCell;
|
||||
@ -670,6 +671,19 @@ public class XSLFTableCell extends XSLFTextShape implements TableCell<XSLFShape,
|
||||
return new XSLFCellTextParagraph(p, this);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return fake shape properties as a fallback for not overridden
|
||||
* methods of XSLFSimpleShape
|
||||
*
|
||||
* @return fake shape properties
|
||||
*
|
||||
* @since POI 3.15-beta2
|
||||
*/
|
||||
@Override
|
||||
protected CTShapeProperties getSpPr() {
|
||||
return CTShapeProperties.Factory.newInstance();
|
||||
}
|
||||
|
||||
/**
|
||||
* @since POI 3.15-beta2
|
||||
*/
|
||||
|
@ -24,6 +24,7 @@ import static org.junit.Assert.assertSame;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.awt.geom.Rectangle2D;
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
|
||||
@ -172,4 +173,22 @@ public class TestXSLFTable {
|
||||
|
||||
ss2.close();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void checkTextHeight() throws IOException {
|
||||
// from bug 59686
|
||||
XMLSlideShow ppt = new XMLSlideShow();
|
||||
XSLFSlide sl = ppt.createSlide();
|
||||
XSLFTable tab = sl.createTable();
|
||||
tab.setAnchor(new Rectangle2D.Double(50,50,300,50));
|
||||
XSLFTableRow tr = tab.addRow();
|
||||
XSLFTableCell tc0 = tr.addCell();
|
||||
tc0.setText("bla bla bla bla");
|
||||
tab.setColumnWidth(0, 50);
|
||||
|
||||
assertEquals(88, tc0.getTextHeight(), 0);
|
||||
assertEquals(0, tc0.getLineWidth(), 0);
|
||||
|
||||
ppt.close();
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user