; genrep.def : Declares the module parameters for the DLL.
LIBRARY "genrep"
DESCRIPTION 'genrep Windows Dynamic Link Library'
EXPORTS
; Explicit exports can go here
AboutDLL @2
LoadWord @3
RunRepDial @4
RunReport @5
RunRep @6
RunDial @7
LoadWordHLM @8
Параметры
fname - полный путь к шаблону
  (например "..\sab\formats.sab")
isd - флаг
   isd = 0 - работа в текущей папке
   isd = 1 - работа в папке шаблона
   isd = 8 - не показывать прогресс
   isd = 16 - не открывать отчет (Word,Excel)
для объединения параметры сложить
  isd = 1+8+16 - работа в папке шаблона,не показывать прогресс и не открывать отчет
Пример определения и вызова генератора для Visual Foxpro приложений
DECLARE Integer RunRep IN genrep.dll AS Runr String @cName, Integer Isd
DECLARE Integer RunDial IN genrep.dll AS Rund String @cName, Integer Isd =Runr('namefile.sab' , 0+1)
=Rund('namefile.sab' , 0) && работа в текущей папке =Rund('namefile.sab' , 1) && работа в папке шаблона =Runr('namefile.sab' , 0+16) && не вызывать Word =Runr('namefile.sab' , 0+8+16) && не вызывать Word, не показывать Progress Bar
Пример вызова из приложения DOS при помощи dorep.exe
! run "dorep.exe C:\genrep\sab\Standart\dbf\formats.sab"
Пример определения и вызова генератора для Clarion приложений
MODULE('GenRep.lib')
AboutDLL,Name('AboutDLL')
LoadWord(*CString),Pascal,Raw,Name('LoadWord')
! RunRepDial(*CString,Signed),Signed,Pascal,Raw,Name('RunRepDial')
RunDial(*CString,Signed),Signed,Pascal,Raw,Name('RunDial')
RunRep(*CString,Signed),Signed,Pascal,Raw,Name('RunRep')
! RunReport(*CString,Signed),Signed,Pascal,Raw,Name('RunReport')
End Скачать пример (GenRep.lib в примере)
Пример определения и вызова генератора для Visual Basic приложений
genrep.bas:
'Описание функций библиотеки Genrep.dll
Public Declare Function RunDial Lib "genrep.dll" (ByVal SabName As String, ByVal nFlag As Integer) As Integer
Public Declare Function RunRep Lib "genrep.dll" (ByVal SabName As String, ByVal nFlag As Integer) As Integer
Public Declare Sub AboutDLL Lib "genrep.dll" ()
Declare Function OemToCharBuff Lib "user32" Alias "OemToCharBuffA" (ByVal lpszSrc As String, ByVal lpszDst As String, ByVal cchDstLength As Long) As Long
Public Sub Genrep_About()
AboutDLL
End Sub
'Запуск отчета в режиме диалога
Public Sub Genrep_RunDialog(sab As String)
ret = RunDial(sab, 1)
End Sub
'Запуск отчета на выполнение
Public Sub Genrep_RunReport(NameSab As String, ByVal nFlag As Integer)
ret = RunRep(NameSab, nFlag)
End Sub
'OEM to ANSI
Public Function ToAnsi(ByVal S As String) As String
Dim Buffer As String * 1000
OemToCharBuff S, Buffer, Len(S)
ToAnsi = Trim(Buffer)
End Function
'Запись курсора в DBF
Public Sub CreateDbfFromRecordset_VFP(r As ADODB.Recordset, ByVal DbfName As String, DbfFolder As String)
Dim cn As New ADODB.Connection, f As ADODB.Field, S As String, sDbfFile As String
Dim rr As New ADODB.Recordset, i As Integer, ii As Integer
sDbfFile = DbfFolder & DbfName & ".dbf"
On Error Resume Next
GetAttr sDbfFile
If Err.Number = 0 Then Kill sDbfFile
On Error GoTo 0
For Each f In r.Fields
If Len(S) Then S = S & ","
Select Case f.Type
Case adUnsignedTinyInt, adSmallInt, adInteger, adSingle, adDouble, adCurrency, adBoolean
S = S & "" & f.Name & " Integer"
Case adDate
S = S & "" & f.Name & " Date"
Case adVarChar, adVarWChar, adChar, adWChar
S = S & "" & f.Name & " Char(" & f.DefinedSize & ")"
End Select
Next f
rr.Open "SELECT * FROM " & DbfName, cn, adOpenStatic, adLockOptimistic
ii = r.Fields.Count - 1
Do Until r.EOF
rr.AddNew
For i = 0 To ii
rr(i) = r(i)
Next i
rr.Update
r.MoveNext
Loop
End Sub
main.bas:
'Собственно сами вызовы
cst = "Provider=SQLOLEDB.1;User Id=1cReader;Password=123;Initial Catalog=rb;Data Source=Serv_1C"
con.Open cst
Set rst_a = con.Execute("select top 10 Code, Descr from SC6482")
' скидываем в DBF
CreateDbfFromRecordset_VFP rst_a, "temp", "" ' "C:\1CDATA\programm\genrep\"
rst_a.Close
Set rst_a = Nothing
con.Close
' Выводим в RTF
Genrep_RunReport "sab\sprav.sab", 0
Пример определения и вызова генератора для 1С:Предприятие
ИмяФайла=КаталогGenrep + "Genrep1c\temp.dbf";
База = СоздатьОбъект("XBase");
Если ФС.СуществуетФайл(ИмяФайла) = 1 Тогда
ФС.УдалитьФайл(ИмяФайла);
конецесли;