RxFPC:Rewrite work with fonts in RxDBGrid export to pdf

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@5092 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
alexs75
2016-08-18 07:53:51 +00:00
parent fe4f02b653
commit 2047c32696
5 changed files with 766 additions and 287 deletions

View File

@ -3,13 +3,13 @@
<ProjectSession> <ProjectSession>
<Version Value="9"/> <Version Value="9"/>
<BuildModes Active="Default"/> <BuildModes Active="Default"/>
<Units Count="63"> <Units Count="67">
<Unit0> <Unit0>
<Filename Value="project1.lpr"/> <Filename Value="project1.lpr"/>
<IsPartOfProject Value="True"/> <IsPartOfProject Value="True"/>
<EditorIndex Value="-1"/> <EditorIndex Value="-1"/>
<CursorPos X="81" Y="12"/> <CursorPos X="81" Y="12"/>
<UsageCount Value="61"/> <UsageCount Value="80"/>
</Unit0> </Unit0>
<Unit1> <Unit1>
<Filename Value="unit1.pas"/> <Filename Value="unit1.pas"/>
@ -18,9 +18,9 @@
<HasResources Value="True"/> <HasResources Value="True"/>
<ResourceBaseClass Value="Form"/> <ResourceBaseClass Value="Form"/>
<UnitName Value="Unit1"/> <UnitName Value="Unit1"/>
<TopLine Value="59"/> <TopLine Value="179"/>
<CursorPos X="106" Y="59"/> <CursorPos X="8" Y="176"/>
<UsageCount Value="61"/> <UsageCount Value="80"/>
<Loaded Value="True"/> <Loaded Value="True"/>
<LoadedDesigner Value="True"/> <LoadedDesigner Value="True"/>
</Unit1> </Unit1>
@ -30,14 +30,15 @@
<EditorIndex Value="-1"/> <EditorIndex Value="-1"/>
<TopLine Value="143"/> <TopLine Value="143"/>
<CursorPos X="31" Y="32"/> <CursorPos X="31" Y="32"/>
<UsageCount Value="16"/> <UsageCount Value="15"/>
</Unit2> </Unit2>
<Unit3> <Unit3>
<Filename Value="../../rxdbgrid.pas"/> <Filename Value="../../rxdbgrid.pas"/>
<EditorIndex Value="-1"/> <EditorIndex Value="2"/>
<TopLine Value="2312"/> <TopLine Value="482"/>
<CursorPos X="30" Y="2329"/> <CursorPos X="41" Y="496"/>
<UsageCount Value="24"/> <UsageCount Value="23"/>
<Loaded Value="True"/>
</Unit3> </Unit3>
<Unit4> <Unit4>
<Filename Value="rxdbgridexportpdf.pas"/> <Filename Value="rxdbgridexportpdf.pas"/>
@ -45,28 +46,28 @@
<EditorIndex Value="-1"/> <EditorIndex Value="-1"/>
<TopLine Value="51"/> <TopLine Value="51"/>
<CursorPos X="69" Y="76"/> <CursorPos X="69" Y="76"/>
<UsageCount Value="17"/> <UsageCount Value="16"/>
</Unit4> </Unit4>
<Unit5> <Unit5>
<Filename Value="../../rxdconst.pas"/> <Filename Value="../../rxdconst.pas"/>
<EditorIndex Value="-1"/> <EditorIndex Value="-1"/>
<TopLine Value="161"/> <TopLine Value="161"/>
<CursorPos X="18" Y="177"/> <CursorPos X="18" Y="177"/>
<UsageCount Value="7"/> <UsageCount Value="6"/>
</Unit5> </Unit5>
<Unit6> <Unit6>
<Filename Value="../../../install/source/fpcsrc/rtl/objpas/classes/reader.inc"/> <Filename Value="../../../install/source/fpcsrc/rtl/objpas/classes/reader.inc"/>
<EditorIndex Value="-1"/> <EditorIndex Value="-1"/>
<TopLine Value="964"/> <TopLine Value="964"/>
<CursorPos Y="986"/> <CursorPos Y="986"/>
<UsageCount Value="7"/> <UsageCount Value="6"/>
</Unit6> </Unit6>
<Unit7> <Unit7>
<Filename Value="../../../OPTORG/alexs/3/examples/testfppdf.lpr"/> <Filename Value="../../../OPTORG/alexs/3/examples/testfppdf.lpr"/>
<EditorIndex Value="-1"/> <EditorIndex Value="-1"/>
<TopLine Value="107"/> <TopLine Value="107"/>
<CursorPos Y="133"/> <CursorPos Y="133"/>
<UsageCount Value="8"/> <UsageCount Value="7"/>
</Unit7> </Unit7>
<Unit8> <Unit8>
<Filename Value="../../../install/source/fpcsrc/packages/fcl-pdf/src/fppdf.pp"/> <Filename Value="../../../install/source/fpcsrc/packages/fcl-pdf/src/fppdf.pp"/>
@ -74,25 +75,25 @@
<EditorIndex Value="-1"/> <EditorIndex Value="-1"/>
<TopLine Value="530"/> <TopLine Value="530"/>
<CursorPos X="15" Y="544"/> <CursorPos X="15" Y="544"/>
<UsageCount Value="25"/> <UsageCount Value="24"/>
</Unit8> </Unit8>
<Unit9> <Unit9>
<Filename Value="../../registerrxdb.pas"/> <Filename Value="../../registerrxdb.pas"/>
<UnitName Value="RegisterRxDB"/> <UnitName Value="RegisterRxDB"/>
<EditorIndex Value="-1"/> <EditorIndex Value="-1"/>
<CursorPos X="23" Y="10"/> <CursorPos X="23" Y="10"/>
<UsageCount Value="8"/> <UsageCount Value="7"/>
</Unit9> </Unit9>
<Unit10> <Unit10>
<Filename Value="../../rxdbgridexportpdf.pas"/> <Filename Value="../../rxdbgridexportpdf.pas"/>
<UnitName Value="RxDBGridExportPdf"/> <UnitName Value="RxDBGridExportPdf"/>
<IsVisibleTab Value="True"/> <IsVisibleTab Value="True"/>
<EditorIndex Value="1"/> <EditorIndex Value="1"/>
<TopLine Value="277"/> <TopLine Value="656"/>
<CursorPos X="9" Y="303"/> <CursorPos Y="680"/>
<UsageCount Value="28"/> <UsageCount Value="38"/>
<Bookmarks Count="1"> <Bookmarks Count="1">
<Item0 X="3" Y="382" ID="1"/> <Item0 Y="696" ID="1"/>
</Bookmarks> </Bookmarks>
<Loaded Value="True"/> <Loaded Value="True"/>
</Unit10> </Unit10>
@ -102,51 +103,53 @@
<EditorIndex Value="-1"/> <EditorIndex Value="-1"/>
<TopLine Value="140"/> <TopLine Value="140"/>
<CursorPos X="3" Y="145"/> <CursorPos X="3" Y="145"/>
<UsageCount Value="17"/> <UsageCount Value="16"/>
</Unit11> </Unit11>
<Unit12> <Unit12>
<Filename Value="../../../OPTORG/alexs/1/1/testfppdf.lpr"/> <Filename Value="../../../OPTORG/alexs/1/1/testfppdf.lpr"/>
<EditorIndex Value="-1"/> <EditorIndex Value="-1"/>
<TopLine Value="145"/> <TopLine Value="145"/>
<CursorPos X="13" Y="166"/> <CursorPos X="13" Y="166"/>
<UsageCount Value="21"/> <UsageCount Value="20"/>
</Unit12> </Unit12>
<Unit13> <Unit13>
<Filename Value="../../../install/source/fpcsrc/packages/fcl-pdf/src/fpparsettf.pp"/> <Filename Value="../../../install/source/fpcsrc/packages/fcl-pdf/src/fpparsettf.pp"/>
<EditorIndex Value="-1"/> <EditorIndex Value="-1"/>
<TopLine Value="344"/> <TopLine Value="344"/>
<CursorPos Y="365"/> <CursorPos Y="365"/>
<UsageCount Value="13"/> <UsageCount Value="12"/>
</Unit13> </Unit13>
<Unit14> <Unit14>
<Filename Value="../../../install/source/fpcsrc/rtl/objpas/sysutils/sysutilh.inc"/> <Filename Value="../../../install/source/fpcsrc/rtl/objpas/sysutils/sysutilh.inc"/>
<EditorIndex Value="-1"/> <EditorIndex Value="-1"/>
<TopLine Value="97"/> <TopLine Value="97"/>
<CursorPos X="19" Y="112"/> <CursorPos X="19" Y="112"/>
<UsageCount Value="7"/> <UsageCount Value="6"/>
</Unit14> </Unit14>
<Unit15> <Unit15>
<Filename Value="../../../install/source/fpcsrc/packages/fcl-pdf/src/fpttfencodings.pp"/> <Filename Value="../../../install/source/fpcsrc/packages/fcl-pdf/src/fpttfencodings.pp"/>
<EditorIndex Value="-1"/> <EditorIndex Value="-1"/>
<TopLine Value="2025"/> <TopLine Value="2025"/>
<CursorPos X="3" Y="2100"/> <CursorPos X="3" Y="2100"/>
<UsageCount Value="7"/> <UsageCount Value="6"/>
</Unit15> </Unit15>
<Unit16> <Unit16>
<Filename Value="../../../lazutils/lazfreetypefontcollection.pas"/> <Filename Value="../../../lazutils/lazfreetypefontcollection.pas"/>
<UnitName Value="LazFreeTypeFontCollection"/> <UnitName Value="LazFreeTypeFontCollection"/>
<EditorIndex Value="-1"/> <EditorIndex Value="6"/>
<TopLine Value="345"/> <TopLine Value="331"/>
<CursorPos X="3" Y="347"/> <CursorPos Y="352"/>
<UsageCount Value="21"/> <UsageCount Value="29"/>
<Loaded Value="True"/>
</Unit16> </Unit16>
<Unit17> <Unit17>
<Filename Value="../../../lazutils/easylazfreetype.pas"/> <Filename Value="../../../lazutils/easylazfreetype.pas"/>
<UnitName Value="EasyLazFreeType"/> <UnitName Value="EasyLazFreeType"/>
<EditorIndex Value="-1"/> <EditorIndex Value="3"/>
<TopLine Value="1563"/> <TopLine Value="36"/>
<CursorPos X="3" Y="1550"/> <CursorPos X="3" Y="50"/>
<UsageCount Value="21"/> <UsageCount Value="24"/>
<Loaded Value="True"/>
</Unit17> </Unit17>
<Unit18> <Unit18>
<Filename Value="../../../../examples/lazfreetype/mainform.pas"/> <Filename Value="../../../../examples/lazfreetype/mainform.pas"/>
@ -156,36 +159,36 @@
<EditorIndex Value="-1"/> <EditorIndex Value="-1"/>
<TopLine Value="51"/> <TopLine Value="51"/>
<CursorPos X="78" Y="61"/> <CursorPos X="78" Y="61"/>
<UsageCount Value="7"/> <UsageCount Value="6"/>
</Unit18> </Unit18>
<Unit19> <Unit19>
<Filename Value="../../../lazutils/ttfile.pas"/> <Filename Value="../../../lazutils/ttfile.pas"/>
<UnitName Value="TTFile"/> <UnitName Value="TTFile"/>
<EditorIndex Value="-1"/> <EditorIndex Value="-1"/>
<TopLine Value="233"/> <TopLine Value="234"/>
<CursorPos Y="249"/> <CursorPos X="4" Y="242"/>
<UsageCount Value="9"/> <UsageCount Value="13"/>
</Unit19> </Unit19>
<Unit20> <Unit20>
<Filename Value="../../../install/source/fpcsrc/rtl/objpas/sysutils/finah.inc"/> <Filename Value="../../../install/source/fpcsrc/rtl/objpas/sysutils/finah.inc"/>
<EditorIndex Value="-1"/> <EditorIndex Value="-1"/>
<TopLine Value="10"/> <TopLine Value="10"/>
<CursorPos X="10" Y="25"/> <CursorPos X="10" Y="25"/>
<UsageCount Value="9"/> <UsageCount Value="8"/>
</Unit20> </Unit20>
<Unit21> <Unit21>
<Filename Value="../../../install/source/fpcsrc/rtl/objpas/sysutils/fina.inc"/> <Filename Value="../../../install/source/fpcsrc/rtl/objpas/sysutils/fina.inc"/>
<EditorIndex Value="-1"/> <EditorIndex Value="-1"/>
<TopLine Value="100"/> <TopLine Value="100"/>
<CursorPos X="3" Y="105"/> <CursorPos X="3" Y="105"/>
<UsageCount Value="9"/> <UsageCount Value="8"/>
</Unit21> </Unit21>
<Unit22> <Unit22>
<Filename Value="../../../install/source/fpcsrc/rtl/inc/fexpand.inc"/> <Filename Value="../../../install/source/fpcsrc/rtl/inc/fexpand.inc"/>
<EditorIndex Value="-1"/> <EditorIndex Value="-1"/>
<TopLine Value="226"/> <TopLine Value="226"/>
<CursorPos X="10" Y="106"/> <CursorPos X="10" Y="106"/>
<UsageCount Value="7"/> <UsageCount Value="6"/>
</Unit22> </Unit22>
<Unit23> <Unit23>
<Filename Value="../../../tachart/tadraweropengl.pas"/> <Filename Value="../../../tachart/tadraweropengl.pas"/>
@ -193,21 +196,22 @@
<EditorIndex Value="-1"/> <EditorIndex Value="-1"/>
<TopLine Value="218"/> <TopLine Value="218"/>
<CursorPos Y="220"/> <CursorPos Y="220"/>
<UsageCount Value="13"/> <UsageCount Value="12"/>
</Unit23> </Unit23>
<Unit24> <Unit24>
<Filename Value="../../../lazutils/fileutil.pas"/> <Filename Value="../../../lazutils/fileutil.pas"/>
<UnitName Value="FileUtil"/> <UnitName Value="FileUtil"/>
<EditorIndex Value="-1"/> <EditorIndex Value="-1"/>
<CursorPos X="14" Y="22"/> <TopLine Value="220"/>
<UsageCount Value="9"/> <CursorPos X="17" Y="235"/>
<UsageCount Value="13"/>
</Unit24> </Unit24>
<Unit25> <Unit25>
<Filename Value="../../../lazutils/fileutil.inc"/> <Filename Value="../../../lazutils/fileutil.inc"/>
<EditorIndex Value="-1"/> <EditorIndex Value="-1"/>
<TopLine Value="1013"/> <TopLine Value="1019"/>
<CursorPos Y="1031"/> <CursorPos X="3" Y="1024"/>
<UsageCount Value="7"/> <UsageCount Value="13"/>
</Unit25> </Unit25>
<Unit26> <Unit26>
<Filename Value="../../../lazutils/lazfileutils.pas"/> <Filename Value="../../../lazutils/lazfileutils.pas"/>
@ -215,7 +219,7 @@
<EditorIndex Value="-1"/> <EditorIndex Value="-1"/>
<TopLine Value="719"/> <TopLine Value="719"/>
<CursorPos Y="736"/> <CursorPos Y="736"/>
<UsageCount Value="7"/> <UsageCount Value="6"/>
</Unit26> </Unit26>
<Unit27> <Unit27>
<Filename Value="../../../tachart/backup/tadraweropengl.pas"/> <Filename Value="../../../tachart/backup/tadraweropengl.pas"/>
@ -223,13 +227,13 @@
<EditorIndex Value="-1"/> <EditorIndex Value="-1"/>
<TopLine Value="208"/> <TopLine Value="208"/>
<CursorPos X="20" Y="224"/> <CursorPos X="20" Y="224"/>
<UsageCount Value="7"/> <UsageCount Value="6"/>
</Unit27> </Unit27>
<Unit28> <Unit28>
<Filename Value="unit1.lfm"/> <Filename Value="unit1.lfm"/>
<EditorIndex Value="-1"/> <EditorIndex Value="-1"/>
<TopLine Value="231"/> <TopLine Value="231"/>
<UsageCount Value="8"/> <UsageCount Value="7"/>
<DefaultSyntaxHighlighter Value="LFM"/> <DefaultSyntaxHighlighter Value="LFM"/>
</Unit28> </Unit28>
<Unit29> <Unit29>
@ -238,14 +242,14 @@
<EditorIndex Value="-1"/> <EditorIndex Value="-1"/>
<TopLine Value="3503"/> <TopLine Value="3503"/>
<CursorPos X="3" Y="3506"/> <CursorPos X="3" Y="3506"/>
<UsageCount Value="8"/> <UsageCount Value="7"/>
</Unit29> </Unit29>
<Unit30> <Unit30>
<Filename Value="C:/lazarus/components/lazutils/easylazfreetype.pas"/> <Filename Value="C:/lazarus/components/lazutils/easylazfreetype.pas"/>
<UnitName Value="EasyLazFreeType"/> <UnitName Value="EasyLazFreeType"/>
<EditorIndex Value="-1"/> <EditorIndex Value="-1"/>
<CursorPos X="14" Y="160"/> <CursorPos X="14" Y="160"/>
<UsageCount Value="8"/> <UsageCount Value="7"/>
</Unit30> </Unit30>
<Unit31> <Unit31>
<Filename Value="C:/lazarus/components/lazutils/lazfreetypefontcollection.pas"/> <Filename Value="C:/lazarus/components/lazutils/lazfreetypefontcollection.pas"/>
@ -253,28 +257,28 @@
<EditorIndex Value="-1"/> <EditorIndex Value="-1"/>
<TopLine Value="127"/> <TopLine Value="127"/>
<CursorPos X="50" Y="141"/> <CursorPos X="50" Y="141"/>
<UsageCount Value="8"/> <UsageCount Value="7"/>
</Unit31> </Unit31>
<Unit32> <Unit32>
<Filename Value="../../../install/source/fpcsrc/rtl/objpas/classes/classesh.inc"/> <Filename Value="../../../install/source/fpcsrc/rtl/objpas/classes/classesh.inc"/>
<EditorIndex Value="-1"/> <EditorIndex Value="-1"/>
<TopLine Value="76"/> <TopLine Value="76"/>
<CursorPos X="56" Y="91"/> <CursorPos X="56" Y="91"/>
<UsageCount Value="10"/> <UsageCount Value="9"/>
</Unit32> </Unit32>
<Unit33> <Unit33>
<Filename Value="../../../install/source/fpcsrc/rtl/objpas/sysutils/sysinth.inc"/> <Filename Value="../../../install/source/fpcsrc/rtl/objpas/sysutils/sysinth.inc"/>
<EditorIndex Value="-1"/> <EditorIndex Value="-1"/>
<TopLine Value="122"/> <TopLine Value="122"/>
<CursorPos X="58" Y="137"/> <CursorPos X="58" Y="137"/>
<UsageCount Value="8"/> <UsageCount Value="7"/>
</Unit33> </Unit33>
<Unit34> <Unit34>
<Filename Value="../../vclutils.pas"/> <Filename Value="../../vclutils.pas"/>
<EditorIndex Value="-1"/> <EditorIndex Value="-1"/>
<TopLine Value="125"/> <TopLine Value="125"/>
<CursorPos Y="155"/> <CursorPos Y="155"/>
<UsageCount Value="8"/> <UsageCount Value="7"/>
</Unit34> </Unit34>
<Unit35> <Unit35>
<Filename Value="../../rxshortcutunit.pas"/> <Filename Value="../../rxshortcutunit.pas"/>
@ -284,41 +288,41 @@
<UnitName Value="rxShortCutUnit"/> <UnitName Value="rxShortCutUnit"/>
<EditorIndex Value="-1"/> <EditorIndex Value="-1"/>
<TopLine Value="13"/> <TopLine Value="13"/>
<UsageCount Value="8"/> <UsageCount Value="7"/>
</Unit35> </Unit35>
<Unit36> <Unit36>
<Filename Value="../../rxctrls.pas"/> <Filename Value="../../rxctrls.pas"/>
<EditorIndex Value="-1"/> <EditorIndex Value="-1"/>
<TopLine Value="40"/> <TopLine Value="40"/>
<UsageCount Value="8"/> <UsageCount Value="7"/>
</Unit36> </Unit36>
<Unit37> <Unit37>
<Filename Value="../../rxapputils.pas"/> <Filename Value="../../rxapputils.pas"/>
<EditorIndex Value="-1"/> <EditorIndex Value="-1"/>
<TopLine Value="28"/> <TopLine Value="28"/>
<CursorPos X="83" Y="64"/> <CursorPos X="83" Y="64"/>
<UsageCount Value="8"/> <UsageCount Value="7"/>
</Unit37> </Unit37>
<Unit38> <Unit38>
<Filename Value="../../../install/source/fpcsrc/packages/fcl-db/src/sqldb/sqldb.pp"/> <Filename Value="../../../install/source/fpcsrc/packages/fcl-db/src/sqldb/sqldb.pp"/>
<EditorIndex Value="-1"/> <EditorIndex Value="-1"/>
<TopLine Value="439"/> <TopLine Value="439"/>
<CursorPos X="3" Y="454"/> <CursorPos X="3" Y="454"/>
<UsageCount Value="10"/> <UsageCount Value="9"/>
</Unit38> </Unit38>
<Unit39> <Unit39>
<Filename Value="../../../install/source/fpcsrc/packages/fcl-db/src/base/db.pas"/> <Filename Value="../../../install/source/fpcsrc/packages/fcl-db/src/base/db.pas"/>
<EditorIndex Value="-1"/> <EditorIndex Value="-1"/>
<TopLine Value="1339"/> <TopLine Value="1339"/>
<CursorPos X="3" Y="1354"/> <CursorPos X="3" Y="1354"/>
<UsageCount Value="9"/> <UsageCount Value="8"/>
</Unit39> </Unit39>
<Unit40> <Unit40>
<Filename Value="../../../install/source/fpcsrc/packages/fcl-db/src/base/dataset.inc"/> <Filename Value="../../../install/source/fpcsrc/packages/fcl-db/src/base/dataset.inc"/>
<EditorIndex Value="-1"/> <EditorIndex Value="-1"/>
<TopLine Value="473"/> <TopLine Value="473"/>
<CursorPos X="3" Y="476"/> <CursorPos X="3" Y="476"/>
<UsageCount Value="10"/> <UsageCount Value="9"/>
</Unit40> </Unit40>
<Unit41> <Unit41>
<Filename Value="../../../install/source/fpcsrc/packages/fcl-db/src/base/bufdataset.pas"/> <Filename Value="../../../install/source/fpcsrc/packages/fcl-db/src/base/bufdataset.pas"/>
@ -326,7 +330,7 @@
<EditorIndex Value="-1"/> <EditorIndex Value="-1"/>
<TopLine Value="458"/> <TopLine Value="458"/>
<CursorPos X="3" Y="446"/> <CursorPos X="3" Y="446"/>
<UsageCount Value="10"/> <UsageCount Value="9"/>
<Bookmarks Count="1"> <Bookmarks Count="1">
<Item0 X="3" Y="3449" ID="1"/> <Item0 X="3" Y="3449" ID="1"/>
</Bookmarks> </Bookmarks>
@ -335,21 +339,21 @@
<Filename Value="../../../install/source/fpcsrc/packages/fcl-db/src/base/bufdataset_parser.pp"/> <Filename Value="../../../install/source/fpcsrc/packages/fcl-db/src/base/bufdataset_parser.pp"/>
<EditorIndex Value="-1"/> <EditorIndex Value="-1"/>
<CursorPos X="20" Y="18"/> <CursorPos X="20" Y="18"/>
<UsageCount Value="9"/> <UsageCount Value="8"/>
</Unit42> </Unit42>
<Unit43> <Unit43>
<Filename Value="../../../install/source/fpcsrc/packages/fcl-db/src/dbase/dbf_prscore.pas"/> <Filename Value="../../../install/source/fpcsrc/packages/fcl-db/src/dbase/dbf_prscore.pas"/>
<EditorIndex Value="-1"/> <EditorIndex Value="-1"/>
<TopLine Value="34"/> <TopLine Value="34"/>
<CursorPos X="3" Y="43"/> <CursorPos X="3" Y="43"/>
<UsageCount Value="9"/> <UsageCount Value="8"/>
</Unit43> </Unit43>
<Unit44> <Unit44>
<Filename Value="../../rxmemds.pas"/> <Filename Value="../../rxmemds.pas"/>
<EditorIndex Value="-1"/> <EditorIndex Value="-1"/>
<TopLine Value="25"/> <TopLine Value="25"/>
<CursorPos X="47" Y="40"/> <CursorPos X="47" Y="40"/>
<UsageCount Value="10"/> <UsageCount Value="9"/>
<Bookmarks Count="1"> <Bookmarks Count="1">
<Item0 X="33" Y="131" ID="2"/> <Item0 X="33" Y="131" ID="2"/>
</Bookmarks> </Bookmarks>
@ -359,63 +363,64 @@
<EditorIndex Value="-1"/> <EditorIndex Value="-1"/>
<TopLine Value="136"/> <TopLine Value="136"/>
<CursorPos X="14" Y="155"/> <CursorPos X="14" Y="155"/>
<UsageCount Value="8"/> <UsageCount Value="7"/>
</Unit45> </Unit45>
<Unit46> <Unit46>
<Filename Value="../../../install/source/fpcsrc/packages/fcl-db/src/dbase/dbf.pas"/> <Filename Value="../../../install/source/fpcsrc/packages/fcl-db/src/dbase/dbf.pas"/>
<EditorIndex Value="-1"/> <EditorIndex Value="-1"/>
<TopLine Value="2336"/> <TopLine Value="2336"/>
<CursorPos X="3" Y="2338"/> <CursorPos X="3" Y="2338"/>
<UsageCount Value="8"/> <UsageCount Value="7"/>
</Unit46> </Unit46>
<Unit47> <Unit47>
<Filename Value="../../../install/source/fpcsrc/packages/fcl-db/src/dbase/dbf_parser.pas"/> <Filename Value="../../../install/source/fpcsrc/packages/fcl-db/src/dbase/dbf_parser.pas"/>
<EditorIndex Value="-1"/> <EditorIndex Value="-1"/>
<TopLine Value="162"/> <TopLine Value="162"/>
<CursorPos X="5" Y="87"/> <CursorPos X="5" Y="87"/>
<UsageCount Value="8"/> <UsageCount Value="7"/>
</Unit47> </Unit47>
<Unit48> <Unit48>
<Filename Value="../../rxdb/rxmemds_parser.pas"/> <Filename Value="../../rxdb/rxmemds_parser.pas"/>
<EditorIndex Value="-1"/> <EditorIndex Value="-1"/>
<TopLine Value="186"/> <TopLine Value="186"/>
<CursorPos X="3" Y="189"/> <CursorPos X="3" Y="189"/>
<UsageCount Value="9"/> <UsageCount Value="8"/>
</Unit48> </Unit48>
<Unit49> <Unit49>
<Filename Value="../../../install/source/fpcsrc/packages/fcl-db/src/dbase/dbf_common.pas"/> <Filename Value="../../../install/source/fpcsrc/packages/fcl-db/src/dbase/dbf_common.pas"/>
<EditorIndex Value="-1"/> <EditorIndex Value="-1"/>
<TopLine Value="95"/> <TopLine Value="95"/>
<CursorPos X="10" Y="110"/> <CursorPos X="10" Y="110"/>
<UsageCount Value="9"/> <UsageCount Value="8"/>
</Unit49> </Unit49>
<Unit50> <Unit50>
<Filename Value="../../../../lcl/grids.pas"/> <Filename Value="../../../../lcl/grids.pas"/>
<UnitName Value="Grids"/> <UnitName Value="Grids"/>
<EditorIndex Value="-1"/> <EditorIndex Value="5"/>
<TopLine Value="1972"/> <TopLine Value="11194"/>
<CursorPos X="21" Y="1976"/> <CursorPos Y="11210"/>
<UsageCount Value="12"/> <UsageCount Value="12"/>
<Loaded Value="True"/>
</Unit50> </Unit50>
<Unit51> <Unit51>
<Filename Value="../../../lazutils/lazfreetype.pas"/> <Filename Value="../../../lazutils/lazfreetype.pas"/>
<UnitName Value="LazFreeType"/> <UnitName Value="LazFreeType"/>
<EditorIndex Value="-1"/> <EditorIndex Value="-1"/>
<TopLine Value="76"/> <TopLine Value="512"/>
<CursorPos Y="76"/> <CursorPos X="5" Y="520"/>
<UsageCount Value="9"/> <UsageCount Value="13"/>
</Unit51> </Unit51>
<Unit52> <Unit52>
<Filename Value="../../../lazutils/ttobjs.pas"/> <Filename Value="../../../lazutils/ttobjs.pas"/>
<UnitName Value="TTObjs"/> <UnitName Value="TTObjs"/>
<EditorIndex Value="-1"/> <EditorIndex Value="-1"/>
<UsageCount Value="9"/> <UsageCount Value="8"/>
</Unit52> </Unit52>
<Unit53> <Unit53>
<Filename Value="../../../lazutils/tttables.pas"/> <Filename Value="../../../lazutils/tttables.pas"/>
<UnitName Value="TTTables"/> <UnitName Value="TTTables"/>
<EditorIndex Value="-1"/> <EditorIndex Value="-1"/>
<UsageCount Value="9"/> <UsageCount Value="8"/>
</Unit53> </Unit53>
<Unit54> <Unit54>
<Filename Value="../../../../lcl/dbgrids.pas"/> <Filename Value="../../../../lcl/dbgrids.pas"/>
@ -423,15 +428,15 @@
<EditorIndex Value="-1"/> <EditorIndex Value="-1"/>
<TopLine Value="4071"/> <TopLine Value="4071"/>
<CursorPos Y="4090"/> <CursorPos Y="4090"/>
<UsageCount Value="11"/> <UsageCount Value="10"/>
</Unit54> </Unit54>
<Unit55> <Unit55>
<Filename Value="../../../../lcl/graphics.pp"/> <Filename Value="../../../../lcl/graphics.pp"/>
<UnitName Value="Graphics"/> <UnitName Value="Graphics"/>
<EditorIndex Value="-1"/> <EditorIndex Value="-1"/>
<TopLine Value="1959"/> <TopLine Value="48"/>
<CursorPos X="29" Y="1970"/> <CursorPos X="59" Y="63"/>
<UsageCount Value="10"/> <UsageCount Value="14"/>
</Unit55> </Unit55>
<Unit56> <Unit56>
<Filename Value="../../../../lcl/lcltype.pp"/> <Filename Value="../../../../lcl/lcltype.pp"/>
@ -439,7 +444,7 @@
<EditorIndex Value="-1"/> <EditorIndex Value="-1"/>
<TopLine Value="1629"/> <TopLine Value="1629"/>
<CursorPos X="3" Y="1644"/> <CursorPos X="3" Y="1644"/>
<UsageCount Value="10"/> <UsageCount Value="9"/>
</Unit56> </Unit56>
<Unit57> <Unit57>
<Filename Value="../../../install/source/fpcsrc/packages/fcl-image/src/fpimage.pp"/> <Filename Value="../../../install/source/fpcsrc/packages/fcl-image/src/fpimage.pp"/>
@ -447,7 +452,7 @@
<EditorIndex Value="-1"/> <EditorIndex Value="-1"/>
<TopLine Value="37"/> <TopLine Value="37"/>
<CursorPos X="4" Y="45"/> <CursorPos X="4" Y="45"/>
<UsageCount Value="10"/> <UsageCount Value="9"/>
</Unit57> </Unit57>
<Unit58> <Unit58>
<Filename Value="../../rxdbgridexportpdfsetupunit.pas"/> <Filename Value="../../rxdbgridexportpdfsetupunit.pas"/>
@ -455,12 +460,10 @@
<HasResources Value="True"/> <HasResources Value="True"/>
<ResourceBaseClass Value="Form"/> <ResourceBaseClass Value="Form"/>
<UnitName Value="RxDBGridExportPdfSetupUnit"/> <UnitName Value="RxDBGridExportPdfSetupUnit"/>
<EditorIndex Value="4"/> <EditorIndex Value="-1"/>
<TopLine Value="56"/> <TopLine Value="57"/>
<CursorPos X="5" Y="83"/> <CursorPos X="23" Y="81"/>
<UsageCount Value="21"/> <UsageCount Value="22"/>
<Loaded Value="True"/>
<LoadedDesigner Value="True"/>
</Unit58> </Unit58>
<Unit59> <Unit59>
<Filename Value="../../rxdbgridexportspreadsheet_paramsunit.pas"/> <Filename Value="../../rxdbgridexportspreadsheet_paramsunit.pas"/>
@ -471,7 +474,7 @@
<EditorIndex Value="-1"/> <EditorIndex Value="-1"/>
<TopLine Value="31"/> <TopLine Value="31"/>
<CursorPos X="3" Y="46"/> <CursorPos X="3" Y="46"/>
<UsageCount Value="10"/> <UsageCount Value="9"/>
</Unit59> </Unit59>
<Unit60> <Unit60>
<Filename Value="../../../../lcl/controls.pp"/> <Filename Value="../../../../lcl/controls.pp"/>
@ -479,150 +482,181 @@
<EditorIndex Value="-1"/> <EditorIndex Value="-1"/>
<TopLine Value="5"/> <TopLine Value="5"/>
<CursorPos X="14" Y="19"/> <CursorPos X="14" Y="19"/>
<UsageCount Value="10"/> <UsageCount Value="9"/>
</Unit60> </Unit60>
<Unit61> <Unit61>
<Filename Value="/home/OPTORG/alexs/1/1/testfppdf.lpr"/> <Filename Value="/home/OPTORG/alexs/1/1/testfppdf.lpr"/>
<EditorIndex Value="3"/> <EditorIndex Value="7"/>
<TopLine Value="297"/> <TopLine Value="518"/>
<CursorPos Y="302"/> <CursorPos X="23" Y="542"/>
<UsageCount Value="10"/> <UsageCount Value="20"/>
<Loaded Value="True"/> <Loaded Value="True"/>
</Unit61> </Unit61>
<Unit62> <Unit62>
<Filename Value="/home/install/source/fpcsrc/packages/fcl-pdf/src/fppdf.pp"/> <Filename Value="/home/install/source/fpcsrc/packages/fcl-pdf/src/fppdf.pp"/>
<UnitName Value="fpPDF"/> <UnitName Value="fpPDF"/>
<EditorIndex Value="2"/> <EditorIndex Value="4"/>
<TopLine Value="22"/> <TopLine Value="4191"/>
<CursorPos X="3" Y="43"/> <CursorPos X="3" Y="4196"/>
<UsageCount Value="10"/> <UsageCount Value="20"/>
<Loaded Value="True"/> <Loaded Value="True"/>
</Unit62> </Unit62>
<Unit63>
<Filename Value="/home/install/source/fpcsrc/rtl/objpas/classes/classesh.inc"/>
<EditorIndex Value="-1"/>
<TopLine Value="236"/>
<CursorPos X="3" Y="215"/>
<UsageCount Value="9"/>
</Unit63>
<Unit64>
<Filename Value="/home/install/source/fpcsrc/packages/fcl-base/src/contnrs.pp"/>
<EditorIndex Value="-1"/>
<TopLine Value="16"/>
<CursorPos X="3" Y="31"/>
<UsageCount Value="10"/>
</Unit64>
<Unit65>
<Filename Value="../../../../lcl/stdctrls.pp"/>
<UnitName Value="StdCtrls"/>
<EditorIndex Value="-1"/>
<TopLine Value="951"/>
<CursorPos X="14" Y="964"/>
<UsageCount Value="9"/>
</Unit65>
<Unit66>
<Filename Value="../../../lazutils/tterror.pas"/>
<UnitName Value="TTError"/>
<EditorIndex Value="-1"/>
<TopLine Value="34"/>
<CursorPos X="3" Y="49"/>
<UsageCount Value="13"/>
</Unit66>
</Units> </Units>
<JumpHistory Count="30" HistoryIndex="29"> <JumpHistory Count="30" HistoryIndex="29">
<Position1> <Position1>
<Filename Value="../../rxdbgridexportpdf.pas"/> <Filename Value="../../rxdbgridexportpdf.pas"/>
<Caret Line="277" Column="53" TopLine="252"/> <Caret Line="650" TopLine="632"/>
</Position1> </Position1>
<Position2> <Position2>
<Filename Value="../../rxdbgridexportpdf.pas"/> <Filename Value="../../rxdbgridexportpdf.pas"/>
<Caret Line="142" Column="15" TopLine="127"/> <Caret Line="652" TopLine="632"/>
</Position2> </Position2>
<Position3> <Position3>
<Filename Value="../../rxdbgridexportpdf.pas"/> <Filename Value="../../rxdbgridexportpdf.pas"/>
<Caret Line="275" Column="70" TopLine="261"/> <Caret Line="654" TopLine="632"/>
</Position3> </Position3>
<Position4> <Position4>
<Filename Value="../../rxdbgridexportpdf.pas"/> <Filename Value="../../rxdbgridexportpdf.pas"/>
<Caret Line="285" TopLine="226"/> <Caret Line="655" TopLine="632"/>
</Position4> </Position4>
<Position5> <Position5>
<Filename Value="../../rxdbgridexportpdf.pas"/> <Filename Value="../../rxdbgridexportpdf.pas"/>
<Caret Line="239" Column="61" TopLine="236"/> <Caret Line="656" TopLine="632"/>
</Position5> </Position5>
<Position6> <Position6>
<Filename Value="../../rxdbgridexportpdf.pas"/> <Filename Value="../../rxdbgridexportpdf.pas"/>
<Caret Line="208" Column="20" TopLine="203"/> <Caret Line="659" TopLine="634"/>
</Position6> </Position6>
<Position7> <Position7>
<Filename Value="../../rxdbgridexportpdfsetupunit.pas"/> <Filename Value="../../rxdbgridexportpdf.pas"/>
<Caret Line="18" Column="30"/> <Caret Line="660" TopLine="635"/>
</Position7> </Position7>
<Position8> <Position8>
<Filename Value="../../rxdbgridexportpdf.pas"/> <Filename Value="../../rxdbgridexportpdf.pas"/>
<Caret Line="136" Column="89" TopLine="129"/> <Caret Line="661" TopLine="637"/>
</Position8> </Position8>
<Position9> <Position9>
<Filename Value="../../rxdbgridexportpdf.pas"/> <Filename Value="../../rxdbgridexportpdf.pas"/>
<Caret Line="477" Column="34" TopLine="457"/> <Caret Line="663" TopLine="640"/>
</Position9> </Position9>
<Position10> <Position10>
<Filename Value="../../rxdbgridexportpdfsetupunit.pas"/> <Filename Value="../../rxdbgridexportpdf.pas"/>
<Caret Line="67" TopLine="39"/> <Caret Line="667" TopLine="643"/>
</Position10> </Position10>
<Position11> <Position11>
<Filename Value="../../rxdbgridexportpdfsetupunit.pas"/> <Filename Value="../../rxdbgridexportpdf.pas"/>
<Caret Line="83" TopLine="53"/> <Caret Line="670" TopLine="649"/>
</Position11> </Position11>
<Position12> <Position12>
<Filename Value="../../rxdbgridexportpdfsetupunit.pas"/> <Filename Value="../../rxdbgridexportpdf.pas"/>
<Caret Line="82" Column="5" TopLine="56"/> <Caret Line="673" TopLine="649"/>
</Position12> </Position12>
<Position13> <Position13>
<Filename Value="unit1.pas"/> <Filename Value="../../rxdbgridexportpdf.pas"/>
<Caret Line="166" Column="3" TopLine="148"/> <Caret Line="676" TopLine="652"/>
</Position13> </Position13>
<Position14> <Position14>
<Filename Value="unit1.pas"/> <Filename Value="../../rxdbgridexportpdf.pas"/>
<Caret Line="165" Column="3" TopLine="147"/> <Caret Line="690" TopLine="669"/>
</Position14> </Position14>
<Position15> <Position15>
<Filename Value="unit1.pas"/> <Filename Value="../../rxdbgridexportpdf.pas"/>
<Caret Line="164" Column="3" TopLine="146"/> <Caret Line="668" TopLine="654"/>
</Position15> </Position15>
<Position16> <Position16>
<Filename Value="unit1.pas"/> <Filename Value="../../rxdbgridexportpdf.pas"/>
<Caret Line="167" Column="54" TopLine="146"/> <Caret Line="690" TopLine="675"/>
</Position16> </Position16>
<Position17> <Position17>
<Filename Value="unit1.pas"/> <Filename Value="../../rxdbgridexportpdf.pas"/>
<Caret Line="692" TopLine="675"/>
</Position17> </Position17>
<Position18> <Position18>
<Filename Value="unit1.pas"/> <Filename Value="../../rxdbgridexportpdf.pas"/>
<Caret Line="157" Column="44" TopLine="127"/> <Caret Line="679" TopLine="674"/>
</Position18> </Position18>
<Position19> <Position19>
<Filename Value="unit1.pas"/> <Filename Value="../../rxdbgridexportpdf.pas"/>
<Caret Line="156" Column="44" TopLine="126"/> <Caret Line="642" TopLine="640"/>
</Position19> </Position19>
<Position20> <Position20>
<Filename Value="unit1.pas"/> <Filename Value="../../rxdbgridexportpdf.pas"/>
<Caret Line="137" Column="65" TopLine="127"/> <Caret Line="643" TopLine="637"/>
</Position20> </Position20>
<Position21> <Position21>
<Filename Value="unit1.pas"/> <Filename Value="../../rxdbgridexportpdf.pas"/>
<Caret Line="188" TopLine="164"/> <Caret Line="644" TopLine="637"/>
</Position21> </Position21>
<Position22> <Position22>
<Filename Value="unit1.pas"/> <Filename Value="../../rxdbgridexportpdf.pas"/>
<Caret Line="155" TopLine="139"/> <Caret Line="645" TopLine="637"/>
</Position22> </Position22>
<Position23> <Position23>
<Filename Value="unit1.pas"/> <Filename Value="../../rxdbgridexportpdf.pas"/>
<Caret Line="156" TopLine="139"/> <Caret Line="647" TopLine="637"/>
</Position23> </Position23>
<Position24> <Position24>
<Filename Value="unit1.pas"/> <Filename Value="../../rxdbgridexportpdf.pas"/>
<Caret Line="157" TopLine="139"/> <Caret Line="649" TopLine="637"/>
</Position24> </Position24>
<Position25> <Position25>
<Filename Value="unit1.pas"/> <Filename Value="../../rxdbgridexportpdf.pas"/>
<Caret Line="164" Column="42" TopLine="153"/> <Caret Line="650" TopLine="651"/>
</Position25> </Position25>
<Position26> <Position26>
<Filename Value="../../rxdbgridexportpdf.pas"/> <Filename Value="../../rxdbgridexportpdf.pas"/>
<Caret Line="276" Column="5" TopLine="260"/> <Caret Line="652" TopLine="648"/>
</Position26> </Position26>
<Position27> <Position27>
<Filename Value="/home/OPTORG/alexs/1/1/testfppdf.lpr"/> <Filename Value="../../rxdbgridexportpdf.pas"/>
<Caret Line="331" TopLine="307"/> <Caret Line="654" TopLine="648"/>
</Position27> </Position27>
<Position28> <Position28>
<Filename Value="../../rxdbgridexportpdf.pas"/> <Filename Value="../../rxdbgridexportpdf.pas"/>
<Caret Line="288" TopLine="277"/> <Caret Line="655" TopLine="648"/>
</Position28> </Position28>
<Position29> <Position29>
<Filename Value="../../rxdbgridexportpdf.pas"/> <Filename Value="../../rxdbgridexportpdf.pas"/>
<Caret Line="143" Column="13" TopLine="134"/> <Caret Line="656" TopLine="648"/>
</Position29> </Position29>
<Position30> <Position30>
<Filename Value="../../rxdbgridexportpdf.pas"/> <Filename Value="../../rxdbgridexportpdf.pas"/>
<Caret Line="53" Column="3" TopLine="38"/> <Caret Line="659" TopLine="648"/>
</Position30> </Position30>
</JumpHistory> </JumpHistory>
</ProjectSession> </ProjectSession>
<Debugging> <Debugging>
<BreakPoints Count="1"> <BreakPoints Count="4">
<Item1> <Item1>
<Kind Value="bpkSource"/> <Kind Value="bpkSource"/>
<WatchScope Value="wpsLocal"/> <WatchScope Value="wpsLocal"/>
@ -630,22 +664,32 @@
<Source Value="../../../lazutils/lazfreetypefontcollection.pas"/> <Source Value="../../../lazutils/lazfreetypefontcollection.pas"/>
<Line Value="423"/> <Line Value="423"/>
</Item1> </Item1>
</BreakPoints>
<Watches Count="4">
<Item1>
<Expression Value="fName"/>
</Item1>
<Item2> <Item2>
<Expression Value="C"/> <Kind Value="bpkSource"/>
<DisplayStyle Value="wdfHex"/> <WatchScope Value="wpsLocal"/>
<WatchKind Value="wpkWrite"/>
<Source Value="../../rxdbgridexportpdf.pas"/>
<Line Value="685"/>
</Item2> </Item2>
<Item3> <Item3>
<Expression Value="A"/> <Kind Value="bpkSource"/>
<WatchScope Value="wpsLocal"/>
<WatchKind Value="wpkWrite"/>
<Source Value="../../rxdbgridexportpdf.pas"/>
<Line Value="668"/>
</Item3> </Item3>
<Item4> <Item4>
<Expression Value="Result"/> <Kind Value="bpkSource"/>
<DisplayStyle Value="wdfHex"/> <WatchScope Value="wpsLocal"/>
<WatchKind Value="wpkWrite"/>
<Source Value="../../rxdbgridexportpdf.pas"/>
<Line Value="691"/>
</Item4> </Item4>
</BreakPoints>
<Watches Count="1">
<Item1>
<Expression Value="i"/>
</Item1>
</Watches> </Watches>
</Debugging> </Debugging>
</CONFIG> </CONFIG>

