Hi,
I am trying to create a table on new slide, below is sample code I am using
Object drawShape = xDrawFactory.createInstance("com.sun.star.drawing.TableShape");
XShape xDrawShape = (XShape)UnoRuntime.queryInterface(XShape.class, drawShape);
xDrawShape.setPosition(new Point(xoffset,150*72));
xDrawShape.setSize(new Size(tblWidth,200*72));
xDrawPageNew.add(xDrawShape);
XPropertySet xPropertyset = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, xDrawShape );
XTable xTable = (XTable) UnoRuntime.queryInterface(XTable.class, xPropertyset.getPropertyValue( "Model" ));
xTable.getRows().insertByIndex(0, rSlideTable.getRows());
xTable.getColumns().insertByIndex(0, rSlideTable.getCols());
// stuff data in table
for(Iterator<ReportSlideTableCell> iter= rSlideTable.getCells().iterator() ; iter.hasNext();)
{
ReportSlideTableCell cell = iter.next();
XCellRange xCellrange = (XCellRange) UnoRuntime.queryInterface( XCellRange.class, xTable );
XCell xCell = xCellrange.getCellByPosition( cell.getRow()-1 , cell.getCol()-1 );
XText xText = (XText) UnoRuntime.queryInterface( XText.class, xCell );
xText.setString( cell.getText());
XTextCursor xTextCursor =xText.createTextCursor();
XPropertySet xCursorProps = UnoRuntime.queryInterface(
XPropertySet.class, xTextCursor);
xCursorProps.setPropertyValue("CharHeight", new Float(11));
}
I am not getting rows with proper height and columns with good width. The text flows vertically. Has anybody created a table on slide.
Thanks,
Ishwar