0 Replies Latest reply on Mar 28, 2013 4:24 AM by AdobeInDesignScriptKiddie

    Exception in rectangle.AssociatedXMLElement

    AdobeInDesignScriptKiddie

      In the InDesign-Document I assigned manually some XMLTags to some rectangles.

      However when I use programmatically AssociatedXMLElement in order to read the XMLTags, I get an exception. Why?

      Is there an easier way to get the XMLTag of rectangles?

       

      C#-Code

       

      foreach (InDesign.Rectangle rectangle in page.Rectangles)

      {           

      XMLItem xmlElement = (XMLItem)rectangle.AssociatedXMLElement; // Exception. Why?                          

      }

       

       

      Exception:

      "Return argument has an invalid type"

       

      Stacktrace:  

      at System.Runtime.Remoting.Proxies.RealProxy.ValidateReturnArg(Object arg, Type paramType)

      at System.Runtime.Remoting.Proxies.RealProxy.PropagateOutParameters(IMessage msg, Object[] outArgs, Object returnValue)

      at System.RuntimeType.ForwardCallToInvokeMember(String memberName, BindingFlags flags, Object target, Int32[] aWrapperTypes, MessageData& msgData)

      at Rectangle.get_AssociatedXMLElement()