View File

@ -11,12 +11,12 @@ object Form1: TForm1
LCLVersion = '1.7' LCLVersion = '1.7'
object Panel1: TPanel object Panel1: TPanel
Left = 0 Left = 0
Height = 50 Height = 51
Top = 347 Top = 346
Width = 1043 Width = 1043
Align = alBottom Align = alBottom
AutoSize = True AutoSize = True
ClientHeight = 50 ClientHeight = 51
ClientWidth = 1043 ClientWidth = 1043
TabOrder = 0 TabOrder = 0
object Button1: TButton object Button1: TButton
@ -34,26 +34,50 @@ object Form1: TForm1
TabOrder = 0 TabOrder = 0
end end
object CheckBox1: TCheckBox object CheckBox1: TCheckBox
Left = 1 AnchorSideLeft.Control = Panel1
AnchorSideBottom.Control = Edit1
AnchorSideBottom.Side = asrBottom
Left = 7
Height = 24 Height = 24
Top = 18 Top = 20
Width = 99 Width = 85
Caption = 'CheckBox1' Anchors = [akLeft, akBottom]
BorderSpacing.Left = 6
Caption = 'Use filter'
OnChange = CheckBox1Change OnChange = CheckBox1Change
TabOrder = 1 TabOrder = 1
end end
object Edit1: TEdit object Edit1: TEdit
Left = 137 AnchorSideLeft.Control = Label1
AnchorSideLeft.Side = asrBottom
AnchorSideTop.Control = Panel1
AnchorSideRight.Control = Button1
Left = 247
Height = 37 Height = 37
Top = 7 Top = 7
Width = 295 Width = 223
Anchors = [akTop, akLeft, akRight]
BorderSpacing.Around = 6
TabOrder = 2 TabOrder = 2
Text = 'ID=1' Text = 'ID=1'
end end
object Label1: TLabel
AnchorSideLeft.Control = CheckBox1
AnchorSideLeft.Side = asrBottom
AnchorSideBottom.Control = Edit1
AnchorSideBottom.Side = asrBottom
Left = 92
Height = 20
Top = 24
Width = 149
Anchors = [akLeft, akBottom]
Caption = 'Enter filter expression^'
ParentColor = False
end
end end
object PageControl1: TPageControl object PageControl1: TPageControl
Left = 0 Left = 0
Height = 347 Height = 346
Top = 0 Top = 0
Width = 1043 Width = 1043
ActivePage = TabSheet1 ActivePage = TabSheet1
@ -62,11 +86,11 @@ object Form1: TForm1
TabOrder = 1 TabOrder = 1
object TabSheet1: TTabSheet object TabSheet1: TTabSheet
Caption = 'Test data' Caption = 'Test data'
ClientHeight = 313 ClientHeight = 312
ClientWidth = 1033 ClientWidth = 1033
object RxDBGrid1: TRxDBGrid object RxDBGrid1: TRxDBGrid
Left = 0 Left = 0
Height = 313 Height = 312
Top = 0 Top = 0
Width = 1033 Width = 1033
ColumnDefValues.BlobText = '(данные)' ColumnDefValues.BlobText = '(данные)'
@ -86,21 +110,6 @@ object Form1: TForm1
Filter.ItemIndex = -1 Filter.ItemIndex = -1
Footers = <> Footers = <>
end end
item
Color = clCream
Font.Color = clPurple
Title.Alignment = taCenter
Title.Orientation = toHorizontal
Title.Caption = 'Наименование продукта'
Width = 364
FieldName = 'NAME'
EditButtons = <>
Filter.DropDownRows = 0
Filter.EmptyValue = '(Нет)'
Filter.EmptyFont.Style = [fsItalic]
Filter.ItemIndex = -1
Footers = <>
end
item item
Color = clYellow Color = clYellow
Title.Alignment = taCenter Title.Alignment = taCenter
@ -115,6 +124,39 @@ object Form1: TForm1
Filter.ItemIndex = -1 Filter.ItemIndex = -1
Footers = <> Footers = <>
end end
item
Color = clCream
Font.Color = clPurple
Title.Alignment = taCenter
Title.Orientation = toHorizontal
Title.Caption = 'Наименование продукта'
Width = 364
FieldName = 'NAME'
EditButtons = <>
Filter.DropDownRows = 0
Filter.EmptyValue = '(Нет)'
Filter.EmptyFont.Style = [fsItalic]
Filter.ItemIndex = -1
Footer.Alignment = taRightJustify
Footer.Value = 'Итого:'
Footer.ValueType = fvtStaticText
Footers = <
item
Alignment = taRightJustify
Value = 'Итого:'
ValueType = fvtStaticText
end
item
Alignment = taRightJustify
Value = 'Минимум:'
ValueType = fvtStaticText
end
item
Alignment = taRightJustify
Value = 'Максимум:'
ValueType = fvtStaticText
end>
end
item item
Title.Alignment = taCenter Title.Alignment = taCenter
Title.Orientation = toHorizontal Title.Orientation = toHorizontal
@ -126,7 +168,29 @@ object Form1: TForm1
Filter.EmptyValue = '(Нет)' Filter.EmptyValue = '(Нет)'
Filter.EmptyFont.Style = [fsItalic] Filter.EmptyFont.Style = [fsItalic]
Filter.ItemIndex = -1 Filter.ItemIndex = -1
Footers = <> Footer.Alignment = taRightJustify
Footer.DisplayFormat = '#,##0.00'
Footer.FieldName = 'SUM'
Footer.ValueType = fvtSum
Footers = <
item
Alignment = taRightJustify
DisplayFormat = '#,##0.00'
FieldName = 'SUM'
ValueType = fvtSum
end
item
Alignment = taRightJustify
DisplayFormat = '#,##0.00'
FieldName = 'SUM'
ValueType = fvtMin
end
item
Alignment = taRightJustify
DisplayFormat = '#,##0.00'
FieldName = 'SUM'
ValueType = fvtMax
end>
end end
item item
Title.Alignment = taCenter Title.Alignment = taCenter
@ -210,11 +274,16 @@ object Form1: TForm1
ShortCut = 16451 ShortCut = 16451
Enabled = True Enabled = True
end> end>
FooterOptions.DrawFullLine = False FooterOptions.Active = True
OptionsRx = [rdgAllowColumnsForm, rdgAllowDialogFind, rdgAllowQuickFilter, rdgAllowToolMenu] FooterOptions.Color = clYellow
FooterOptions.RowCount = 3
FooterOptions.DrawFullLine = True
OptionsRx = [rdgAllowColumnsForm, rdgAllowDialogFind, rdgFooterRows, rdgAllowQuickFilter, rdgAllowToolMenu]
FooterColor = clYellow
FooterRowCount = 3
Align = alClient Align = alClient
Color = clWindow Color = clWindow
DrawFullLine = False DrawFullLine = True
FocusColor = clRed FocusColor = clRed
SelectedColor = clHighlight SelectedColor = clHighlight
GridLineStyle = psSolid GridLineStyle = psSolid
@ -226,7 +295,7 @@ object Form1: TForm1
end end
object TabSheet2: TTabSheet object TabSheet2: TTabSheet
Caption = 'Debug window' Caption = 'Debug window'
ClientHeight = 313 ClientHeight = 312
ClientWidth = 1033 ClientWidth = 1033
object Memo1: TMemo object Memo1: TMemo
Left = 0 Left = 0
@ -242,32 +311,39 @@ object Form1: TForm1
end end
end end
object RxMemoryData1: TRxMemoryData object RxMemoryData1: TRxMemoryData
Active = True
FieldDefs = < FieldDefs = <
item item
Name = 'ID' Name = 'ID'
DataType = ftAutoInc DataType = ftAutoInc
Precision = -1
end end
item item
Name = 'NAME' Name = 'NAME'
DataType = ftString DataType = ftString
Precision = -1
Size = 220 Size = 220
end end
item item
Name = 'PDATE' Name = 'PDATE'
DataType = ftDate DataType = ftDate
Precision = -1
end end
item item
Name = 'SUM' Name = 'SUM'
DataType = ftCurrency DataType = ftCurrency
Precision = 2
end end
item item
Name = 'Country' Name = 'Country'
DataType = ftString DataType = ftString
Precision = -1
Size = 100 Size = 100
end end
item item
Name = 'Sity' Name = 'Sity'
DataType = ftString DataType = ftString
Precision = -1
Size = 100 Size = 100
end> end>
PacketRecords = 0 PacketRecords = 0
@ -342,7 +418,6 @@ object Form1: TForm1
object RxDBGridExportPDF1: TRxDBGridExportPDF object RxDBGridExportPDF1: TRxDBGridExportPDF
RxDBGrid = RxDBGrid1 RxDBGrid = RxDBGrid1
Caption = 'Export to PDF file' Caption = 'Export to PDF file'
ShowSetupForm = True
FileName = 'test111.pdf' FileName = 'test111.pdf'
Options = [repExportTitle, repExportColors, repExportFooter] Options = [repExportTitle, repExportColors, repExportFooter]
PdfOptions.Options = [] PdfOptions.Options = []

