取得word文件的总页数和当前页数

object fileName2 = "e:\\11.doc";
object readOnly = false;
object isVisible = true;
object missing = System.Reflection.Missing.Value;
Word.ApplicationClass oWordApp 
= new Word.ApplicationClass();
Word.Document oWordDoc 
= oWordApp.Documents.Open(ref fileName2, ref missing, ref readOnly, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref isVisible, ref missing, ref missing, ref missing, ref missing);
oWordDoc.Activate();
Response.Write(oWordApp.Selection.get_Information(WdInformation.wdActiveEndPageNumber)
+"/");
Response.Write(oWordApp.Selection.get_Information(WdInformation.wdNumberOfPagesInDocument));
posted on 2006-07-31 08:59  Ameng  阅读(778)  评论(1)    收藏  举报