protected override int GetTagOrder(OpenXmlElement element)
        {
            // I don't want to hard-code the sequence number of the child elements of a RunProperties.
            // I prefer relying on the OpenXml API and use a bit Reflection.
            if (getTagOrderHandler == null)
            {
                var mi = typeof(OpenXmlCompositeElement)
                         .GetMethod("GetSequenceNumber", System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.NonPublic);

                // We use a dummy new TableProperties instance
                // Create a delegate to speed up the invocation to the GetSequenceNumber method
                getTagOrderHandler = (GetSequenceNumberHandler)
                                     Delegate.CreateDelegate(typeof(GetSequenceNumberHandler), new TableProperties(), mi, true);
            }

            return((int)getTagOrderHandler.DynamicInvoke(element));
        }
Example #2
0
        protected override int GetTagOrder(OpenXmlElement element)
        {
            // I don't want to hard-code the sequence number of the child elements of a RunProperties.
            // I prefer relying on the OpenXml API and use a bit Reflection.
            if (getTagOrderHandler == null)
            {
                var mi = typeof(OpenXmlCompositeElement)
                    .GetMethod("GetSequenceNumber", System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.NonPublic);

                // We use a dummy new TableProperties instance
                // Create a delegate to speed up the invocation to the GetSequenceNumber method
                getTagOrderHandler = (GetSequenceNumberHandler)
                    Delegate.CreateDelegate(typeof(GetSequenceNumberHandler), new TableProperties(), mi, true);
            }

            return (int) getTagOrderHandler.DynamicInvoke(element);
        }