View File

@ -18,6 +18,7 @@ type
CheckBox1: TCheckBox; CheckBox1: TCheckBox;
DataSource1: TDataSource; DataSource1: TDataSource;
Edit1: TEdit; Edit1: TEdit;
Label1: TLabel;
Memo1: TMemo; Memo1: TMemo;
PageControl1: TPageControl; PageControl1: TPageControl;
Panel1: TPanel; Panel1: TPanel;
@ -58,6 +59,7 @@ uses EasyLazFreeType, LazFreeTypeFontCollection,
procedure TForm1.FormCreate(Sender: TObject); procedure TForm1.FormCreate(Sender: TObject);
begin begin
RxDBGridExportPDF1.ShowSetupForm:=true;
PageControl1.ActivePageIndex:=0; PageControl1.ActivePageIndex:=0;
RxMemoryData1.Open; RxMemoryData1.Open;
RxMemoryData1.AppendRecord([1, 'Строка с длинным текстом 1', now, 100, 'Россия', 'Москва']); RxMemoryData1.AppendRecord([1, 'Строка с длинным текстом 1', now, 100, 'Россия', 'Москва']);
@ -119,6 +121,7 @@ end;
FontCollection.BeginUpdate; FontCollection.BeginUpdate;
try try
FindAllFiles(files, AFolder, '*.ttf', true); FindAllFiles(files, AFolder, '*.ttf', true);
//FindAllFiles(files, AFolder, '*.otf', true);
files.Sort; files.Sort;
for i := 0 to files.Count-1 do for i := 0 to files.Count-1 do
try try
@ -153,6 +156,7 @@ var
FFM: TCustomFamilyCollectionItem; FFM: TCustomFamilyCollectionItem;
I: Integer; I: Integer;
FFI: TCustomFontCollectionItem; FFI: TCustomFontCollectionItem;
tiInf: TFreeTypeInformation;
begin begin
FFM:=FontCollection.Family[AFontFamely]; FFM:=FontCollection.Family[AFontFamely];
if not Assigned(FFM) then if not Assigned(FFM) then
@ -171,7 +175,12 @@ begin
FFI:=FFM.GetFont('Regular'); FFI:=FFM.GetFont('Regular');
if Assigned(FFI) then if Assigned(FFI) then
ShowInfo('REGULAR Font in file %s - NAME: %s', [FFI.Filename, FFI.Information[ftiFullName]]) begin
ShowInfo('REGULAR Font in file %s - NAME: %s', [FFI.Filename, FFI.Information[ftiFullName]]);
for tiInf := Low(TFreeTypeInformation) to high(TFreeTypeInformation) do
ShowInfo('%s - %s', [FreeTypeInformationStr[tiInf], FFI.Information[tiInf]]);
end
else else
ShowInfo('Regular font not found', []); ShowInfo('Regular font not found', []);
end; end;
@ -187,6 +196,10 @@ begin
DumpFamaly('Sans'); DumpFamaly('Sans');
DumpFamaly('Serif'); DumpFamaly('Serif');
DumpFamaly('Liberation Sans'); DumpFamaly('Liberation Sans');
DumpFamaly('Gootville');
DumpFamaly('Oxygen Mono');
DumpFamaly('FreeSans');
DumpFamaly('Noto Sans Tai Viet');
end end
else else
Memo1.Text:='FontCollection not assigned'; Memo1.Text:='FontCollection not assigned';
@ -194,7 +207,9 @@ end;
procedure TForm1.Button1Click(Sender: TObject); procedure TForm1.Button1Click(Sender: TObject);
begin begin
RxDBGridExportPDF1.ShowSetupForm:=false;
RxDBGridExportPDF1.Execute; RxDBGridExportPDF1.Execute;
RxDBGridExportPDF1.ShowSetupForm:=true;
end; end;
procedure TForm1.CheckBox1Change(Sender: TObject); procedure TForm1.CheckBox1Change(Sender: TObject);

