c# - foreach loop error message -
anyone know why following code:
foreach (word.xmlschemareference reference in globals.thisdocument.application.activedocument) { }
gives me:
error 1 foreach statement cannot operate on variables of type 'microsoft.office.interop.word.document' because 'microsoft.office.interop.word.document' not contain public definition 'getenumerator' c:\program files\microsoft office\templates\projects\project1\project1\actionspanecontrol1.cs 1054 13 project1
i have code in actionpane control in word document level project has been created vs2013 using c# .net 4.0 word 2010.
i trying run following code within loop:
if (reference.namespaceuri.contains("actionspane")) { reference.delete(); }
basically, documents created addin give user message when reopen created document:
one or more xml expansion packs available file. choose 1 list below. no xml expansion pack microsoft actions pane 3
so seems need find reference , delete before user saves document?
the message clear: globals.thisdocument.application.activedocument not implement ienumerable. think looking in active document implements ienumerable of xmlschemareference. check properties globals.thisdocument.application.activedocument.
Comments
Post a Comment