PUBLIC oform1
oform1=NEWOBJECT("form1")
oform1.Show
RETURN
DEFINE CLASS form1 AS form
Top = 0
Left = 0
Height = _screen.height - 2
Width = _screen.width - 2
DoCreate = .T.
Caption = "Word Document"
Name = "Form1"
WindowState = 2
ADD OBJECT txtframe AS textbox WITH ;
Enabled = .F., ;
Height = _screen.height - 2 , ;
Left = 4, ;
ReadOnly = .T., ;
Top = 4, ;
Width = _screen.width - 2, ;
Name = "txtFrame"
PROCEDURE Init
lcDoc = GETFILE('doc')
oForm = THISFORM
IF Vartype(oForm.oWordDoc)="O"
oForm.removeObject("oWordDoc")
CLEAR CLASS oleWordObject
ENDIF
oForm.AddObject('oWordDoc','oleWordObject')
oForm.oWordDoc.Height = THISFORM.txtFrame.height
oForm.oWordDoc.Width = THISFORM.txtFrame.width
oForm.oWordDoc.Top = THISFORM.txtFrame.top
oForm.oWordDoc.Left = THISFORM.txtFrame.left
oForm.oWordDoc.Visible = .t.
oForm.Show
oForm.oWordDoc.DoVerb(0)
ENDPROC
ENDDEFINE
DEFINE CLASS oleWordObject as OLEControl
OleClass ="Word.Document" && Server name
DocumentFile = lcDoc
ENDDEFINE
Niciun comentariu:
Trimiteți un comentariu