Dim ThisDocument As Word.Document
Dim ThisApplication As Word.Application
Dim strDocument As String = "てすと.dot"
ThisApplication = New Word.Application
ThisDocument = ThisApplication.Documents.Add(strDocument, False, 0)
'表を作成する
Dim rng As Word.Range = ThisDocument.Range(Start:=0, End:=0)
Dim objTable1 As Microsoft.Office.Interop.Word.Table = ThisDocument.Tables.Add(Range:=rng, NumRows:=100, NumColumns:=3)
'高さを指定する
ThisDocument.Tables(1).Rows(2).Height = 100
'幅を指定する
objTable1.Columns(1).SetWidth(50, Word.WdRulerStyle.wdAdjustNone)
objTable1.Columns(2).SetWidth(200, Word.WdRulerStyle.wdAdjustNone)
objTable1.Columns(3).SetWidth(50, Word.WdRulerStyle.wdAdjustNone)
objTable1.Cell(1, 2).Range.Text = "あああああああ"
objTable1.Cell(2, 2).Range.Text = " "
'水平位置を変更する。
objTable1.Cell(2, 2).VerticalAlignment = Word.WdCellVerticalAlignment.wdCellAlignVerticalCenter
'位置を取得する
Dim objRange As Microsoft.Office.Interop.Word.Range = objTable1.Cell(2, 2).Range
Dim objTable2 As Microsoft.Office.Interop.Word.Table = ThisDocument.Tables.Add(objRange, 3, 3)
objTable2.Cell(2, 2).Range.Text = "てすとー2"
Dim strAaaa As String = System.Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory) & "\表の中の表.doc"
ThisDocument.SaveAs(strAaaa)
Dim proc As New Process
proc.Start(strAaaa)
|