Hi,
As stated in my first email, the exception is NOT thrown at
> XBookmarksSupplier xBookmarksSupplier =(XBookmarksSupplier)mxDocument;
but at
> Object bookmark = xNamedBookmarks.getByName("test");
mxDocument is a XTextDocument and should support the
XBookmarksSupplier-Interface.
Furthermore
> xNamedBookmarks.hasByName("test")
returns true.
Looping through all the bookmarks, which
> xNamedBookmarks.getElementNames()
returned, works as well (gives me all the bookmarks in the document).
I guess, that proves, that mxDocument supports the interface, does it?
The stacktrace is at the end of this mail.
Now I switched to OpenOffice.org 1.9.104 and .NETv1.1.4322, but problem
remains.
If this is the wrong mailing-list for asking such questions, please let
me know (could not find an other one).
thanks
Flo
Hi,
The exception is probably thrown at
> XBookmarksSupplier xBookmarksSupplier = (XBookmarksSupplier)mxDocument;
because your mxDocument object does not have this XBookmarkSupplier
interface. Make sure that the mxDocument interface belongs to an object
that also implements XBookmarksSupplier interface.
Regards,
Jochen
Florian Limberger wrote:
Hi,
While executing the last line of
--------------------------------------------------------------------------
XBookmarksSupplier xBookmarksSupplier = (XBookmarksSupplier)mxDocument;
XNameAccess xNamedBookmarks = xBookmarksSupplier.getBookmarks();
if (xNamedBookmarks.hasByName("test"))
{
Object bookmark = xNamedBookmarks.getByName("test");
}
--------------------------------------------------------------------------
an System.InvalidCastException is thrown.
An unhandled exception of type 'System.InvalidCastException' occurred in
mscorlib.dll.
I'm rather new to UNO and have no idea what's wrong here. The "test"
bookmark exists of course. Even looping through the xNamedBookmarks
elements properly yields all bookmarks, contained in the textDocument.
thx for any hints,
Flo
using OpenOffice.org 1.9.79 with .NETv1.1.4322.
stackTrace:
--------------------------------------------------------------------------
System.InvalidCastException: Das R�ckgabeargument hat einen ung�ltigen Typ.
at
System.Runtime.Remoting.Proxies.RealProxy.ValidateReturnArg(Object arg, Ty
pe paramType)
at
System.Runtime.Remoting.Proxies.RealProxy.PropagateOutParameters(IMessage
msg, Object[] outArgs, Object returnValue)
at
System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage req
Msg, IMessage retMsg)
at
System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgDa
ta, Int32 type)
at unoidl.com.sun.star.container.XNameAccess.getByName(String aName)
at OOTest.TextDocTest.Test() in
d:\media\develop\ootest\textdoctest.cs:line 8
8
at
System.Runtime.Remoting.Proxies.RealProxy.ValidateReturnArg(Object arg, Ty
pe paramType)
at
System.Runtime.Remoting.Proxies.RealProxy.PropagateOutParameters(IMessage
msg, Object[] outArgs, Object returnValue)
at
System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage req
Msg, IMessage retMsg)
at
System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgDa
ta, Int32 type)
at unoidl.com.sun.star.container.XNameAccess.getByName(String aName)
at OOTest.TextDocTest.Test() in
d:\media\develop\ootest\textdoctest.cs:line 8
8
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]