62,025
社区成员
发帖
与我相关
我的任务
分享
Dim app As New Word.Application
Dim obj1 As Object
'打开Word
app.Documents.Open(path.ToString)
obj1 = Word.WdSaveFormat.wdFormatText
Dim i as integer = 1
For Each oDocument As Word.Document In app.Documents
if i > = 3 Andalso i < =5 then
oDocument.SaveAs("D:\Tmp.txt", obj1)
end if
i++
Next
Word.ApplicationClass wordApp=new ApplicationClass();
object file=path;
object nullobj=System.Reflection.Missing.Value;
Word.Document doc = wordApp.Documents.Open(
ref file, ref nullobj, ref nullobj,
ref nullobj, ref nullobj, ref nullobj,
ref nullobj, ref nullobj, ref nullobj,
ref nullobj, ref nullobj, ref nullobj);
doc.ActiveWindow.Selection.WholeStory();
doc.ActiveWindow.Selection.Copy();
IDataObject data=Clipboard.GetDataObject();
txtFileContent.Text=data.GetData(DataFormats.Text).ToString();
doc.Close();
Function GetPageRange(iPage as Integer) as Range
Set GetPageRange = wd.ActiveDocument.Range(0,0)
Set GetPageRange = GetPageRange.Goto(What:=wdGotoPage, Name:=iPage)
Set GetPageRange = GetPageRange.Goto(What:=wdGotoBookmark, Name:="\Page")
End Function