Matthias Scholz wrote: >>The OfficeDocument class provides a method "queryInterface(...)" which you >>can use to access the interfaces supported by the TextDocument service. >> >>So, to query for the XTextDocument interface, you'd say: >> >>// Caution! The code below has not been tested and might not even compile. I >>just points into some general direction ;-) >> >>import com.sun.star.bean.OOoBean; >>import com.sun.star.uno.Type; >> >>OOoBean bean = new OOoBean(); >>//...load some document into the bean... >>OfficeDocument doc = bean.getDocument(); >>XTextDocument xTextDocument = doc.queryInterface(new >>Type(XTextDocument.class)); >>//...do something with the document... >> >> > In some sources I have found this possibility: > > xModel = oooBean.getController().getModel(); > xTextDocument = (XTextDocument) > UnoRuntime.queryInterface(XTextDocument.class, xModel); > > Both are running, but what is the difference or what is better???
There is no real difference. The first code example does exactly the same, but hidden behind the getDocument() method. Best regards, Mathias -- Mathias Bauer - OpenOffice.org Application Framework Project Lead Please reply to the list only, [EMAIL PROTECTED] is a spam sink. --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
