簡體   English   中英

C#互操作詞

[英]C# Interop Word

什么是C#Interop Word等效於單詞宏: varObj.Type = wdInlineShapeEmbeddedOLEObject
以下是我的C#程序的摘錄。 除注釋的行外,其他所有內容均有效。 我是C#的新手,感謝您的幫助。 謝謝。

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
using Microsoft.Win32;
using System.Diagnostics;
using Word = Microsoft.Office.Interop.Word;

namespace FindEmbeddedObjects
{
   class Program
   {
       static void Main(string[] args)
       {

          foreach (var tempLoopVar_varObj in winword.ActiveDocument.InlineShapes)
          {
            //if (varObj.Type = wdInlineShapeEmbeddedOLEObject) // what is the C# equivalent
              fileCount++;
            //}
          }

       }
   }
}

以下幫助嗎?

using Word=Microsoft.Office.Interop.Word;
....
Word.Application wordApp = new Word.Application();
Word.Document document = wordApp.Documents.Open("C:\\myDoc.docx");
int fileCount = 0;

foreach (Word.InlineShape tempLoopVar_varObj in wordApp.ActiveDocument.InlineShapes)
{
    if (tempLoopVar_varObj.Type == Word.WdInlineShapeType.wdInlineShapeEmbeddedOLEObject)
    {
        fileCount++;
    }
}

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM