Search code examples
c#office-interoplate-binding

parameter type in late-binding


I have reached this final step, where i need to invoke the "PasteAndFormat" method on the objContentLateBinded that I have correctly created, but now I need to pass the "WdRecoveryType.wdFormatOriginalFormatting" value as a parameter. WdRecoveryType is part of the late binded assembly "Microsoft.Office.Interop.Word", so how can use it in my code in place of -parameters-?

here is the row in question:

objContentLateBinded.GetType().InvokeMember("PasteAndFormat", BindingFlags.InvokeMethod, null, objContentLateBinded, -parameters-);

Solution

  • After applying some reflection you can easily find that the value related to that parameter is 16. Just pass it as an integer, this will do the "magic".