Function Go(inBLOB)

MsgBox inBlob

Self.Add "Panel5", "TPanel"
 Panel5.Align="alTop"
 Panel5.Height=45
Panel5.Caption=" "
GO = ""
end function


Sub main ()
'      Self.Visible=true
      set  Database=MainForm.Controls("Database")



   Self.Add "Trans","TIBTransaction"
   Trans.DefaultDatabase=Database


  Self.Add "Query", "TIBQuery"
  With Query
    .Database=DataBase
    .SQL.Clear
    .SQL.Add "select * from fullvipiska"
    .Active=true
    End With
  Self.Add "Data", "TDatasource"
  Data.DataSet=Query

  Self.Add "Panel", "TPanel"
   Panel.Align="alTop"
   Panel.Height=45
   Panel.Caption=""


  Self.Add "Grid", "TDBGridEh"
   Grid.Align="alClient"
   Grid.Datasource=Data

   Panel.Add "Btn","TButton",TRUE
          Btn.Left=10
          Btn.Top=4
          Btn.Width=100
          Btn.Caption=""
End Sub

Sub Btn_OnClick()

Dim FS
Dim ts
Dim s
Dim i

set FS=CreateObject("word.basic")
fs.AppShow
fs.filenew
i=0

Query.disablecontrols
s=""
do while not Query.Eof
s=s+Query.FieldByNamestring("sum") & "   "+Query.FieldByNamestring("pdocdate") & chr(13)
Query.Next
i=i+1
if i>10 then
   fs.Insert  s
   s=""
   i=0
end if
loop 
 fs.Insert  s
Query.enablecontrols

SET FS=nothing

end sub
