Thread: FoxPro Some General Questions/Microsoft Word - insert table automation

Microsoft Word - insert table automation
LOCAL loWord as Word.Application, loDoc as Word.Document, loTable as Word.Table

loWord = CREATEOBJECT("Word.Application")
loWord.Visible = .T.
loDoc = loWord.Documents.Add()
loTable = loDoc.Tables.Add(loDoc.Range(),1,5)
FOR j=1 TO 5
   FOR i=1 TO 5
      loTable.Cell(j,i).Select()
      loWord.Selection.Text=TRANSFORM(i*j)
   NEXT i
   IF j <> 5
      loTable.Rows.Add()
   ENDIF
NEXT j