MS Word Automation in C# - Unable to cast object of type 'System.String[*]' to type 'System.String[]'

后端 未结 3 1736
抹茶落季
抹茶落季 2021-01-04 19:37

I use this code to get a String array of headings used in a MS Word 2007 document (.docx):

dynamic arr = Document.GetCrossReferenceItems(WdReferenceType.wdRe         


        
3条回答
  •  温柔的废话
    2021-01-04 20:11

    try

    object arr_r = Document.GetCrossReferenceItems(WdReferenceType.wdRefTypeHeading);
    Array arr = ((Array) (arr_r));
    
    string myHeading = (string) arr.GetValue(1);
    

提交回复
热议问题