VB中调用WORD,在WORD中生成表格,如何控制表格位置?
WORD的调用方法(加了个OLE):DimwordAppAsWord.ApplicationDimwordDocAsWord.DocumentDimatableAsWor...
WORD的调用方法(加了个OLE):
Dim wordApp As Word.Application
Dim wordDoc As Word.Document
Dim atable As Word.Table
表格生成的位置一直在WORD文档的开头处,在前面加回车符号也没用。请问高手要如何实现控制表格的位置?又如何去控制文字或者图片插入的位置? 展开
Dim wordApp As Word.Application
Dim wordDoc As Word.Document
Dim atable As Word.Table
表格生成的位置一直在WORD文档的开头处,在前面加回车符号也没用。请问高手要如何实现控制表格的位置?又如何去控制文字或者图片插入的位置? 展开
展开全部
下面的代码是把新建文档里开头的那个表格插入并移动到第5行,不明白的百度HI我
ActiveDocument.Tables.Add Range:=Selection.Range, NumRows:=4, NumColumns:= _
4, DefaultTableBehavior:=wdWord9TableBehavior, AutoFitBehavior:= _
wdAutoFitFixed
With Selection.Tables(1)
If .Style <> "Table Grid" Then
.Style = "Table Grid"
End If
.ApplyStyleHeadingRows = True
.ApplyStyleLastRow = False
.ApplyStyleFirstColumn = True
.ApplyStyleLastColumn = False
End With
Selection.SplitTable
Selection.TypeParagraph
Selection.TypeParagraph
Selection.TypeParagraph
Selection.TypeParagraph
ActiveDocument.Tables.Add Range:=Selection.Range, NumRows:=4, NumColumns:= _
4, DefaultTableBehavior:=wdWord9TableBehavior, AutoFitBehavior:= _
wdAutoFitFixed
With Selection.Tables(1)
If .Style <> "Table Grid" Then
.Style = "Table Grid"
End If
.ApplyStyleHeadingRows = True
.ApplyStyleLastRow = False
.ApplyStyleFirstColumn = True
.ApplyStyleLastColumn = False
End With
Selection.SplitTable
Selection.TypeParagraph
Selection.TypeParagraph
Selection.TypeParagraph
Selection.TypeParagraph
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询
广告 您可能关注的内容 |