Position cursor at start/end of Word document

后端 未结 9 774
误落风尘
误落风尘 2020-12-11 16:39

We are manipulating our Word 2007 documents from .Net using Word Interop. Mostly doing stuff with fields as in:

For Each f In d.Fields
    f.Select()
    //d         


        
9条回答
  •  粉色の甜心
    2020-12-11 17:00

    I'm not sure I'm using the same environment as you, but to go to the start or end of the document here's what works for me:

    Private Sub moveCursorToStartOfDocument()
        w.Selection.HomeKey(WdUnits.wdStory, Nothing)
    End Sub
    
    Private Sub moveCursorToEndOfDocument()
        w.Selection.EndKey(WdUnits.wdStory, Nothing)
    End Sub
    

提交回复
热议问题