Split property of word Document RRS feed

  • Question

  • Hi,

    I am working with word document where i used Interop split property. For my interop word object I made split property to true.

    Microsoft.Office.Interop.Word.ActiveWindow.Split = true; 

    I have added few bookmarks to the document and when i click any of the bookmarks either one of the window, where mouse cursor is there will show that particular range where bookmark is inserted. But i want to see both windows(top and lower panes which are showing up in document after making split=true) to show the bookmark inserted. 

    Can any one suggest me how do I make both top and lower windows of the word document active at a time and make both windows to navigate to the bookmark clicked.



    Tuesday, March 12, 2019 12:18 PM

All replies

  • Each of the new Windows is a "Pane"

    Suppose you want to display the text marked by bookmark "mybm" in each Pane. In principle it ought to be possible to do this  (I'm quoting the VBA, which you should be able to translate into the .NET code you have)

    Sub adjustpanes()
    With ActiveWindow
     .Panes(1).Selection.GoTo wdGoToBookmark, , , "mybm"
     .Panes(2).Selection.GoTo wdGoToBookmark, , , "mybm"
    End With
    End Sub

    However, when testing in Word 365 on Windows that does not always work and I see some behaviour which does not make sense to me. For example, sometimes the bookmarked text does not appear in one of the panes. Worse, despite the fact that .Panes.Count always evaluates to 2, sometimes you have to use .Panes(1) and .Panes(3) to achieve the same thing. In that case it usually seems to be possible to reference .Panes(1) to .Panes(5) without Word throwing an error. Perhaps someone else can chip in.

    Peter Jamieson

    Friday, March 15, 2019 12:51 PM