On 10/21/08 15:59, Hardie82 wrote:
Hi. I have a problem with updating my toc. I have a template-file which i
fill with chapters. In this template there is a toc included. Now after
filling the document i want to update the toc. Therefore i tried following
code:
192 private void refreshIndex() throws Exception
193 {
194 XMultiServiceFactory xMSF =
(XMultiServiceFactory)UnoRuntime.queryInterface(XMultiServiceFactory.class,
this.ooDoc);
195 Object oContentIndex =
xMSF.createInstance("com.sun.star.text.ContentIndex");
196 XDocumentIndex xDocIndex =
(XDocumentIndex)UnoRuntime.queryInterface(XDocumentIndex.class,
oContentIndex);
197 xDocIndex.update();
198 }
I got the following Exception:
Exception in thread "main" com.sun.star.uno.RuntimeException:
at
com.sun.star.lib.uno.environments.remote.Job.remoteUnoRequestRaisedException(Job.java:187)
at com.sun.star.lib.uno.environments.remote.Job.execute(Job.java:153)
at
com.sun.star.lib.uno.environments.remote.JobQueue.enter(JobQueue.java:349)
at
com.sun.star.lib.uno.environments.remote.JobQueue.enter(JobQueue.java:318)
at
com.sun.star.lib.uno.environments.remote.JavaThreadPool.enter(JavaThreadPool.java:106)
at
com.sun.star.lib.uno.bridges.java_remote.java_remote_bridge.sendRequest(java_remote_bridge.java:657)
at
com.sun.star.lib.uno.bridges.java_remote.ProxyFactory$Handler.request(ProxyFactory.java:159)
at
com.sun.star.lib.uno.bridges.java_remote.ProxyFactory$Handler.invoke(ProxyFactory.java:141)
at $Proxy30.update(Unknown Source)
at org.saxsys.excelchecker.DOCWriter.refreshIndex(DOCWriter.java:197)
at org.saxsys.excelchecker.DOCWriter.createDocument(DOCWriter.java:93)
at org.saxsys.excelchecker.Main.<init>(Main.java:93)
at org.saxsys.excelchecker.Main.main(Main.java:23)
What's the problem with it?
The problem is that the OOo code executed upon your call to
xDocIndex.update() throws a UNO RuntimeException (for which it does not
set a Message). No idea why that happens (creating a "naked"
ContentIndex outside the context of a writer document looks suspicious;
but I am not familiar with the writer UNO API).
-Stephan
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]