以文本方式查看主题 - Foxtable(狐表) (http://foxtable.net/bbs/index.asp) -- 专家坐堂 (http://foxtable.net/bbs/list.asp?boardid=2) ---- [求助]读取word遗漏 (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=137995) |
||||
-- 作者:天一生水 -- 发布时间:2019/7/19 22:58:00 -- [求助]读取word遗漏 利用下列代码读取word文档,遗漏部分内容,是何原因? Dim dlg As new OpenFileDialog dlg.Filter = "word|*.doc;*.docx" If dlg.ShowDialog = DialogResult.OK Then Dim app As New MSWord.Application try Dim doc = app.Documents.Open(dlg.FileName) Dim count = Doc.Characters.Count Dim rng As MSWord.Range = Doc.Range(Start:=0, End:=count) msgbox(rng.Text) app.quit catch ex As exception msgbox(ex.message) app.quit End try End If 测试word文档中的最后一页没有读取:
|
||||
-- 作者:有点蓝 -- 发布时间:2019/7/19 23:08:00 -- Dim doc = app.Documents.Open(dlg.FileName) Dim rng As MSWord.Range = Doc.Range() Output.Show(rng.Text)
|