You've already forked lazarus-ccr
PowerPDF: Add Lazarus port of DBExample (see: https://forum.lazarus.freepascal.org/index.php/topic,55035.msg409079/topicseen.html).
git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@8052 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
87
components/powerpdf/LazarusExamples/DBExample/DBExample.lpi
Normal file
87
components/powerpdf/LazarusExamples/DBExample/DBExample.lpi
Normal file
@ -0,0 +1,87 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<CONFIG>
|
||||
<ProjectOptions>
|
||||
<Version Value="12"/>
|
||||
<PathDelim Value="\"/>
|
||||
<General>
|
||||
<SessionStorage Value="InProjectDir"/>
|
||||
<Title Value="DBExample"/>
|
||||
<Scaled Value="True"/>
|
||||
<ResourceType Value="res"/>
|
||||
<UseXPManifest Value="True"/>
|
||||
<XPManifest>
|
||||
<DpiAware Value="True"/>
|
||||
</XPManifest>
|
||||
<Icon Value="0"/>
|
||||
</General>
|
||||
<BuildModes>
|
||||
<Item Name="Default" Default="True"/>
|
||||
</BuildModes>
|
||||
<PublishOptions>
|
||||
<Version Value="2"/>
|
||||
<UseFileFilters Value="True"/>
|
||||
</PublishOptions>
|
||||
<RunParams>
|
||||
<FormatVersion Value="2"/>
|
||||
</RunParams>
|
||||
<RequiredPackages>
|
||||
<Item>
|
||||
<PackageName Value="FCL"/>
|
||||
</Item>
|
||||
<Item>
|
||||
<PackageName Value="pack_powerpdf"/>
|
||||
</Item>
|
||||
<Item>
|
||||
<PackageName Value="LCL"/>
|
||||
</Item>
|
||||
</RequiredPackages>
|
||||
<Units>
|
||||
<Unit>
|
||||
<Filename Value="DBExample.lpr"/>
|
||||
<IsPartOfProject Value="True"/>
|
||||
</Unit>
|
||||
<Unit>
|
||||
<Filename Value="udbexample.pas"/>
|
||||
<IsPartOfProject Value="True"/>
|
||||
<ComponentName Value="Form1"/>
|
||||
<HasResources Value="True"/>
|
||||
<ResourceBaseClass Value="Form"/>
|
||||
<UnitName Value="UDBExample"/>
|
||||
</Unit>
|
||||
</Units>
|
||||
</ProjectOptions>
|
||||
<CompilerOptions>
|
||||
<Version Value="11"/>
|
||||
<PathDelim Value="\"/>
|
||||
<Target>
|
||||
<Filename Value="DBExample"/>
|
||||
</Target>
|
||||
<SearchPaths>
|
||||
<IncludeFiles Value="$(ProjOutDir)"/>
|
||||
<UnitOutputDirectory Value="lib\$(TargetCPU)-$(TargetOS)"/>
|
||||
</SearchPaths>
|
||||
<Linking>
|
||||
<Debugging>
|
||||
<DebugInfoType Value="dsDwarf2Set"/>
|
||||
</Debugging>
|
||||
<Options>
|
||||
<Win32>
|
||||
<GraphicApplication Value="True"/>
|
||||
</Win32>
|
||||
</Options>
|
||||
</Linking>
|
||||
</CompilerOptions>
|
||||
<Debugging>
|
||||
<Exceptions>
|
||||
<Item>
|
||||
<Name Value="EAbort"/>
|
||||
</Item>
|
||||
<Item>
|
||||
<Name Value="ECodetoolError"/>
|
||||
</Item>
|
||||
<Item>
|
||||
<Name Value="EFOpenError"/>
|
||||
</Item>
|
||||
</Exceptions>
|
||||
</Debugging>
|
||||
</CONFIG>
|
25
components/powerpdf/LazarusExamples/DBExample/DBExample.lpr
Normal file
25
components/powerpdf/LazarusExamples/DBExample/DBExample.lpr
Normal file
@ -0,0 +1,25 @@
|
||||
program DBExample;
|
||||
|
||||
{$mode objfpc}{$H+}
|
||||
|
||||
uses
|
||||
{$IFDEF UNIX}
|
||||
cthreads,
|
||||
{$ENDIF}
|
||||
{$IFDEF HASAMIGA}
|
||||
athreads,
|
||||
{$ENDIF}
|
||||
Interfaces, // this includes the LCL widgetset
|
||||
Forms, UDBExample, pack_powerpdf
|
||||
{ you can add units after this };
|
||||
|
||||
{$R *.res}
|
||||
|
||||
begin
|
||||
RequireDerivedFormResource:=True;
|
||||
Application.Scaled:=True;
|
||||
Application.Initialize;
|
||||
Application.CreateForm(TForm1, Form1);
|
||||
Application.Run;
|
||||
end.
|
||||
|
100
components/powerpdf/LazarusExamples/DBExample/customer.csv
Normal file
100
components/powerpdf/LazarusExamples/DBExample/customer.csv
Normal file
@ -0,0 +1,100 @@
|
||||
1,Pede Et Risus Consulting,Wie,Vienna,Ap #508-3195 At Avenue,(932) 612-6518
|
||||
2,Pede Malesuada Consulting,Drenthe,Meppel,"P.O. Box 616, 9409 Suspendisse St.",(105) 303-2051
|
||||
3,Auctor Incorporated,ON,Hearst,944-3936 Praesent Road,(326) 282-6747
|
||||
4,Auctor Odio LLC,QC,Chicoutimi,"P.O. Box 124, 3952 Sit Rd.",(623) 728-1497
|
||||
5,Phasellus Dapibus Quam Institute,Berlin,Berlin,"599-5509 Id, Road",(302) 275-3108
|
||||
6,Eget Lacus Associates,Queensland,Hervey Bay,Ap #966-4267 Elit Avenue,(657) 147-3061
|
||||
7,Eu Neque Pellentesque Ltd,BE,Berlin,9285 Tortor Av.,(553) 851-6429
|
||||
8,Magnis LLC,SP,Jundiaí,766-9005 Dictum. Road,(432) 411-6225
|
||||
9,Vulputate Posuere Vulputate Associates,AR,Zaragoza,4433 Mauris Rd.,(562) 522-8957
|
||||
10,Dis Parturient Industries,Tyrol,Wörgl,Ap #878-7915 Sit St.,(153) 510-0468
|
||||
11,Adipiscing Non Associates,SL,Katowice,"1654 Augue, St.",(175) 176-8256
|
||||
12,Pede Nonummy Ut Company,ON,Toronto,7516 Condimentum. Rd.,(809) 296-0946
|
||||
13,Scelerisque Associates,Metropolitana de Santiago,Providencia,Ap #752-7401 Aliquam Ave,(223) 351-4520
|
||||
14,Malesuada Id Erat Inc.,Champagne-Ardenne,Troyes,"P.O. Box 727, 7109 Quis, St.",(859) 728-6562
|
||||
15,Elit Sed Associates,LAZ,Labico,Ap #627-356 Nulla. Avenue,(242) 771-1721
|
||||
16,Donec Nibh Enim LLC,Antalya,Alanya,802 Placerat Rd.,(130) 562-4215
|
||||
17,Sed Company,UP,Gorakhpur,Ap #911-7201 Ullamcorper. Road,(877) 882-4792
|
||||
18,Purus Company,NO,Lens,"Ap #379-9596 Magna, St.",(178) 292-4753
|
||||
19,Ipsum Dolor Sit Company,San José,Mata de Plátano,"3052 Nunc, Road",(721) 314-8328
|
||||
20,Cubilia Associates,Ontario,Essex,"P.O. Box 189, 7017 Enim St.",(530) 997-4789
|
||||
21,Orci Sem Limited,E,Norrköping,"P.O. Box 904, 8871 Nec, Road",(927) 856-0234
|
||||
22,Semper Cursus Integer LLP,CAM,Sant'Arsenio,"P.O. Box 806, 737 Velit Av.",(148) 598-4515
|
||||
23,Eros Limited,Worcestershire,Halesowen,Ap #466-1326 Nulla Avenue,(125) 664-6887
|
||||
24,Orci Adipiscing PC,Ankara,Beypazarı,Ap #503-2121 Et Rd.,(922) 118-3062
|
||||
25,Pulvinar Arcu Et Company,Zuid Holland,Delft,1918 Cubilia Rd.,(151) 846-0164
|
||||
26,Consequat Auctor Institute,L,Dublin,"P.O. Box 355, 6352 Eu Avenue",(666) 646-6854
|
||||
27,Ornare Fusce Incorporated,Noord Holland,Hilversum,1211 Lacus. Road,(497) 414-4833
|
||||
28,Rhoncus Id Foundation,Saarland,Schwalbach,Ap #572-9437 In Street,(185) 830-7168
|
||||
29,Aliquam Erat Volutpat Ltd,NSW,Tamworth,630-159 Dis St.,(508) 666-6097
|
||||
30,Tincidunt Dui Augue Corp.,RJ,Bikaner,6646 Pellentesque Avenue,(541) 222-1296
|
||||
31,Egestas Industries,QC,Pointe-aux-Trembles,Ap #834-7483 Sagittis. Ave,(929) 966-1678
|
||||
32,Cras PC,Northern Territory,Darwin,"P.O. Box 797, 6957 Adipiscing Rd.",(784) 755-0169
|
||||
33,Velit Quisque Varius Institute,WA,Gosnells,Ap #262-3475 Metus. Avenue,(107) 893-1395
|
||||
34,Rutrum Corporation,Wie,Vienna,"P.O. Box 487, 2759 Venenatis Avenue",(541) 252-3979
|
||||
35,Non Nisi Aenean Corp.,Wie,Vienna,4689 Sit Ave,(574) 571-8873
|
||||
36,Sapien Cursus In Industries,Ontario,Whitby,Ap #113-7134 Ut Avenue,(564) 826-1266
|
||||
37,Cras Eget Nisi Corp.,AN,Arendonk,"521-2463 Purus, Av.",(921) 456-3540
|
||||
38,Ut LLC,IA,Cedar Rapids,"P.O. Box 899, 7840 Justo. St.",(374) 905-3251
|
||||
39,Aliquam Industries,Leinster,Dublin,Ap #434-4457 Ligula. Street,(378) 388-2768
|
||||
40,Ante Bibendum Inc.,NI,Porirua,3389 Ac Rd.,(292) 375-4468
|
||||
41,Nunc In At Limited,N.,Laren,602-1426 Arcu. Avenue,(547) 919-2398
|
||||
42,Convallis In Foundation,Midi-Pyrénées,Toulouse,"P.O. Box 343, 9555 Nisi Ave",(234) 125-0471
|
||||
43,Lacinia Sed Congue LLP,Ist,Istanbul,"P.O. Box 601, 3686 Donec St.",(769) 602-2550
|
||||
44,Euismod Industries,NL,Glovertown,919-4124 Egestas. Rd.,(157) 942-9742
|
||||
45,Nullam Ut Associates,Oost-Vlaanderen,Steendorp,8648 Sed Rd.,(775) 999-5190
|
||||
46,Enim Mi Ltd,Maharastra,Ahmadnagar,663-9903 Erat Rd.,(135) 712-9458
|
||||
47,Urna Ut Company,Noord Brabant,Helmond,204-5245 Ut Street,(823) 199-2338
|
||||
48,Nunc Id Enim Associates,NI,Cambridge,"P.O. Box 899, 5251 Sed St.",(203) 782-1779
|
||||
49,Lobortis Risus In Ltd,Cartago,Carmen,596-3119 Egestas Road,(464) 788-8637
|
||||
50,Mauris Molestie Pharetra Ltd,Aydın,Kuşadası,7728 Eu Rd.,(986) 622-0685
|
||||
51,Aenean Egestas PC,PV,Bilbo,4999 Fusce Road,(830) 849-9027
|
||||
52,Nunc Mauris Incorporated,NI,Tokoroa,"Ap #665-8244 Ante, St.",(518) 603-7206
|
||||
53,Pharetra Nam Ac Institute,FVG,Forgaria nel Friuli,"P.O. Box 543, 4271 Tempus Ave",(276) 176-2775
|
||||
54,Nunc Sed Libero PC,New South Wales,Wagga Wagga,4089 Aliquam Street,(129) 929-4820
|
||||
55,Aliquam Company,BU,Oudergem,Ap #440-8271 Vitae St.,(591) 889-2609
|
||||
56,Et PC,Bedfordshire,Leighton Buzzard,Ap #539-5445 Quam Av.,(554) 153-7471
|
||||
57,Est Incorporated,Anglesey,Beaumaris,347-2618 Arcu St.,(399) 720-0760
|
||||
58,Arcu LLP,Luxemburg,Ethe,Ap #602-4508 Interdum Rd.,(515) 158-5849
|
||||
59,Enim Etiam Corp.,MH,Mumbai,Ap #347-3668 Est St.,(744) 327-6738
|
||||
60,Tempus Lorem Fringilla Associates,North Island,Wellington,Ap #161-9602 Nec Street,(467) 358-8336
|
||||
61,Ac Turpis Egestas Ltd,Connacht,Galway,Ap #776-8305 Molestie. Rd.,(903) 615-2716
|
||||
62,Arcu Ac Orci LLC,C,Galway,614-5547 Nunc Ave,(424) 371-4963
|
||||
63,Non Cursus Non Corporation,Ohio,Columbus,"Ap #887-5007 Pede, St.",(404) 120-4837
|
||||
64,Porttitor Vulputate Corporation,Ontario,Hearst,954-412 Id Rd.,(198) 570-9682
|
||||
65,Montes Nascetur Foundation,PIE,Rueglio,898-5723 Consectetuer Rd.,(877) 534-8280
|
||||
66,Sit LLC,MO,Jefferson City,494-8078 Netus St.,(769) 439-0548
|
||||
67,Sed Pede LLC,Andalucía,Córdoba,Ap #381-3155 Faucibus Ave,(192) 410-1335
|
||||
68,Enim Limited,SJ,Desamparados,"P.O. Box 417, 9500 Proin Avenue",(849) 276-3299
|
||||
69,In Condimentum Ltd,NSW,Parramatta,"Ap #825-9140 Id, St.",(742) 379-3433
|
||||
70,Parturient Montes Limited,FC,Montbéliard,8297 Integer Road,(740) 969-7061
|
||||
71,Mauris Blandit Mattis Foundation,PB,Bayeux,406-4021 Egestas Rd.,(351) 448-5059
|
||||
72,Molestie Tellus Foundation,KN,Kano,7935 Integer Avenue,(815) 266-2036
|
||||
73,Et Corp.,WV,Kortrijk,6939 Ultricies St.,(824) 474-8372
|
||||
74,Ligula Aenean Gravida Limited,Jönköpings län,Nässjö,"P.O. Box 262, 8677 Interdum St.",(773) 340-9163
|
||||
75,Odio A Purus PC,VI,Nancagua,899-8377 Cursus Rd.,(609) 134-4305
|
||||
76,At Lacus Ltd,U,Belfast,"P.O. Box 876, 2528 Leo, Street",(526) 149-2700
|
||||
77,Ac Metus PC,SI,Greymouth,"P.O. Box 710, 2374 Integer Road",(660) 403-1841
|
||||
78,Quam Elementum Consulting,New South Wales,Grafton,Ap #938-7507 Non Road,(860) 572-1507
|
||||
79,Eget Metus Corp.,WV,Zevekote,2047 Cursus Av.,(447) 128-6448
|
||||
80,Nonummy Ipsum Non Consulting,O,Borås,3558 Odio. Avenue,(942) 436-4721
|
||||
81,Nulla Incorporated,AB,Upplands Väsby,707-268 Quis Street,(127) 664-4298
|
||||
82,Donec LLC,NI,Waitakere,"Ap #363-4011 Est, Road",(672) 266-4129
|
||||
83,Mi Duis Risus Industries,Vienna,Vienna,"P.O. Box 304, 8203 Tincidunt, Avenue",(830) 556-0931
|
||||
84,Curabitur Industries,Catalunya,Sabadell,2645 Tincidunt Ave,(953) 756-7476
|
||||
85,Orci Consectetuer Euismod Ltd,Noord Holland,Purmerend,Ap #262-6406 Neque Av.,(254) 764-9122
|
||||
86,Amet Massa LLC,AZ,Mesa,2104 Mauris Rd.,(932) 329-4671
|
||||
87,Nisi Aenean Eget Inc.,Ontario,Whitchurch-Stouffville,929 Nisi Rd.,(467) 631-2832
|
||||
88,Enim Mi Associates,Île-de-France,Champigny-sur-Marne,843-8432 Et Rd.,(203) 341-3904
|
||||
89,Nunc Ltd,Iowa,Sioux City,"P.O. Box 172, 3375 Turpis Street",(572) 985-2313
|
||||
90,Tempus Eu Consulting,Uttar Pradesh,Rae Bareli,"P.O. Box 599, 8831 Enim Road",(993) 502-6391
|
||||
91,Augue LLC,NA,Nairn,"P.O. Box 403, 5362 Enim. Road",(886) 827-7924
|
||||
92,Imperdiet Nec Leo Institute,Andalucía,Córdoba,"1294 Id, Street",(809) 679-7858
|
||||
93,Nec LLP,Ontario,Bath,Ap #920-1434 Diam. Avenue,(273) 597-7476
|
||||
94,Convallis In Cursus Corporation,MP,Kraków,"P.O. Box 786, 6677 Nunc Rd.",(196) 845-2459
|
||||
95,Orci Lacus Industries,Provence-Alpes-Côte d'Azur,Antibes,"P.O. Box 149, 4231 Dictum. Avenue",(662) 604-3010
|
||||
96,Pede Ac Urna Corp.,Andalucía,Cádiz,305-3663 Integer Av.,(618) 154-5898
|
||||
97,Lorem Lorem Luctus Incorporated,HE,Erpion,"P.O. Box 442, 1484 Lobortis St.",(233) 687-2562
|
||||
98,Molestie Orci Tincidunt Ltd,CL,Palencia,Ap #413-2822 Nulla Street,(304) 402-2069
|
||||
99,Etiam Laoreet Libero Limited,British Columbia,Fraser-Fort George,"858-6829 Consequat, Rd.",(798) 805-1814
|
||||
100,Accumsan LLC,Dr,Assen,Ap #358-8213 Velit. Rd.,(357) 206-6714
|
|
303
components/powerpdf/LazarusExamples/DBExample/udbexample.lfm
Normal file
303
components/powerpdf/LazarusExamples/DBExample/udbexample.lfm
Normal file
@ -0,0 +1,303 @@
|
||||
object Form1: TForm1
|
||||
Left = 323
|
||||
Height = 592
|
||||
Top = 115
|
||||
Width = 645
|
||||
Caption = 'DB-Example'
|
||||
ClientHeight = 574
|
||||
ClientWidth = 645
|
||||
Menu = MainMenu1
|
||||
OnCreate = FormCreate
|
||||
LCLVersion = '2.1.0.0'
|
||||
object ScrollBox1: TScrollBox
|
||||
Left = 0
|
||||
Height = 574
|
||||
Top = 0
|
||||
Width = 645
|
||||
HorzScrollBar.Page = 608
|
||||
VertScrollBar.Page = 570
|
||||
Align = alClient
|
||||
ClientHeight = 570
|
||||
ClientWidth = 626
|
||||
TabOrder = 0
|
||||
object PRPage1: TPRPage
|
||||
Left = 8
|
||||
Height = 700
|
||||
Top = 6
|
||||
Width = 600
|
||||
MarginTop = 32
|
||||
MarginLeft = 32
|
||||
MarginRight = 32
|
||||
MarginBottom = 32
|
||||
object PRLayoutPanel1: TPRLayoutPanel
|
||||
Left = 33
|
||||
Height = 34
|
||||
Top = 33
|
||||
Width = 534
|
||||
Align = alTop
|
||||
object PRText1: TPRText
|
||||
Left = 146
|
||||
Height = 30
|
||||
Top = 0
|
||||
Width = 260
|
||||
FontName = fnArial
|
||||
FontSize = 24
|
||||
FontBold = True
|
||||
Leading = 14
|
||||
Lines.Strings = (
|
||||
'PowerPdf DBExample'
|
||||
)
|
||||
end
|
||||
object PRRect1: TPRRect
|
||||
Left = 0
|
||||
Height = 2
|
||||
Top = 29
|
||||
Width = 534
|
||||
LineStyle = psSolid
|
||||
FillColor = clBlack
|
||||
end
|
||||
end
|
||||
object PRGridPanel1: TPRGridPanel
|
||||
Left = 33
|
||||
Height = 575
|
||||
Top = 92
|
||||
Width = 534
|
||||
ColCount = 1
|
||||
RowCount = 28
|
||||
Align = alClient
|
||||
BeforePrintChild = PRGridPanel1BeforePrintChild
|
||||
object TxtCustNo: TPRText
|
||||
Left = 0
|
||||
Height = 15
|
||||
Top = 5
|
||||
Width = 50
|
||||
FontName = fnArial
|
||||
FontSize = 12
|
||||
Leading = 14
|
||||
Lines.Strings = (
|
||||
'CustNo.'
|
||||
)
|
||||
end
|
||||
object TxtCompany: TPRText
|
||||
Left = 50
|
||||
Height = 15
|
||||
Top = 5
|
||||
Width = 175
|
||||
FontName = fnArial
|
||||
FontSize = 12
|
||||
Leading = 14
|
||||
Lines.Strings = (
|
||||
'Company'
|
||||
)
|
||||
end
|
||||
object TxtAddr: TPRText
|
||||
Left = 225
|
||||
Height = 15
|
||||
Top = 5
|
||||
Width = 157
|
||||
FontName = fnArial
|
||||
FontSize = 12
|
||||
Leading = 14
|
||||
Lines.Strings = (
|
||||
'Addr1'
|
||||
)
|
||||
end
|
||||
object TxtCity: TPRText
|
||||
Left = 381
|
||||
Height = 15
|
||||
Top = 5
|
||||
Width = 86
|
||||
FontName = fnArial
|
||||
FontSize = 12
|
||||
Leading = 14
|
||||
Lines.Strings = (
|
||||
'City'
|
||||
)
|
||||
end
|
||||
object TxtState: TPRText
|
||||
Left = 470
|
||||
Height = 15
|
||||
Top = 5
|
||||
Width = 64
|
||||
FontName = fnArial
|
||||
FontSize = 12
|
||||
Leading = 14
|
||||
Lines.Strings = (
|
||||
'State'
|
||||
)
|
||||
end
|
||||
end
|
||||
object PRLayoutPanel2: TPRLayoutPanel
|
||||
Left = 33
|
||||
Height = 25
|
||||
Top = 67
|
||||
Width = 534
|
||||
Align = alTop
|
||||
object PRText2: TPRText
|
||||
Left = 0
|
||||
Height = 15
|
||||
Top = 8
|
||||
Width = 50
|
||||
FontColor = clNavy
|
||||
FontName = fnTimesRoman
|
||||
FontSize = 12
|
||||
FontBold = True
|
||||
FontItalic = True
|
||||
Leading = 14
|
||||
Lines.Strings = (
|
||||
'CustNo.'
|
||||
)
|
||||
end
|
||||
object PRText3: TPRText
|
||||
Left = 50
|
||||
Height = 15
|
||||
Top = 8
|
||||
Width = 175
|
||||
FontColor = clNavy
|
||||
FontName = fnTimesRoman
|
||||
FontSize = 12
|
||||
FontBold = True
|
||||
FontItalic = True
|
||||
Leading = 14
|
||||
Lines.Strings = (
|
||||
'Company'
|
||||
)
|
||||
end
|
||||
object PRText4: TPRText
|
||||
Left = 225
|
||||
Height = 15
|
||||
Top = 8
|
||||
Width = 157
|
||||
FontColor = clNavy
|
||||
FontName = fnTimesRoman
|
||||
FontSize = 12
|
||||
FontBold = True
|
||||
FontItalic = True
|
||||
Leading = 14
|
||||
Lines.Strings = (
|
||||
'Addr1'
|
||||
)
|
||||
end
|
||||
object PRText5: TPRText
|
||||
Left = 381
|
||||
Height = 15
|
||||
Top = 8
|
||||
Width = 86
|
||||
FontColor = clNavy
|
||||
FontName = fnTimesRoman
|
||||
FontSize = 12
|
||||
FontBold = True
|
||||
FontItalic = True
|
||||
Leading = 14
|
||||
Lines.Strings = (
|
||||
'City'
|
||||
)
|
||||
end
|
||||
object PRText6: TPRText
|
||||
Left = 469
|
||||
Height = 15
|
||||
Top = 8
|
||||
Width = 66
|
||||
FontColor = clNavy
|
||||
FontName = fnTimesRoman
|
||||
FontSize = 12
|
||||
FontBold = True
|
||||
FontItalic = True
|
||||
Leading = 14
|
||||
Lines.Strings = (
|
||||
'State'
|
||||
)
|
||||
end
|
||||
object PRRect2: TPRRect
|
||||
Left = 0
|
||||
Height = 2
|
||||
Top = 23
|
||||
Width = 534
|
||||
LineStyle = psSolid
|
||||
FillColor = clBlack
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
object MainMenu1: TMainMenu
|
||||
Left = 144
|
||||
Top = 216
|
||||
object miFile: TMenuItem
|
||||
Caption = '&File'
|
||||
object miCreatePDF: TMenuItem
|
||||
Caption = 'Create PDF'
|
||||
OnClick = miCreatePDFClick
|
||||
end
|
||||
object N1: TMenuItem
|
||||
Caption = '-'
|
||||
end
|
||||
object miExit: TMenuItem
|
||||
Caption = 'Exit'
|
||||
OnClick = miExitClick
|
||||
end
|
||||
end
|
||||
object miHelp: TMenuItem
|
||||
Caption = '&Help'
|
||||
object miAbout: TMenuItem
|
||||
Caption = '&About'
|
||||
OnClick = miAboutClick
|
||||
end
|
||||
end
|
||||
end
|
||||
object PReport1: TPReport
|
||||
FileName = 'default.pdf'
|
||||
CreationDate = 44363.4672242477
|
||||
UseOutlines = False
|
||||
ViewerPreference = []
|
||||
Left = 224
|
||||
Top = 216
|
||||
end
|
||||
object SaveDialog1: TSaveDialog
|
||||
FileName = 'DbExample.pdf'
|
||||
Filter = 'PDF Files|*.pdf|All Files|*.*'
|
||||
Left = 296
|
||||
Top = 216
|
||||
end
|
||||
object Table1: TCSVDataset
|
||||
FileName = 'customer.csv'
|
||||
FieldDefs = <
|
||||
item
|
||||
Name = 'CustNo'
|
||||
DataType = ftInteger
|
||||
end
|
||||
item
|
||||
Name = 'Company'
|
||||
DataType = ftString
|
||||
Size = 70
|
||||
end
|
||||
item
|
||||
Name = 'State'
|
||||
DataType = ftString
|
||||
Size = 30
|
||||
end
|
||||
item
|
||||
Name = 'City'
|
||||
DataType = ftString
|
||||
Size = 30
|
||||
end
|
||||
item
|
||||
Name = 'Addr1'
|
||||
DataType = ftString
|
||||
Size = 70
|
||||
end
|
||||
item
|
||||
Name = 'Phone'
|
||||
DataType = ftString
|
||||
Size = 15
|
||||
end>
|
||||
CSVOptions.FirstLineAsFieldNames = False
|
||||
CSVOptions.DefaultFieldLength = 255
|
||||
CSVOptions.Delimiter = ','
|
||||
CSVOptions.QuoteChar = '"'
|
||||
CSVOptions.LineEnding = #13#10
|
||||
CSVOptions.IgnoreOuterWhitespace = False
|
||||
CSVOptions.QuoteOuterWhitespace = True
|
||||
Left = 360
|
||||
Top = 216
|
||||
end
|
||||
end
|
147
components/powerpdf/LazarusExamples/DBExample/udbexample.pas
Normal file
147
components/powerpdf/LazarusExamples/DBExample/udbexample.pas
Normal file
@ -0,0 +1,147 @@
|
||||
{
|
||||
Powerpdf DBExample ported manually to Lazarus.
|
||||
Source file is copied from original delphi example.
|
||||
cvs-file is taken from lazarusexamples\ConsoleProgramDemo
|
||||
}
|
||||
unit UDBExample;
|
||||
|
||||
{$mode objfpc}{$H+}
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
Classes, SysUtils, csvdataset, DB, Forms, Controls, Graphics, Dialogs, Menus, PReport;
|
||||
|
||||
type
|
||||
|
||||
{ TForm1 }
|
||||
|
||||
TForm1 = class(TForm)
|
||||
MainMenu1: TMainMenu;
|
||||
miFile: TMenuItem;
|
||||
miHelp: TMenuItem;
|
||||
miCreatePDF: TMenuItem;
|
||||
miExit: TMenuItem;
|
||||
miAbout: TMenuItem;
|
||||
N1: TMenuItem;
|
||||
PReport1: TPReport;
|
||||
PRGridPanel1: TPRGridPanel;
|
||||
PRLayoutPanel1: TPRLayoutPanel;
|
||||
PRLayoutPanel2: TPRLayoutPanel;
|
||||
PRPage1: TPRPage;
|
||||
PRRect1: TPRRect;
|
||||
PRRect2: TPRRect;
|
||||
PRText1: TPRText;
|
||||
PRText2: TPRText;
|
||||
PRText3: TPRText;
|
||||
PRText4: TPRText;
|
||||
PRText5: TPRText;
|
||||
PRText6: TPRText;
|
||||
SaveDialog1: TSaveDialog;
|
||||
ScrollBox1: TScrollBox;
|
||||
Table1: TCSVDataset;
|
||||
TxtAddr: TPRText;
|
||||
TxtCity: TPRText;
|
||||
TxtCompany: TPRText;
|
||||
TxtCustNo: TPRText;
|
||||
TxtState: TPRText;
|
||||
procedure FormCreate(Sender: TObject);
|
||||
procedure miAboutClick(Sender: TObject);
|
||||
procedure miCreatePDFClick(Sender: TObject);
|
||||
procedure miExitClick(Sender: TObject);
|
||||
procedure PRGridPanel1BeforePrintChild(Sender: TObject; ACanvas: TPRCanvas; ACol,
|
||||
ARow: integer; Rect: TRect);
|
||||
private
|
||||
|
||||
public
|
||||
|
||||
end;
|
||||
|
||||
var
|
||||
Form1: TForm1;
|
||||
|
||||
implementation
|
||||
|
||||
{$R *.lfm}
|
||||
|
||||
{ TForm1 }
|
||||
|
||||
procedure TForm1.FormCreate(Sender: TObject);
|
||||
begin
|
||||
Table1.LoadFromFile(ExtractFilePath(Application.ExeName)+'customer.csv');
|
||||
|
||||
PRPage1.Visible := false;
|
||||
end;
|
||||
|
||||
procedure TForm1.miAboutClick(Sender: TObject);
|
||||
begin
|
||||
ShowMessage(POWER_PDF_VERSION_STR + #13#10 + POWER_PDF_COPYRIGHT);
|
||||
end;
|
||||
|
||||
procedure TForm1.miExitClick(Sender: TObject);
|
||||
begin
|
||||
Close;
|
||||
end;
|
||||
|
||||
procedure TForm1.miCreatePDFClick(Sender: TObject);
|
||||
begin
|
||||
if SaveDialog1.Execute then
|
||||
begin
|
||||
Screen.Cursor := crHourGlass;
|
||||
Application.ProcessMessages;
|
||||
TxtCustNo.Printable := true;
|
||||
TxtCompany.Printable := true;
|
||||
TxtAddr.Printable := true;
|
||||
TxtCity.Printable := true;
|
||||
TxtState.Printable := true;
|
||||
try
|
||||
with PReport1 do
|
||||
begin
|
||||
FileName := SaveDialog1.FileName;
|
||||
|
||||
// starting printing document.
|
||||
BeginDoc;
|
||||
|
||||
Table1.Open;
|
||||
while not Table1.Eof do
|
||||
Print(PRPage1);
|
||||
|
||||
// save document.
|
||||
EndDoc;
|
||||
Table1.Close;
|
||||
end;
|
||||
finally
|
||||
Screen.Cursor := crDefault;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TForm1.PRGridPanel1BeforePrintChild(Sender: TObject; ACanvas: TPRCanvas; ACol,
|
||||
ARow: integer; Rect: TRect);
|
||||
begin
|
||||
with Table1 do
|
||||
if not Table1.Eof then
|
||||
begin
|
||||
// setting text from current record.
|
||||
TxtCustNo.Text := Table1.Fields[0].AsString;
|
||||
TxtCompany.Text := Table1.Fields[1].AsString;
|
||||
TxtAddr.Text := Table1.Fields[4].AsString;
|
||||
TxtCity.Text := Table1.Fields[3].AsString;
|
||||
TxtState.Text := Table1.Fields[2].AsString;
|
||||
|
||||
// move next current record.
|
||||
Table1.Next;
|
||||
end
|
||||
else
|
||||
begin
|
||||
TxtCustNo.Printable := false;
|
||||
TxtCompany.Printable := false;
|
||||
TxtAddr.Printable := false;
|
||||
TxtCity.Printable := false;
|
||||
TxtState.Printable := false;
|
||||
end;
|
||||
end;
|
||||
|
||||
|
||||
end.
|
||||
|
Reference in New Issue
Block a user