I developed a word addin with MS VSTO. And recently, I try to switch these code into netoffice, and now I encounter some problem.
The first problem:
When I want to load a Word build-in dialog, there are two ways :
Application.CommandBars.FindControl(id:=775).Execute()
Dialogs(wdDialog.wdDialogInsertCrossReference).Show()
Both of them can load InsertCrossReference Dialog correctly, but there is a difference between them. The first one can load the Dialog as a non-modal form, and the second couldn't, even you write like this:
Dialogs(wdDialog.wdDialogInsertCrossReference).Show(0)
Usually, a user defined form could be load as a non-modal form with "show(0)", but in this problem, it doesn't work.
So, here is the problem when I transfer the VSTO code into netoffice.
I try the second method, and it works correctly as a modal form. But, I couldn't find a similar way
like the first method with netoffice.
The second problem:
When I load a user defined form (as a non modal form), I don't know how to link the form class with the current document operation. In the VSTO, I would define Application and Selection in form class as:
I hope someone could help me to solve these problems.
Thanks again!
The first problem:
When I want to load a Word build-in dialog, there are two ways :
Application.CommandBars.FindControl(id:=775).Execute()
Dialogs(wdDialog.wdDialogInsertCrossReference).Show()
Both of them can load InsertCrossReference Dialog correctly, but there is a difference between them. The first one can load the Dialog as a non-modal form, and the second couldn't, even you write like this:
Dialogs(wdDialog.wdDialogInsertCrossReference).Show(0)
Usually, a user defined form could be load as a non-modal form with "show(0)", but in this problem, it doesn't work.
So, here is the problem when I transfer the VSTO code into netoffice.
I try the second method, and it works correctly as a modal form. But, I couldn't find a similar way
like the first method with netoffice.
The second problem:
When I load a user defined form (as a non modal form), I don't know how to link the form class with the current document operation. In the VSTO, I would define Application and Selection in form class as:
Dim Application As Word.Application = Globals.ThisAddIn.Application
Dim Selection As Word.Selection = Globals.ThisAddIn.Application.Selection
Since, there isn't "ThisAddin" in netoffice to present the word application, I define things like this:Dim Application As NetOffice.WordApi.Application = Me.Application
Dim Selection As NetOffice.WordApi.Selection = Me.Application.Selection
When I debug this, there is no error, but it doesn't work. I hope someone could help me to solve these problems.
Thanks again!