** mztolo 2007 ** membuat table di word dg OA #DEFINE wdStory 6 #DEFINE wdCollapseEnd 0 #DEFINE CR CHR(13) #DEFINE wdBorderTop -1 #DEFINE wdLineStyleDouble 7 #DEFINE wdAlignParagraphLeft 0 #DEFINE wdAlignParagraphCenter 1 #DEFINE wdAlignParagraphRight 2 SET TALK OFF RELEASE ALL LIKE o* CLEAR CREATE CURSOR mz(kode c(10), nama c(50) ) INSERT INTO mz(kode,nama) VALUES ('001','Tolo' ) INSERT INTO mz(kode,nama) VALUES ('002','Tini' ) PUBLIC oWord LOCAL oRange, oTable, nRecCount LOCAL nRow oWord = CreateObject("Word.Application" ) oWord.Documents.Add() nRecCount = RECCOUNT('mz' ) oRange = oWord.ActiveDocument.Range() oRange.Font.Name = "Arial" SELECT mz GO top oRange.Font.Size = 12 oRange.MoveEnd( wdStory ) oRange.Collapse( wdCollapseEnd ) oRange.InsertAfter( CR + CR ) oRange.Collapse( wdCollapseEnd ) oTable = oWord.ActiveDocument.Tables.Add( oRange, 2, 2) WITH oTable .Borders.InsideLineStyle = .F. .Borders.OutsideLineStyle = .F. .Rows[1].Shading.Texture = 100 .Cell[1,1].Range.ParagraphFormat.Alignment = wdAlignParagraphRight .Cell[1,1].Range.InsertAfter("Kode" ) .Cell[1,2].Range.ParagraphFormat.Alignment = wdAlignParagraphLeft .Cell[1,2].Range.InsertAfter("Nama" ) FOR nRow = 1 TO nRecCount WITH .Rows[nRow + 1 ] .Cells[1].Range.InsertAfter(kode) .Cells[2].Range.InsertAfter(nama) ENDWITH .Rows.Add() SKIP ENDFOR .Columns.Autofit ENDWITH USE IN mz oWord.visible=.t. oWord.Activate() oWord.ActiveDocument.SaveAs("c:mz.DOC" ) RETURN