如何在c#.net控制檯應用程序中從單詞獲取特定頁面?從Word獲取特定頁面
我已經嘗試過了,
但不幸的是我有從我的應用程序錯誤。
以下是我的代碼:
{
object what = WdGoToItem.wdGoToPage;
object which = WdGoToDirection.wdGoToFirst;
object count = 0;
const string fileName = @"C:\..\..\test.doc";
object fileNameAsObject = fileName;
Application wordApplication = new Application();
object readOnly = false;
object missing = System.Reflection.Missing.Value;
wordApplication.Documents.Open(ref fileNameAsObject, ref missing, ref readOnly, ref missing,
ref missing, ref missing, ref missing, ref missing,
ref missing, ref missing, ref missing, ref missing,
ref missing, ref missing, ref missing, ref missing);
// here on this following line I have got error "This method or property is not available because this command is not available for reading."
Range startRange = wordApplication.Selection.GoTo(ref what, ref which, ref count, ref missing);
object count2 = (int)count + 1;
Range endRange = wordApplication.Selection.GoTo(ref what, ref which, ref count2, ref missing);
endRange.SetRange(startRange.Start, endRange.End);
endRange.Select();
;
}
所以,請給我提供任何解決方案就可以了.. 在此先感謝..
請給儘可能多的細節儘可能爲您使用此技術有什麼錯誤 – Coops
也?有[微軟的Office Open XML SDK 2.5](http://www.microsoft.com/en-gb/download/details.aspx?id=30425)的喜歡 – Coops