#ifdef _WIN32
#define TECIT_DLLIMPORT
#include "TFormer7.h"
#undef TECIT_DLLIMPORT
#else
#define TECIT_DLLIMPORT
#define _TEC_UNIX
#define TEC_UNIX_BUILD
#include <TECITStd/TECITStd.h>
#include <TFormer7.h>
#undef TECIT_DLLIMPORT
#undef TECIT_DLLIMPORT
#undef _TEC_UNIX
#undef TEC_UNIX_BUILD
#endif
ERRCODE ConnectToStandAloneForm (HTFORM hTForm)
{
eCode =
TFormer_SetRepositoryName (hTForm,
"C:/Documents and Settings/All Users/Application Data/TEC-IT/TFORMer/7.5/Examples/Command Line/ODBCReportPDF/ODBCReportPDF.tff");
return eCode;
}
ERRCODE ConnectToRepositoryBasedForm (HTFORM hTForm)
{
eCode =
TFormer_SetRepositoryName (hTForm,
"C:/Documents and Settings/All Users/Application Data/TEC-IT/TFORMer/7.5/Examples/Demo Repository/Demos.tfr");
return eCode;
}
ERRCODE CsvDataSample (HTFORM hTForm)
{
return eCode;
}
ERRCODE OdbcDataSample (HTFORM hTForm)
{
eCode =
TFormer_SetRepositoryName (hTForm,
"C:/Documents and Settings/All Users/Application Data/TEC-IT/TFORMer/7.5/Examples/Command Line/ODBCReportPDF/ODBCReportPDF.tff");
eCode =
TFormer_SetODBCData (hTForm,
"DSN=TFORMer_Sample",
"",
"",
"SELECT * FROM tbl_Example");
return eCode;
}
ERRCODE DataSourceDataSample (HTFORM hTForm)
{
TFormer_SetRepositoryName (hTForm,
"C:/Documents and Settings/All Users/Application Data/TEC-IT/TFORMer/7.5/Templates/(6) Samples_Picking List.tff");
return eCode;
}
ERRCODE UseRecordSetData (HTFORM hTForm)
{
return eCode;
}
{
return eCode;
}
{
return eCode;
}
ERRCODE UseOdbcData (HTFORM hTForm)
{
hTForm,
"DSN=TFORMer_Sample",
NULL,
NULL,
"SELECT * FROM tbl_Example"
);
return eCode;
}
ERRCODE UseOdbcDataDSN (HTFORM hTForm)
{
eCode =
TFormer_SetODBCData (hTForm,
"DSN=TFORMer_Sample",
"",
"",
"SELECT * FROM tbl_Example");
return eCode;
}
ERRCODE UseDataSourceData (HTFORM hTForm)
{
return eCode;
}
ERRCODE IterateUsedDataFields (HTFORM hTForm, LPCSTR pszProjectName)
{
BOOL bProjectVarValid = (it != NULL);
LPCSTR pszDataFieldName = NULL;
if (eCode == TYPE_E_ELEMENTNOTFOUND)
while (bProjectVarValid && (eCode ==
ErrOk))
{
{
if (pszDataFieldName != NULL && eCode ==
ErrOk)
printf (" %s\n", pszDataFieldName);
}
}
return eCode;
}
ERRCODE PrintToPrinter (HTFORM hTForm)
{
LPCSTR pszPrinterName = NULL;
return eCode;
}
{
return eCode;
}
ERRCODE SetPrinterTypePdf (HTFORM hTForm)
{
return eCode;
}
void PrintToStream()
{
}
ERRCODE __stdcall StreamCallback (BYTE* pBuffer, INT nSizeBuffer, DWORD dwFlags, LPARAM lParam)
{
{
}
{
}
{
}
return eCode;
}
ERRCODE PrintToStreams(HTFORM hTForm)
{
return eCode;
}
void ReportError (
ERRCODE eCode, HTFORM hTForm, LPCSTR pszFunction)
{
LPCSTR pszErrDescription = NULL;
LPCSTR pszErrSource = NULL;
LPCSTR pszErrInformation = NULL;
return;
if (pszFunction)
printf ("Error in %s\n", pszFunction);
printf ("Error : 0x%08x\n", eCode);
if (hTForm)
{
if (pszErrDescription && pszErrDescription[0])
printf("TFError : %s\n", pszErrDescription);
if (pszErrInformation && pszErrInformation[0])
printf("TFInformation : %s\n", pszErrInformation);
if (pszErrSource && pszErrSource[0])
printf("TFSource : %s\n", pszErrSource);
}
}
int main(int argc, char* argv[])
{
HTFORM hTForm = NULL;
if (!hTForm)
return;
printf ("Stand-alone FormLayout samples\n");
printf ("Connect to tff file ...\n");
eCode = ConnectToStandAloneForm (hTForm);
ReportError (eCode, hTForm, "ConnectToStandAloneForm");
{
printf ("Iterate used fields ...\n");
eCode = IterateUsedDataFields (hTForm, NULL);
ReportError (eCode, hTForm, "IterateUsedDataFields");
}
{
printf ("Import data from ODBC ...\n");
eCode = UseOdbcData (hTForm);
ReportError (eCode, hTForm, "UseOdbcData");
}
{
printf ("Print to default printer ...\n");
eCode = PrintToPrinter (hTForm);
ReportError (eCode, hTForm, "PrintToPrinter");
}
{
printf ("Use Stream API ...\n");
eCode = PrintToStreams (hTForm);
ReportError (eCode, hTForm, "PrintToStreams");
}
printf ("\n----------------------\nRepository samples\n");
printf ("Connect to repository ...\n");
eCode = ConnectToRepositoryBasedForm (hTForm);
ReportError (eCode, hTForm, "ConnectToRepositoryBasedForm");
{
printf ("Set some data ...\n");
eCode = UseRecordSetData (hTForm);
ReportError (eCode, hTForm, "UseRecordSetData");
}
{
printf ("Generate PDF ...\n");
eCode = PrintToPdf (hTForm);
ReportError (eCode, hTForm, "PrintToPdf");
}
}