Vb.net 如何使Word加载项创建一个可在以后编辑的表?
我正在尝试制作一个Microsoft Word加载项,该加载项在当前选定的位置生成一个表,并且这样做的方式可以在以后引用和编辑该表。到目前为止,我一直在使用office.interop。到目前为止,我的实验代码如下:Vb.net 如何使Word加载项创建一个可在以后编辑的表?,vb.net,ms-word,openxml,office-interop,Vb.net,Ms Word,Openxml,Office Interop,我正在尝试制作一个Microsoft Word加载项,该加载项在当前选定的位置生成一个表,并且这样做的方式可以在以后引用和编辑该表。到目前为止,我一直在使用office.interop。到目前为止,我的实验代码如下: Public Sub onTestButton1(ByVal control As Office.IRibbonControl) Dim oWord As Word.Application = Globals.ThisAddIn.Application Dim cu
Public Sub onTestButton1(ByVal control As Office.IRibbonControl)
Dim oWord As Word.Application = Globals.ThisAddIn.Application
Dim currentDocument As Word.Document = oWord.ActiveDocument
Dim oTable As Word.Table
Dim extentedDocument As Document = currentDocument.GetVstoObject()
richTextControl1 = extentedDocument.Controls.AddRichTextContentControl("richTextControl1")
richTextControl1.Title = "testTable"
oTable = currentDocument.Tables.Add(richTextControl1.Range, 2, 2)
End Sub
这段代码的结果是一个内容控件包装的表,除了在内容控件内的表的上方和下方插入一个换行符外,一切正常。如何在没有这些换行符的情况下实现这一点?首先插入表格,然后使用其范围插入控件