vb.net 怎么选择word中的某一页某一段

csdnxhb2 2020-09-24 11:28:18
各位大佬
vb.net 怎么选择word中的某一页某一段

Dim cuPage As Word.Range
Dim cuParagh As Word.Paragraph

cuPage = myWordDocument.GoTo(wdGoToPage, wdGoToAbsolute, PageIndex) '定位到具体某一页

cuParagh = cuPage.GoTo(wdGoToLine, 1, ParaghIndex)
cuParagh = cuPage.Paragraphs(ParaghIndex) '定位到具体某一段

最后两句代码运行时都出错

但是通过section 好像可以
myWordDocument.Sections(2).Range.Paragraphs(ParaghIndex).LineSpacing

有没有通过页访问该页某段的方法
...全文
428 1 打赏 收藏 转发到动态 举报
写回复
用AI写文章
1 条回复
切换为时间正序
请发表友善的回复…
发表回复
csdnxhb2 2020-09-24
  • 打赏
  • 举报
回复
已经解决了,通过selection来处理 mySelection = app.Selection mySelection.GoTo(wdGoToPage, wdGoToAbsolute, PageIndex) myWordDocument.Bookmarks("\page").Range.Select() result.LineSpacing = mySelection.Range.Paragraphs(ParaghIndex).LineSpacing

5,139

社区成员

发帖
与我相关
我的任务
社区描述
其他开发语言 Office开发/ VBA
社区管理员
  • Office开发/ VBA社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