私の問題:.docと.odtを読み込み、何らかの操作を行い、pdfに再度エクスポートする必要がある自動システムを作成しました。OOo:UNO(Java)TrackedChanges:文書が隠されているときに追跡された変更を受け入れる(または隠す)方法は?
私は必要なすべてのために正常に動作します現在、私はこの1つまで、すべての問題を解決することができます。ユーザーが変更(朱書き)を記録した文書を提供している場合は
私は自動的に変更するか、またはそれらを隠すことすべてを受け入れる必要。
OOoが画面上に表示されている限り、以下のコードでその問題を解決できます。私がそれを隠すと、私の呼び出しは何もしません。
だから、ここで私は現在、何をすべきかです:私の現在の推測が隠されているので、私はこれを呼び出すことができないということです
// DO NOT try to cast this to Desktop as com.sun.star.frame.Desktop is NOT a valid class!
// keep it as Object and cast it to XDesktop later (via queryInterface)
Object desktop = xMCF.createInstanceWithContext("com.sun.star.frame.Desktop", xContext);
XMultiServiceFactory xFactory = (XMultiServiceFactory) UnoRuntime.queryInterface(
XMultiServiceFactory.class, xMCF);
// what goes for desktop above is valid for DispatchHelper as well.
Object dispatchHelper = xFactory.createInstance("com.sun.star.frame.DispatchHelper");
// the DispatchHelper is the class that handles the interaction with dialogs.
XDispatchHelper helper = (XDispatchHelper) UnoRuntime.queryInterface(
XDispatchHelper.class, dispatchHelper);
XDesktop xDesktop = (XDesktop) UnoRuntime.queryInterface(com.sun.star.frame.XDesktop.class, desktop);
XFrame xFrame = xDesktop.getCurrentFrame();
XDispatchProvider xDispatchProvider = (XDispatchProvider) UnoRuntime.queryInterface(XDispatchProvider.class, xFrame);
// We issute the Track Changes Dialog (Bearbeiten - Änderungen // Edit - Changes) and tell it
// to ACCEPT all changes.
PropertyValue[] acceptChanges = new PropertyValue[1];
acceptChanges[0] = new PropertyValue();
acceptChanges[0].Name = "AcceptTrackedChanges";
acceptChanges[0].Value = Boolean.TRUE;
helper.executeDispatch(xDispatchProvider, ".uno:AcceptTrackedChanges", "", 0, acceptChanges);
// We issue it again to tell it to stop showing changes.
PropertyValue[] showChanges = new PropertyValue[1];
showChanges[0] = new PropertyValue();
showChanges[0].Name = "ShowTrackedChanges";
showChanges[0].Value = Boolean.FALSE;
helper.executeDispatch(xDispatchProvider, ".uno:ShowTrackedChanges", "", 0, showChanges);
、私はに任意のディスパッチャを呼び出すために何のフレームを持っていません。しかし、コンポーネントのDispatcherを取得する方法が見つかりませんでした。
私はすでにTrackChanges
を(FALSE
に)派遣しようとしましたが、どちらもそれをしませんでした。
で見つけることができますが、これまでこの問題を回避しましたか?私はこれを行うための負荷オプションを期待していたが、何もないようだ。 –
@FabianLangeいいえ、私はしませんでした。しかし、GorgiKosevは今日これについて答えを投稿しました。それを試してみませんか? –
この男に恩恵を与える! –