|
Tip>Designer |
|
|
Integrating GhostFill into an external application |
|
|
Article #: |
0022 |
|
Contributor: |
Daniel Todes |
|
GF version: |
All |
|
Applies to: |
GhostFill's RTF Filler ActiveX control |
|
Last updated: |
November 6, 2001 |
Description
Integrate GhostFill into an external application using the RTF Filler ActiveX control.
Explanation
The procedures below demonstrate how you can integrate GhostFill into a Visual Basic (VB) application.
Click here for details on how to add the control to a form in VB.
To add the RTF Filler ActiveX control, do the following:
Create a new form in VB.
On the Project menu, click Components. The Components window opens in the Controls tab. Select the GhostFill RTF Filler control.
The control is now visible on the Toolbox toolbar:
Drag the control onto your form.
Click here to view the sample code.
|
NOTE |
|
The sample code below does the following:
|
The VB code will be similar to the following:
|
Private Sub Command1_Click() Dim AssembledOutputString As String 'Load the required template (as an RTF string): RTFFiller1.LoadFromFile ("c:\gfdemo\template.rtf") 'Set GhostFill variables to values stored in your application: RTFFiller1.Variables.Var1 = "xxxx" RTFFiller1.Variables.Var2 = "yyyy" 'etc 'Assemble ("fill") the loaded RTF string: AssembledOutputString = RTFFiller1.Fill() 'Output the result to an rtf document file: Open "c:\gfdemo\outputdocument.rtf" For Output As #1 Print #1, AssembledOutputString Close #1 MsgBox ("Assembly complete!") End Sub
Private Sub RTFFiller1_OnFillError(ByVal ErrNum As Long, ByVal ErrMsg As String, ByVal ErrDetail As String) 'Detail error messages using the "OnFillError" event MsgBox (ErrMsg & " : " & ErrorDetail) End Sub
Private Sub RTFFiller1_OnMissingValue(ByVal VarName As String, Value As Variant, Cancel As Boolean) 'Capture missing variable values on-the-fly using the "OnMissingValue" event Value = InputBox(VarName) Cancel = False End Sub |
|
NOTE |
|