Hi, I am working with an XTextTable and I'm able to create all the cells individually. But I would like to do is to create cells that multiple column spans. Is this possible? I looked through as many mailings as I could but could not find an answer.
Here is my code snippet. //getting the text object XText xText = myDoc.getText(); //create a cursor object XTextCursor xTCursor = xText.createTextCursor(); //getting MSF of the document XMultiServiceFactory xDocMSF = (XMultiServiceFactory) UnoRuntime.queryInterface(XMultiServiceFactory.class, myDoc); //create instance of a text table XTextTable xTT = null; try { Object oInt = xDocMSF.createInstance("com.sun.star.text.TextTable"); xTT = (XTextTable) UnoRuntime.queryInterface(XTextTable.class, oInt); } catch (Exception e) { System.err.println("Couldn't create instance " + e); e.printStackTrace(System.err); } //initialize the text table with 2 rows x 9 columns xTT.initialize(2, 9); XPropertySet xTTRowPS = null; //insert the table try { xText.insertTextContent(xTCursor, xTT, false); // get first Row com.sun.star.container.XIndexAccess xTTRows = xTT.getRows(); xTTRowPS = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, xTTRows.getByIndex(0)); } catch (Exception e) { System.err.println("Couldn't insert the table " + e); e.printStackTrace(System.err); } // write Text in the Table headers System.out.println("Write text in the table headers"); insertIntoCell("A1", "Org / Reviewer", xTT); insertIntoCell("B1", "Page #", xTT); **************************************************************************** ****************** public static void insertIntoCell(String CellName, String theText, XTextTable xTTbl) { XText xTableText = (XText) UnoRuntime.queryInterface(XText.class, xTTbl.getCellByName(CellName)); //create a cursor object com.sun.star.text.XTextCursor xTC = xTableText.createTextCursor(); com.sun.star.beans.XPropertySet xTPS = (com.sun.star.beans.XPropertySet) UnoRuntime.queryInterface(com.sun.star.beans.XPropertySet.class, xTC); try { xTPS.setPropertyValue("CharHeight", new Float(8)); } catch (Exception e) { System.err.println(" Exception " + e); e.printStackTrace(System.err); } //inserting some Text xTableText.setString(theText); } _______________________ Anh-Tuan Le FCI 703.961.1818 x162