testNOGUI
This commit is contained in:
parent
24faf3f65b
commit
7b05dde3e7
@ -43,6 +43,7 @@
|
|||||||
<Linking>
|
<Linking>
|
||||||
<Debugging>
|
<Debugging>
|
||||||
<GenerateDebugInfo Value="False"/>
|
<GenerateDebugInfo Value="False"/>
|
||||||
|
<DebugInfoType Value="dsDwarf3"/>
|
||||||
</Debugging>
|
</Debugging>
|
||||||
<LinkSmart Value="True"/>
|
<LinkSmart Value="True"/>
|
||||||
</Linking>
|
</Linking>
|
||||||
|
59
noguifrdm.lfm
Normal file
59
noguifrdm.lfm
Normal file
@ -0,0 +1,59 @@
|
|||||||
|
object DataModule1: TDataModule1
|
||||||
|
OnCreate = DataModuleCreate
|
||||||
|
OldCreateOrder = False
|
||||||
|
Height = 150
|
||||||
|
HorizontalOffset = 1520
|
||||||
|
VerticalOffset = 216
|
||||||
|
Width = 150
|
||||||
|
object frxReport1: TfrxReport
|
||||||
|
Version = '2024.1.0'
|
||||||
|
DotMatrixReport = False
|
||||||
|
IniFile = '\Software\Fast Reports'
|
||||||
|
PreviewOptions.Buttons = [pbPrint, pbLoad, pbSave, pbExport, pbZoom, pbFind, pbOutline, pbPageSetup, pbTools, pbEdit, pbNavigator, pbExportQuick, pbCopy, pbSelection]
|
||||||
|
PreviewOptions.Zoom = 1
|
||||||
|
PrintOptions.Printer = 'Default'
|
||||||
|
PrintOptions.PrintOnSheet = 0
|
||||||
|
ReportOptions.CreateDate = 45842.4093666667
|
||||||
|
ReportOptions.LastChange = 45842.4093666667
|
||||||
|
ScriptLanguage = 'PascalScript'
|
||||||
|
ScriptText.Strings = (
|
||||||
|
'begin'
|
||||||
|
''
|
||||||
|
'end.'
|
||||||
|
)
|
||||||
|
Left = 42
|
||||||
|
Top = 41
|
||||||
|
Datasets = <>
|
||||||
|
Variables = <>
|
||||||
|
Style = <>
|
||||||
|
end
|
||||||
|
object frxPDFExport1: TfrxPDFExport
|
||||||
|
UseFileCache = True
|
||||||
|
ShowProgress = True
|
||||||
|
OverwritePrompt = False
|
||||||
|
DataOnly = False
|
||||||
|
EmbedFontsIfProtected = False
|
||||||
|
InteractiveFormsFontSubset = 'A-Z,a-z,0-9,#43-#47 '
|
||||||
|
OpenAfterExport = False
|
||||||
|
PrintOptimized = False
|
||||||
|
Outline = False
|
||||||
|
Background = False
|
||||||
|
HTMLTags = True
|
||||||
|
Quality = 95
|
||||||
|
Author = 'FastReport'
|
||||||
|
Subject = 'FastReport PDF export'
|
||||||
|
Creator = 'FastReport'
|
||||||
|
ProtectionFlags = [ePrint, eModify, eCopy, eAnnot]
|
||||||
|
HideToolbar = False
|
||||||
|
HideMenubar = False
|
||||||
|
HideWindowUI = False
|
||||||
|
FitWindow = False
|
||||||
|
CenterWindow = False
|
||||||
|
PrintScaling = False
|
||||||
|
PdfA = False
|
||||||
|
PDFStandard = psNone
|
||||||
|
PDFVersion = pv17
|
||||||
|
Left = 40
|
||||||
|
Top = 109
|
||||||
|
end
|
||||||
|
end
|
49
noguifrdm.pas
Normal file
49
noguifrdm.pas
Normal file
@ -0,0 +1,49 @@
|
|||||||
|
unit noguiFRDM;
|
||||||
|
|
||||||
|
{$mode ObjFPC}{$H+}
|
||||||
|
|
||||||
|
interface
|
||||||
|
|
||||||
|
uses
|
||||||
|
Classes, SysUtils, frxClass, frxExportPDF;
|
||||||
|
|
||||||
|
type
|
||||||
|
|
||||||
|
{ TDataModule1 }
|
||||||
|
|
||||||
|
TDataModule1 = class(TDataModule)
|
||||||
|
frxPDFExport1: TfrxPDFExport;
|
||||||
|
frxReport1: TfrxReport;
|
||||||
|
procedure DataModuleCreate(Sender: TObject);
|
||||||
|
private
|
||||||
|
|
||||||
|
public
|
||||||
|
procedure MakeReport(repFile: string);
|
||||||
|
end;
|
||||||
|
|
||||||
|
var
|
||||||
|
DataModule1: TDataModule1;
|
||||||
|
|
||||||
|
implementation
|
||||||
|
|
||||||
|
{$R *.lfm}
|
||||||
|
|
||||||
|
{ TDataModule1 }
|
||||||
|
|
||||||
|
procedure TDataModule1.DataModuleCreate(Sender: TObject);
|
||||||
|
begin
|
||||||
|
frxReport1.EngineOptions.DestroyForms := False;
|
||||||
|
frxPDFExport1.ShowDialog:=false;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TDataModule1.MakeReport(repFile: string);
|
||||||
|
begin
|
||||||
|
frxReport1.PrepareReport(False);
|
||||||
|
frxPDFExport1.ShowDialog := false;
|
||||||
|
frxPDFExport1.FileName:=repFile;
|
||||||
|
frxPDFExport1.ShowProgress := false;
|
||||||
|
frxReport1.Export(frxPDFExport1);
|
||||||
|
end;
|
||||||
|
|
||||||
|
end.
|
||||||
|
|
94
testNoGUI.lpi
Normal file
94
testNoGUI.lpi
Normal file
@ -0,0 +1,94 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<CONFIG>
|
||||||
|
<ProjectOptions>
|
||||||
|
<Version Value="12"/>
|
||||||
|
<PathDelim Value="\"/>
|
||||||
|
<General>
|
||||||
|
<Flags>
|
||||||
|
<MainUnitHasCreateFormStatements Value="False"/>
|
||||||
|
<MainUnitHasTitleStatement Value="False"/>
|
||||||
|
<MainUnitHasScaledStatement Value="False"/>
|
||||||
|
</Flags>
|
||||||
|
<SessionStorage Value="InProjectDir"/>
|
||||||
|
<Title Value="My Application"/>
|
||||||
|
<UseAppBundle Value="False"/>
|
||||||
|
<ResourceType Value="res"/>
|
||||||
|
</General>
|
||||||
|
<MacroValues Count="1">
|
||||||
|
<Macro1 Name="LCLWidgetType" Value="nogui"/>
|
||||||
|
</MacroValues>
|
||||||
|
<BuildModes>
|
||||||
|
<Item Name="Default" Default="True"/>
|
||||||
|
<SharedMatrixOptions Count="1">
|
||||||
|
<Item1 ID="606617664690" Modes="Default" Type="IDEMacro" MacroName="LCLWidgetType" Value="nogui"/>
|
||||||
|
</SharedMatrixOptions>
|
||||||
|
</BuildModes>
|
||||||
|
<PublishOptions>
|
||||||
|
<Version Value="2"/>
|
||||||
|
<UseFileFilters Value="True"/>
|
||||||
|
</PublishOptions>
|
||||||
|
<RunParams>
|
||||||
|
<FormatVersion Value="2"/>
|
||||||
|
</RunParams>
|
||||||
|
<RequiredPackages>
|
||||||
|
<Item>
|
||||||
|
<PackageName Value="frxe_lazarus"/>
|
||||||
|
</Item>
|
||||||
|
<Item>
|
||||||
|
<PackageName Value="fr_lazarus"/>
|
||||||
|
</Item>
|
||||||
|
<Item>
|
||||||
|
<PackageName Value="frLocalizationLibrary"/>
|
||||||
|
</Item>
|
||||||
|
<Item>
|
||||||
|
<PackageName Value="frGraphicsLibrary"/>
|
||||||
|
</Item>
|
||||||
|
<Item>
|
||||||
|
<PackageName Value="frCoreLibrary"/>
|
||||||
|
</Item>
|
||||||
|
</RequiredPackages>
|
||||||
|
<Units>
|
||||||
|
<Unit>
|
||||||
|
<Filename Value="testNoGUI.lpr"/>
|
||||||
|
<IsPartOfProject Value="True"/>
|
||||||
|
</Unit>
|
||||||
|
<Unit>
|
||||||
|
<Filename Value="noguifrdm.pas"/>
|
||||||
|
<IsPartOfProject Value="True"/>
|
||||||
|
<ComponentName Value="DataModule1"/>
|
||||||
|
<HasResources Value="True"/>
|
||||||
|
<ResourceBaseClass Value="DataModule"/>
|
||||||
|
<UnitName Value="noguiFRDM"/>
|
||||||
|
</Unit>
|
||||||
|
</Units>
|
||||||
|
</ProjectOptions>
|
||||||
|
<CompilerOptions>
|
||||||
|
<Version Value="11"/>
|
||||||
|
<PathDelim Value="\"/>
|
||||||
|
<Target>
|
||||||
|
<Filename Value="testNoGUI"/>
|
||||||
|
</Target>
|
||||||
|
<SearchPaths>
|
||||||
|
<IncludeFiles Value="$(ProjOutDir)"/>
|
||||||
|
<UnitOutputDirectory Value="lib\$(TargetCPU)-$(TargetOS)"/>
|
||||||
|
</SearchPaths>
|
||||||
|
<Linking>
|
||||||
|
<Debugging>
|
||||||
|
<DebugInfoType Value="dsDwarf3"/>
|
||||||
|
</Debugging>
|
||||||
|
</Linking>
|
||||||
|
</CompilerOptions>
|
||||||
|
<Debugging>
|
||||||
|
<Exceptions>
|
||||||
|
<Item>
|
||||||
|
<Name Value="EAbort"/>
|
||||||
|
</Item>
|
||||||
|
<Item>
|
||||||
|
<Name Value="ECodetoolError"/>
|
||||||
|
</Item>
|
||||||
|
<Item>
|
||||||
|
<Name Value="EFOpenError"/>
|
||||||
|
</Item>
|
||||||
|
</Exceptions>
|
||||||
|
</Debugging>
|
||||||
|
</CONFIG>
|
91
testNoGUI.lpr
Normal file
91
testNoGUI.lpr
Normal file
@ -0,0 +1,91 @@
|
|||||||
|
program testNoGUI;
|
||||||
|
|
||||||
|
{$mode objfpc}{$H+}
|
||||||
|
|
||||||
|
uses
|
||||||
|
{$IFDEF UNIX}
|
||||||
|
cthreads,
|
||||||
|
{$ENDIF}
|
||||||
|
Classes, SysUtils, CustApp,
|
||||||
|
Interfaces,
|
||||||
|
frxClass,frxExportPDF, frxExportODF, frxExportHTML,
|
||||||
|
frxExportHTMLDiv, noguiFRDM
|
||||||
|
{ you can add units after this };
|
||||||
|
|
||||||
|
type
|
||||||
|
|
||||||
|
{ TMyApplication }
|
||||||
|
|
||||||
|
TMyApplication = class(TCustomApplication)
|
||||||
|
protected
|
||||||
|
procedure DoRun; override;
|
||||||
|
public
|
||||||
|
constructor Create(TheOwner: TComponent); override;
|
||||||
|
destructor Destroy; override;
|
||||||
|
procedure WriteHelp; virtual;
|
||||||
|
end;
|
||||||
|
|
||||||
|
{ TMyApplication }
|
||||||
|
|
||||||
|
procedure TMyApplication.DoRun;
|
||||||
|
var
|
||||||
|
ErrorMsg: String;
|
||||||
|
begin
|
||||||
|
// quick check parameters
|
||||||
|
|
||||||
|
ErrorMsg:=CheckOptions('h', 'help');
|
||||||
|
if ErrorMsg<>'' then begin
|
||||||
|
ShowException(Exception.Create(ErrorMsg));
|
||||||
|
Terminate;
|
||||||
|
Exit;
|
||||||
|
end;
|
||||||
|
|
||||||
|
// parse parameters
|
||||||
|
if HasOption('h', 'help') then begin
|
||||||
|
WriteHelp;
|
||||||
|
Terminate;
|
||||||
|
Exit;
|
||||||
|
end;
|
||||||
|
writeln('Started');
|
||||||
|
readln;
|
||||||
|
DataModule1 := TDataModule1.Create(self);
|
||||||
|
try
|
||||||
|
writeln('DM Created');
|
||||||
|
DataModule1.MakeReport('test.pdf');
|
||||||
|
writeln('Export Complete');
|
||||||
|
readln;
|
||||||
|
{ add your program here }
|
||||||
|
finally
|
||||||
|
DataModule1.Free;
|
||||||
|
end;
|
||||||
|
|
||||||
|
// stop program loop
|
||||||
|
Terminate;
|
||||||
|
end;
|
||||||
|
|
||||||
|
constructor TMyApplication.Create(TheOwner: TComponent);
|
||||||
|
begin
|
||||||
|
inherited Create(TheOwner);
|
||||||
|
StopOnException:=True;
|
||||||
|
end;
|
||||||
|
|
||||||
|
destructor TMyApplication.Destroy;
|
||||||
|
begin
|
||||||
|
inherited Destroy;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TMyApplication.WriteHelp;
|
||||||
|
begin
|
||||||
|
{ add your help code here }
|
||||||
|
writeln('Usage: ', ExeName, ' -h');
|
||||||
|
end;
|
||||||
|
|
||||||
|
var
|
||||||
|
Application: TMyApplication;
|
||||||
|
begin
|
||||||
|
Application:=TMyApplication.Create(nil);
|
||||||
|
Application.Title:='My Application';
|
||||||
|
Application.Run;
|
||||||
|
Application.Free;
|
||||||
|
end.
|
||||||
|
|
Loading…
Reference in New Issue
Block a user