View File

@ -37,7 +37,8 @@ interface
{$IF (FPC_FULLVERSION >= 30101)} {$IF (FPC_FULLVERSION >= 30101)}
uses uses
Classes, SysUtils, DB, rxdbgrid, LazFreeTypeFontCollection, vclutils, Graphics, fpPDF, EasyLazFreeType; Classes, SysUtils, DB, rxdbgrid, LazFreeTypeFontCollection, vclutils, Graphics, fpPDF, EasyLazFreeType,
contnrs;
type type
@ -67,6 +68,56 @@ type
end; end;
type type
TRxDBGridExportPDF = class;
TExportFonts = class;
{ TExportFontItem }
TExportFontItem = class
private
FFontName: string;
FOwner:TExportFonts;
FBold: boolean;
FDefaultFont: boolean;
FFont: TFont;
//
FFreeTypeFont:TFreeTypeFont;
FPdfFont:integer;
function GetFontSize: Single;
procedure SetFontSize(AValue: Single);
public
constructor Create(AOwner:TExportFonts; AFont:TFont; AFreeTypeFont:TFreeTypeFont);
destructor Destroy; override;
procedure Activate;
property FontSize:Single read GetFontSize write SetFontSize;
property Bold:boolean read FBold;
property DefaultFont:boolean read FDefaultFont;
property FontName:string read FFontName;
end;
{ TExportFonts }
TExportFonts = class
private
FDefaultFontBold: TExportFontItem;
FDefaultFontNormal: TExportFontItem;
FOwner:TRxDBGridExportPDF;
FList:TFPList;
function GetCount: integer;
function GetItem(Index: integer): TExportFontItem;
public
constructor Create(AOwner:TRxDBGridExportPDF);
destructor Destroy; override;
procedure Clear;
function AddItem(AFont: TFont; AFontCollectionItem:TCustomFontCollectionItem; ADefStyle:TFontStyles = []): TExportFontItem;
function FindItem(AFont:TFont; ADefStyle:TFontStyles = []):TExportFontItem;
property DefaultFontNormal:TExportFontItem read FDefaultFontNormal;
property DefaultFontBold:TExportFontItem read FDefaultFontBold;
property Count:integer read GetCount;
property Item[Index:integer]:TExportFontItem read GetItem;
end;
{ TRxDBGridExportPDF } { TRxDBGridExportPDF }
@ -87,33 +138,33 @@ type
FWorkPagesNeedCount:integer; FWorkPagesNeedCount:integer;
FFontCollection:TFreeTypeFontCollection; FFontCollection:TFreeTypeFontCollection;
FFontItems:TExportFonts;
function GetPdfOptions: TPdfExportOptions; function GetPdfOptions: TPdfExportOptions;
procedure SetPageMargin(AValue: TRxPageMargin); procedure SetPageMargin(AValue: TRxPageMargin);
procedure SetPdfOptions(AValue: TPdfExportOptions); procedure SetPdfOptions(AValue: TPdfExportOptions);
function SelectFont(AFont:TFont):TExportFontItem;
function ActivateFont(AFont:TFont; AOwnerFont:TFont):TExportFontItem;
protected protected
FPDFDocument:TPDFDocument; FPDFDocument:TPDFDocument;
FCurSection: TPDFSection; FCurSection: TPDFSection;
FDataSet:TDataSet; FDataSet:TDataSet;
FPosY : integer; FPosY : integer;
FHeaderFont:integer; procedure DoSetupDocHeader;
FBodyFont:integer; procedure DoSetupFonts;
FFooterFont:integer;
FExportFontHeader: TFreeTypeFont;
FExportFontBody: TFreeTypeFont;
procedure WriteTextRect(AExportFont:TFreeTypeFont; X, Y, W, H:integer; AText:string; ATextAlign:TAlignment); procedure WriteTextRect(AExportFont:TExportFontItem; X, Y, W, H:integer; AText:string; ATextAlign:TAlignment);
procedure StartNewPage;
procedure DoExportPage;
procedure DoExportTitle; procedure DoExportTitle;
procedure DoExportBody; procedure DoExportBody;
procedure DoSetupFonts;
procedure DoExportFooter; procedure DoExportFooter;
procedure DoSaveDocument;
procedure DoSetupDocHeader;
procedure DoExportPage;
function DoExecTools:boolean;override; function DoExecTools:boolean;override;
function DoSetupTools:boolean; override; function DoSetupTools:boolean; override;
procedure DoSaveDocument;
// //
procedure InitFonts(AFontCollection:TFreeTypeFontCollection); procedure InitFonts(AFontCollection:TFreeTypeFontCollection);
public public
@ -145,6 +196,163 @@ begin
Result:={A[1] shl 24 +} A[1] shl 16 + A[2] shl 8 + A[3]; Result:={A[1] shl 24 +} A[1] shl 16 + A[2] shl 8 + A[3];
end; end;
{ TExportFonts }
function TExportFonts.GetCount: integer;
begin
Result:=FList.Count;
end;
function TExportFonts.GetItem(Index: integer): TExportFontItem;
begin
Result:=TExportFontItem(FList[Index]);
end;
constructor TExportFonts.Create(AOwner: TRxDBGridExportPDF);
begin
inherited Create;
FOwner:=AOwner;
FList:=TFPList.Create;
end;
destructor TExportFonts.Destroy;
begin
Clear;
FreeAndNil(FList);
inherited Destroy;
end;
procedure TExportFonts.Clear;
var
I: Integer;
begin
for I:=0 to FList.Count-1 do
TExportFontItem(FList[i]).Free;
FList.Clear;
end;
function TExportFonts.AddItem(AFont: TFont;
AFontCollectionItem: TCustomFontCollectionItem; ADefStyle: TFontStyles
): TExportFontItem;
var
S1, S2, S3: String;
begin
Result:=nil;
if not Assigned(AFont) then exit;
Result:=FindItem(AFont, ADefStyle);
if not Assigned(AFont) then exit;
Result:=TExportFontItem.Create(Self, AFont, AFontCollectionItem.CreateFont);
S1:=ExtractFileDir(AFontCollectionItem.Filename);
S2:=ExtractFileName(AFontCollectionItem.Filename);
S3:=AFontCollectionItem.Information[ftiFullName];
FOwner.FPDFDocument.FontDirectory:=S1;
Result.FPdfFont:=FOwner.FPDFDocument.AddFont(S2, S3);
end;
function TExportFonts.FindItem(AFont: TFont; ADefStyle: TFontStyles
): TExportFontItem;
var
K: TExportFontItem;
i: Integer;
begin
Result:=nil;
if not Assigned(AFont) then exit;
if ADefStyle = [] then
ADefStyle:=AFont.Style;
if AFont.Name = 'default' then
begin
for i:=0 to FList.Count - 1 do
begin
//Стили!
K:=TExportFontItem(FList[i]);
if K.DefaultFont then
begin
if (fsBold in ADefStyle) and K.Bold then
begin
Result:=K;
exit;
end
else
if (not (fsBold in ADefStyle)) and not K.Bold then
begin
Result:=K;
exit;
end;
end;
end;
end
else
begin
for i:=0 to FList.Count-1 do
begin
K:=TExportFontItem(FList[i]);
if K.FontName = AFont.Name then
begin
if (fsBold in ADefStyle) and K.Bold then
begin
Result:=K;
exit;
end
else
if (not (fsBold in ADefStyle)) and not K.Bold then
begin
Result:=K;
exit;
end;
end;
end;
end;
end;
{ TExportFontItem }
function TExportFontItem.GetFontSize: Single;
begin
Result:=FFreeTypeFont.SizeInPixels;
end;
procedure TExportFontItem.SetFontSize(AValue: Single);
begin
FFreeTypeFont.SizeInPixels:=AValue;
end;
constructor TExportFontItem.Create(AOwner: TExportFonts; AFont: TFont;
AFreeTypeFont: TFreeTypeFont);
begin
inherited Create;
FOwner:=AOwner;
FOwner.FList.Add(Self);
FFont:=AFont;
FFreeTypeFont:=AFreeTypeFont;
FFontName:=AFont.Name;
end;
destructor TExportFontItem.Destroy;
begin
FreeAndNil(FFreeTypeFont);
inherited Destroy;
end;
procedure TExportFontItem.Activate;
var
FS: Integer;
begin
if FFont.Size = 0 then
FS:=10
else
FS:=FFont.Size;
FFreeTypeFont.SizeInPoints:=FS;
FOwner.FOwner.FCurPage.SetFont(FPdfFont, FS);
FOwner.FOwner.FCurPage.SetColor(ColorToDdfColor(FFont.Color), false);
end;
{ TPdfExportOptions } { TPdfExportOptions }
procedure TPdfExportOptions.AssignTo(Dest: TPersistent); procedure TPdfExportOptions.AssignTo(Dest: TPersistent);
@ -184,15 +392,44 @@ begin
FPdfOptions.Assign(AValue); FPdfOptions.Assign(AValue);
end; end;
procedure TRxDBGridExportPDF.WriteTextRect(AExportFont: TFreeTypeFont; X, Y, W, function TRxDBGridExportPDF.SelectFont(AFont: TFont): TExportFontItem;
H: integer; AText: string; ATextAlign: TAlignment); var
i: Integer;
begin
Result:=nil;
for i:=0 to FFontItems.Count-1 do
if FFontItems.Item[i].FFont = AFont then
begin
Result:=FFontItems.Item[i];
Exit;
end;
end;
function TRxDBGridExportPDF.ActivateFont(AFont: TFont; AOwnerFont: TFont
): TExportFontItem;
begin
Result:=SelectFont(AFont);
if not Assigned(Result) then
Result:=SelectFont(AOwnerFont);
if not Assigned(Result) then
Result:=FFontItems.FDefaultFontNormal;
if Assigned(Result) then
Result.Activate
else
raise Exception.Create('Font not found');
end;
procedure TRxDBGridExportPDF.WriteTextRect(AExportFont: TExportFontItem; X, Y,
W, H: integer; AText: string; ATextAlign: TAlignment);
var var
FTW, FTH: Single; FTW, FTH: Single;
X1: TPDFFloat; X1: TPDFFloat;
Y1: TPDFFloat; Y1: TPDFFloat;
begin begin
FTW:=AExportFont.TextWidth(AText); FTW:=AExportFont.FFreeTypeFont.TextWidth(AText);
FTH:=AExportFont.TextHeight(AText); FTH:=AExportFont.FFreeTypeFont.TextHeight(AText);
case ATextAlign of case ATextAlign of
taLeftJustify: taLeftJustify:
begin begin
@ -217,6 +454,24 @@ begin
FCurPage.WriteText(X1, Y1 - FTH, AText); FCurPage.WriteText(X1, Y1 - FTH, AText);
end; end;
procedure TRxDBGridExportPDF.StartNewPage;
var
P: TPDFPage;
i: Integer;
begin
FWorkPages.Clear;
for i:=0 to FWorkPagesNeedCount - 1 do
begin
P := FPDFDocument.Pages.AddPage;
P.PaperType := FPdfOptions.PaperType;
P.UnitOfMeasure := uomPixels;
FCurSection.AddPage(P);
FWorkPages.Add(P);
end;
FPosY:=FPageMargin.Top + 20;
end;
procedure TRxDBGridExportPDF.DoExportTitle; procedure TRxDBGridExportPDF.DoExportTitle;
var var
i, X, CP: Integer; i, X, CP: Integer;
@ -231,24 +486,23 @@ begin
for i:=0 to FRxDBGrid.Columns.Count - 1 do for i:=0 to FRxDBGrid.Columns.Count - 1 do
begin begin
C:=FRxDBGrid.Columns[i]; C:=FRxDBGrid.Columns[i];
if C.Visible then
if X + C.Width > FPageWidth - FPageMargin.Right then
begin begin
Inc(CP); if X + C.Width > FPageWidth - FPageMargin.Right then
FCurPage:=TPDFPage(FWorkPages[CP]); begin
X:=FPageMargin.Left; Inc(CP);
FCurPage:=TPDFPage(FWorkPages[CP]);
X:=FPageMargin.Left;
end;
FCurPage.SetColor(ColorToDdfColor(FRxDBGrid.BorderColor), true);
FCurPage.DrawRect(X, FPosY, C.Width, FRxDBGrid.DefaultRowHeight, 1, false, true);
WriteTextRect(ActivateFont(C.Title.Font, FRxDBGrid.TitleFont), X, FPosY, C.Width, FRxDBGrid.DefaultRowHeight, C.Title.Caption, C.Title.Alignment);
X:=X + C.Width;
end; end;
FCurPage.SetColor(ColorToDdfColor(FRxDBGrid.BorderColor), true);
FCurPage.DrawRect(X, FPosY, C.Width, FRxDBGrid.DefaultRowHeight, 1, false, true);
FCurPage.SetFont(FHeaderFont, 10);
FExportFontHeader.SizeInPoints:=10;
FCurPage.SetColor(ColorToDdfColor(C.Title.Font.Color), false);
WriteTextRect(FExportFontHeader, X, FPosY, C.Width, FRxDBGrid.DefaultRowHeight, C.Title.Caption, C.Title.Alignment);
X:=X + C.Width;
end; end;
Inc(FPosY, FRxDBGrid.DefaultRowHeight); Inc(FPosY, FRxDBGrid.DefaultRowHeight);
@ -269,26 +523,24 @@ begin
for i:=0 to FRxDBGrid.Columns.Count - 1 do for i:=0 to FRxDBGrid.Columns.Count - 1 do
begin begin
C:=FRxDBGrid.Columns[i]; C:=FRxDBGrid.Columns[i];
if X + C.Width > FPageWidth - FPageMargin.Right then if C.Visible then
begin begin
Inc(CP); if X + C.Width > FPageWidth - FPageMargin.Right then
FCurPage:=TPDFPage(FWorkPages[CP]); begin
X:=FPageMargin.Left; Inc(CP);
FCurPage:=TPDFPage(FWorkPages[CP]);
X:=FPageMargin.Left;
end;
FCurPage.SetColor(ColorToDdfColor(FRxDBGrid.BorderColor), true); //Border
FCurPage.SetColor(ColorToDdfColor(C.Color), false); // Fill color
FCurPage.DrawRect(X, FPosY, C.Width, FRxDBGrid.DefaultRowHeight, 1, true, true);
if Assigned(C.Field) then
WriteTextRect(ActivateFont(C.Font, FRxDBGrid.Font), X, FPosY, C.Width, FRxDBGrid.DefaultRowHeight, C.Field.DisplayText, C.Alignment);
X:=X + C.Width;
end; end;
FCurPage.SetColor(ColorToDdfColor(FRxDBGrid.BorderColor), true); //Border
FCurPage.SetColor(ColorToDdfColor(C.Color), false); // Fill color
FCurPage.DrawRect(X, FPosY, C.Width, FRxDBGrid.DefaultRowHeight, 1, true, true);
if Assigned(C.Field) then
begin
FCurPage.SetFont(FBodyFont, 10);
FExportFontBody.SizeInPoints:=10;
FCurPage.SetColor(ColorToDdfColor(C.Font.Color), false);
WriteTextRect(FExportFontBody, X, FPosY, C.Width, FRxDBGrid.DefaultRowHeight, C.Field.DisplayText, C.Alignment);
end;
X:=X + C.Width;
end; end;
end; end;
@ -299,24 +551,48 @@ begin
FDataSet.Next; FDataSet.Next;
Inc(FPosY, FRxDBGrid.DefaultRowHeight); Inc(FPosY, FRxDBGrid.DefaultRowHeight);
if FPosY > FPageHeight - FPageMargin.Bottom then if FPosY > FPageHeight - FPageMargin.Bottom then
begin { begin
FPosY:=FPageMargin.Top + 20; FPosY:=FPageMargin.Top + 20;}
exit; exit;
end; // end;
end; end;
end; end;
procedure TRxDBGridExportPDF.DoSetupFonts; procedure TRxDBGridExportPDF.DoSetupFonts;
procedure AddFonts(AFont:TFont);
var var
FM: TCustomFamilyCollectionItem; FM: TCustomFamilyCollectionItem;
FIH, FI: TCustomFontCollectionItem; S: String;
B: Boolean; FIH: TCustomFontCollectionItem;
begin begin
FExportFontHeader:=nil; S:=AFont.Name;
FFontCollection:=TFreeTypeFontCollection.Create; FM:=FFontCollection.Family[S];
InitFonts(FFontCollection); if Assigned(FM) then
begin
if fsBold in AFont.Style then
FIH:=FM.GetFont('Bold')
else
FIH:=FM.GetFont('Regular');
FM:=FFontCollection.Family['Liberation Sans']; if Assigned(FIH) then
FFontItems.AddItem(AFont, FIH);
end;
end;
var
FM: TCustomFamilyCollectionItem;
FIH: TCustomFontCollectionItem;
F: TExportFontItem;
i: Integer;
begin
InitFonts(FFontCollection);
FM:=nil;
if FRxDBGrid.Font.Name <> 'default' then
FM:=FFontCollection.Family[FRxDBGrid.Font.Name];
if not Assigned(FM) then //Fill default fonts
FM:=FFontCollection.Family['Liberation Sans'];
if not Assigned(FM) then if not Assigned(FM) then
FM:=FFontCollection.Family['Arial']; FM:=FFontCollection.Family['Arial'];
@ -325,35 +601,98 @@ begin
FIH:=FM.GetFont('Bold'); FIH:=FM.GetFont('Bold');
if Assigned(FIH) then if Assigned(FIH) then
begin begin
B:=FIH.Bold; F:=FFontItems.AddItem(FRxDBGrid.TitleFont, FIH, [fsBold]);
FPDFDocument.FontDirectory := ExtractFileDir(FIH.Filename); F.FBold:=true;
FHeaderFont := FPDFDocument.AddFont(ExtractFileName(FIH.Filename), FIH.Information[ftiFullName]); F.FDefaultFont:=true;
FExportFontHeader:=FIH.CreateFont; FFontItems.FDefaultFontBold:=F;
end; end;
FI:=FM.GetFont('Regular'); FIH:=FM.GetFont('Regular');
if Assigned(FI) then if Assigned(FIH) then
begin begin
B:=FI.Bold; F:=FFontItems.AddItem(FRxDBGrid.Font, FIH, []);
FPDFDocument.FontDirectory := ExtractFileDir(FI.Filename); F.FDefaultFont:=true;
FBodyFont := FPDFDocument.AddFont(ExtractFileName(FI.Filename), FI.Information[ftiFullName]); FFontItems.FDefaultFontNormal:=F;
FExportFontBody:=FI.CreateFont;
end; end;
if not Assigned(FIH) then
FHeaderFont:=FBodyFont;
FFooterFont := FHeaderFont;
end; end;
FFontCollection.Free;
if not Assigned(FM) then if not Assigned(FM) then
raise Exception.Create('Not found Sans font'); raise Exception.Create('Not found Sans font');
for i:=0 to FRxDBGrid.Columns.Count-1 do
begin
if FRxDBGrid.Columns[i].Font.Name <> 'default' then
AddFonts(FRxDBGrid.Columns[i].Font);
if FRxDBGrid.Columns[i].Footer.Font.Name <> 'default' then
AddFonts(FRxDBGrid.Columns[i].Footer.Font);
if FRxDBGrid.Columns[i].Title.Font.Name <> 'default' then
AddFonts(FRxDBGrid.Columns[i].Title.Font);
end;
end; end;
procedure TRxDBGridExportPDF.DoExportFooter; procedure TRxDBGridExportPDF.DoExportFooter;
begin
procedure WriteFooterRow(AFooterRow:Integer);
var
i, X, CP, FS: Integer;
S: String;
C: TRxColumn;
begin
X:=FPageWidth + FPageMargin.Right;
CP:=-1;
FCurPage:=nil;
for i:=0 to FRxDBGrid.Columns.Count - 1 do
begin
C:=FRxDBGrid.Columns[i];
if C.Visible then
begin
if X + C.Width > FPageWidth - FPageMargin.Right then
begin
Inc(CP);
FCurPage:=TPDFPage(FWorkPages[CP]);
X:=FPageMargin.Left;
end;
FCurPage.SetColor(ColorToDdfColor(FRxDBGrid.BorderColor), true); //Border
FCurPage.SetColor(ColorToDdfColor(FRxDBGrid.FooterOptions.Color), false); // Fill color
FCurPage.DrawRect(X, FPosY, C.Width, FRxDBGrid.DefaultRowHeight, 1, true, true);
if FRxDBGrid.FooterOptions.RowCount = 1 then
S:=C.Footer.DisplayText
else
begin
if C.Footers.Count > AFooterRow then
S:=C.Footers[AFooterRow].DisplayText
else
S:='';
end;
if (S<>'') then
WriteTextRect(ActivateFont(C.Footer.Font, FRxDBGrid.Font), X, FPosY, C.Width, FRxDBGrid.DefaultRowHeight, S, C.Footer.Alignment);
X:=X + C.Width;
end;
end;
Inc(FPosY, FRxDBGrid.DefaultRowHeight);
end;
var
j: Integer;
begin
if FRxDBGrid.FooterRowCount = 1 then
WriteFooterRow(1)
else
begin
for j:=0 to FRxDBGrid.FooterRowCount-1 do
begin
if FPosY > FPageHeight - FPageMargin.Bottom then
StartNewPage;
WriteFooterRow(j);
end;
end;
end; end;
procedure TRxDBGridExportPDF.DoSetupDocHeader; procedure TRxDBGridExportPDF.DoSetupDocHeader;
@ -390,12 +729,15 @@ begin
for i:=0 to FRxDBGrid.Columns.Count - 1 do for i:=0 to FRxDBGrid.Columns.Count - 1 do
begin begin
C:=FRxDBGrid.Columns[i]; C:=FRxDBGrid.Columns[i];
if W + C.Width > FPageWidth - FPageMargin.Right then if C.Visible then
begin begin
Inc(FWorkPagesNeedCount); if W + C.Width > FPageWidth - FPageMargin.Right then
W:=FPageMargin.Left; begin
Inc(FWorkPagesNeedCount);
W:=FPageMargin.Left;
end;
W:=W + C.Width;
end; end;
W:=W + C.Width;
end; end;
end; end;
end; end;
@ -405,21 +747,10 @@ var
P: TPDFPage; P: TPDFPage;
i: Integer; i: Integer;
begin begin
FWorkPages.Clear; StartNewPage;
for i:=0 to FWorkPagesNeedCount - 1 do
begin
P := FPDFDocument.Pages.AddPage;
P.PaperType := FPdfOptions.PaperType;
P.UnitOfMeasure := uomPixels;
FCurSection.AddPage(P);
FWorkPages.Add(P);
end;
FPosY:=FPageMargin.Top + 20;
if repExportTitle in FOptions then if repExportTitle in FOptions then
DoExportTitle; DoExportTitle;
DoExportBody; DoExportBody;
end; end;
@ -436,7 +767,9 @@ begin
P:=FDataSet.Bookmark; P:=FDataSet.Bookmark;
{$ENDIF} {$ENDIF}
FFontCollection:=TFreeTypeFontCollection.Create;
FPDFDocument:=TPDFDocument.Create(nil); FPDFDocument:=TPDFDocument.Create(nil);
FFontItems:=TExportFonts.Create(Self);
FWorkPages:=TFPList.Create; FWorkPages:=TFPList.Create;
try try
DoSetupFonts; DoSetupFonts;
@ -448,6 +781,14 @@ begin
DoExportPage; DoExportPage;
until FDataSet.EOF; until FDataSet.EOF;
if repExportTitle in FOptions then
begin
if FPosY > FPageHeight - FPageMargin.Bottom then
StartNewPage;
DoExportFooter;
end;
DoSaveDocument; DoSaveDocument;
Result:=true; Result:=true;
finally finally
@ -461,9 +802,8 @@ begin
FreeAndNil(FWorkPages); FreeAndNil(FWorkPages);
FreeAndNil(FPDFDocument); FreeAndNil(FPDFDocument);
FreeAndNil(FFontItems);
if Assigned(FExportFontHeader) then FreeAndNil(FFontCollection);
FreeAndNil(FExportFontHeader);
end; end;
if Result and FOpenAfterExport then if Result and FOpenAfterExport then
@ -476,6 +816,7 @@ begin
RxDBGridExportPdfSetupForm.FileNameEdit1.FileName:=FileName; RxDBGridExportPdfSetupForm.FileNameEdit1.FileName:=FileName;
RxDBGridExportPdfSetupForm.cbOpenAfterExport.Checked:=FOpenAfterExport; RxDBGridExportPdfSetupForm.cbOpenAfterExport.Checked:=FOpenAfterExport;
RxDBGridExportPdfSetupForm.cbExportColumnHeader.Checked:=repExportTitle in FOptions; RxDBGridExportPdfSetupForm.cbExportColumnHeader.Checked:=repExportTitle in FOptions;
RxDBGridExportPdfSetupForm.cbExportColumnFooter.Checked:=repExportFooter in FOptions;
Result:=RxDBGridExportPdfSetupForm.ShowModal = mrOk; Result:=RxDBGridExportPdfSetupForm.ShowModal = mrOk;
if Result then if Result then
@ -486,6 +827,11 @@ begin
FOptions:=FOptions + [repExportTitle] FOptions:=FOptions + [repExportTitle]
else else
FOptions:=FOptions - [repExportTitle]; FOptions:=FOptions - [repExportTitle];
if RxDBGridExportPdfSetupForm.cbExportColumnFooter.Checked then
FOptions:=FOptions + [repExportFooter]
else
FOptions:=FOptions - [repExportFooter];
end; end;
RxDBGridExportPdfSetupForm.Free; RxDBGridExportPdfSetupForm.Free;
end; end;

View File

@ -74,7 +74,6 @@ object RxDBGridExportPdfSetupForm: TRxDBGridExportPdfSetupForm
Width = 162 Width = 162
BorderSpacing.Around = 6 BorderSpacing.Around = 6
Caption = 'Export column footer' Caption = 'Export column footer'
Enabled = False
TabOrder = 3 TabOrder = 3
end end
object cbExportCellColors: TCheckBox object cbExportCellColors: TCheckBox