RxFPC: RxDBGrid - fix export to pdf

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@5833 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
alexs75
2017-04-12 11:29:56 +00:00
parent e9ca7a1e2d
commit f39df9a19f
8 changed files with 1193 additions and 1036 deletions

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<CONFIG> <CONFIG>
<ProjectOptions> <ProjectOptions>
<Version Value="9"/> <Version Value="10"/>
<General> <General>
<SessionStorage Value="InProjectDir"/> <SessionStorage Value="InProjectDir"/>
<MainUnit Value="0"/> <MainUnit Value="0"/>
@ -10,9 +10,6 @@
<UseXPManifest Value="True"/> <UseXPManifest Value="True"/>
<Icon Value="0"/> <Icon Value="0"/>
</General> </General>
<VersionInfo>
<StringTable ProductVersion=""/>
</VersionInfo>
<BuildModes Count="1"> <BuildModes Count="1">
<Item1 Name="Default" Default="True"/> <Item1 Name="Default" Default="True"/>
</BuildModes> </BuildModes>

View File

@ -1,15 +1,15 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<CONFIG> <CONFIG>
<ProjectSession> <ProjectSession>
<Version Value="9"/> <Version Value="10"/>
<BuildModes Active="Default"/> <BuildModes Active="Default"/>
<Units Count="87"> <Units Count="92">
<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="118"/> <UsageCount Value="120"/>
</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"/>
<IsVisibleTab Value="True"/> <TopLine Value="132"/>
<CursorPos X="3" Y="9"/> <CursorPos X="35" Y="137"/>
<UsageCount Value="118"/> <UsageCount Value="120"/>
<Loaded Value="True"/> <Loaded Value="True"/>
<LoadedDesigner Value="True"/> <LoadedDesigner Value="True"/>
</Unit1> </Unit1>
@ -242,14 +242,14 @@
<UsageCount Value="10"/> <UsageCount Value="10"/>
</Unit29> </Unit29>
<Unit30> <Unit30>
<Filename Value="C:/lazarus/components/lazutils/easylazfreetype.pas"/> <Filename Value="../../../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="4"/> <UsageCount Value="4"/>
</Unit30> </Unit30>
<Unit31> <Unit31>
<Filename Value="C:/lazarus/components/lazutils/lazfreetypefontcollection.pas"/> <Filename Value="../../../lazutils/lazfreetypefontcollection.pas"/>
<UnitName Value="LazFreeTypeFontCollection"/> <UnitName Value="LazFreeTypeFontCollection"/>
<EditorIndex Value="-1"/> <EditorIndex Value="-1"/>
<TopLine Value="127"/> <TopLine Value="127"/>
@ -393,10 +393,11 @@
<Unit50> <Unit50>
<Filename Value="../../../../lcl/grids.pas"/> <Filename Value="../../../../lcl/grids.pas"/>
<UnitName Value="Grids"/> <UnitName Value="Grids"/>
<EditorIndex Value="-1"/> <EditorIndex Value="2"/>
<TopLine Value="4258"/> <TopLine Value="11502"/>
<CursorPos X="3" Y="4247"/> <CursorPos Y="11522"/>
<UsageCount Value="14"/> <UsageCount Value="14"/>
<Loaded Value="True"/>
</Unit50> </Unit50>
<Unit51> <Unit51>
<Filename Value="../../../lazutils/lazfreetype.pas"/> <Filename Value="../../../lazutils/lazfreetype.pas"/>
@ -670,40 +671,168 @@
<CursorPos X="11" Y="13"/> <CursorPos X="11" Y="13"/>
<UsageCount Value="10"/> <UsageCount Value="10"/>
</Unit86> </Unit86>
<Unit87>
<Filename Value="../../rxdb/rxdbgridexportpdf.pas"/>
<UnitName Value="RxDBGridExportPdf"/>
<IsVisibleTab Value="True"/>
<EditorIndex Value="1"/>
<TopLine Value="409"/>
<CursorPos X="24" Y="412"/>
<UsageCount Value="11"/>
<Loaded Value="True"/>
</Unit87>
<Unit88>
<Filename Value="E:/install/source/fpcsrc/packages/fcl-pdf/src/fppdf.pp"/>
<UnitName Value="fpPDF"/>
<EditorIndex Value="3"/>
<TopLine Value="1026"/>
<CursorPos X="15" Y="1039"/>
<UsageCount Value="11"/>
<Loaded Value="True"/>
</Unit88>
<Unit89>
<Filename Value="../../../../../1/fcl-pdf/fpmake.pp"/>
<EditorIndex Value="-1"/>
<UsageCount Value="10"/>
</Unit89>
<Unit90>
<Filename Value="../../../../../1/fcl-pdf/examples/testfppdf.lpr"/>
<EditorIndex Value="4"/>
<TopLine Value="75"/>
<CursorPos Y="81"/>
<UsageCount Value="11"/>
<Loaded Value="True"/>
</Unit90>
<Unit91>
<Filename Value="E:/install/source/fpcsrc/packages/fcl-pdf/src/fpttf.pp"/>
<UnitName Value="fpTTF"/>
<EditorIndex Value="-1"/>
<TopLine Value="433"/>
<CursorPos X="3" Y="438"/>
<UsageCount Value="10"/>
</Unit91>
</Units> </Units>
<JumpHistory Count="8" HistoryIndex="7"> <JumpHistory Count="30" HistoryIndex="29">
<Position1> <Position1>
<Filename Value="unit1.pas"/> <Filename Value="../../rxdb/rxdbgridexportpdf.pas"/>
<Caret Line="96" Column="3" TopLine="80"/> <Caret Line="463" TopLine="438"/>
</Position1> </Position1>
<Position2> <Position2>
<Filename Value="unit1.pas"/> <Filename Value="../../rxdb/rxdbgridexportpdf.pas"/>
<Caret Line="96" Column="3" TopLine="80"/> <Caret Line="464" TopLine="438"/>
</Position2> </Position2>
<Position3> <Position3>
<Filename Value="unit1.pas"/> <Filename Value="../../rxdb/rxdbgridexportpdf.pas"/>
<Caret Line="95" Column="3" TopLine="79"/> <Caret Line="465" TopLine="439"/>
</Position3> </Position3>
<Position4> <Position4>
<Filename Value="unit1.pas"/> <Filename Value="../../../../../1/fcl-pdf/examples/testfppdf.lpr"/>
<Caret Line="94" Column="3" TopLine="78"/> <Caret Line="204" Column="3" TopLine="136"/>
</Position4> </Position4>
<Position5> <Position5>
<Filename Value="unit1.pas"/> <Filename Value="../../../../../1/fcl-pdf/examples/testfppdf.lpr"/>
<Caret Line="93" Column="3" TopLine="77"/> <Caret Line="53" Column="17" TopLine="27"/>
</Position5> </Position5>
<Position6> <Position6>
<Filename Value="unit1.pas"/> <Filename Value="../../../../../1/fcl-pdf/examples/testfppdf.lpr"/>
<Caret Line="99" Column="59" TopLine="77"/> <Caret Line="776" Column="3" TopLine="757"/>
</Position6> </Position6>
<Position7> <Position7>
<Filename Value="unit1.pas"/> <Filename Value="../../../../../1/fcl-pdf/examples/testfppdf.lpr"/>
<Caret Line="99" Column="59" TopLine="77"/> <Caret Line="40" Column="17" TopLine="39"/>
</Position7> </Position7>
<Position8> <Position8>
<Filename Value="unit1.pas"/> <Filename Value="../../rxdb/rxdbgridexportpdf.pas"/>
<Caret Line="9" Column="3"/> <Caret Line="457" Column="21" TopLine="441"/>
</Position8> </Position8>
<Position9>
<Filename Value="../../rxdb/rxdbgridexportpdf.pas"/>
<Caret Line="159" Column="15" TopLine="148"/>
</Position9>
<Position10>
<Filename Value="../../rxdb/rxdbgridexportpdf.pas"/>
<Caret Line="795" TopLine="783"/>
</Position10>
<Position11>
<Filename Value="../../rxdb/rxdbgridexportpdf.pas"/>
<Caret Line="670" Column="18" TopLine="644"/>
</Position11>
<Position12>
<Filename Value="../../rxdb/rxdbgridexportpdf.pas"/>
<Caret Line="162" Column="15" TopLine="157"/>
</Position12>
<Position13>
<Filename Value="../../rxdb/rxdbgridexportpdf.pas"/>
<Caret Line="410" Column="3" TopLine="420"/>
</Position13>
<Position14>
<Filename Value="../../rxdb/rxdbgridexportpdf.pas"/>
<Caret Line="163" Column="15" TopLine="147"/>
</Position14>
<Position15>
<Filename Value="../../rxdb/rxdbgridexportpdf.pas"/>
<Caret Line="465" Column="27" TopLine="449"/>
</Position15>
<Position16>
<Filename Value="../../rxdb/rxdbgridexportpdf.pas"/>
<Caret Line="162" Column="15" TopLine="148"/>
</Position16>
<Position17>
<Filename Value="../../rxdb/rxdbgridexportpdf.pas"/>
<Caret Line="441" Column="43" TopLine="418"/>
</Position17>
<Position18>
<Filename Value="../../rxdb/rxdbgridexportpdf.pas"/>
<Caret Line="163" Column="15" TopLine="148"/>
</Position18>
<Position19>
<Filename Value="../../rxdb/rxdbgridexportpdf.pas"/>
<Caret Line="459" Column="3" TopLine="449"/>
</Position19>
<Position20>
<Filename Value="../../rxdb/rxdbgridexportpdf.pas"/>
<Caret Line="164" Column="15" TopLine="148"/>
</Position20>
<Position21>
<Filename Value="../../rxdb/rxdbgridexportpdf.pas"/>
<Caret Line="477" Column="3" TopLine="470"/>
</Position21>
<Position22>
<Filename Value="../../rxdb/rxdbgridexportpdf.pas"/>
<Caret Line="164" Column="15" TopLine="149"/>
</Position22>
<Position23>
<Filename Value="../../rxdb/rxdbgridexportpdf.pas"/>
<Caret Line="512" Column="49" TopLine="487"/>
</Position23>
<Position24>
<Filename Value="../../rxdb/rxdbgridexportpdf.pas"/>
<Caret Line="163" Column="15" TopLine="150"/>
</Position24>
<Position25>
<Filename Value="../../rxdb/rxdbgridexportpdf.pas"/>
<Caret Line="465" Column="24" TopLine="449"/>
</Position25>
<Position26>
<Filename Value="../../rxdb/rxdbgridexportpdf.pas"/>
<Caret Line="169" Column="15" TopLine="148"/>
</Position26>
<Position27>
<Filename Value="../../rxdb/rxdbgridexportpdf.pas"/>
<Caret Line="551" Column="8" TopLine="542"/>
</Position27>
<Position28>
<Filename Value="../../rxdb/rxdbgridexportpdf.pas"/>
<Caret Line="170" Column="15" TopLine="156"/>
</Position28>
<Position29>
<Filename Value="../../rxdb/rxdbgridexportpdf.pas"/>
<Caret Line="663" Column="71" TopLine="638"/>
</Position29>
<Position30>
<Filename Value="../../rxdb/rxdbgridexportpdf.pas"/>
<Caret Line="162" Column="15" TopLine="146"/>
</Position30>
</JumpHistory> </JumpHistory>
</ProjectSession> </ProjectSession>
<Debugging> <Debugging>
@ -723,10 +852,13 @@
<Line Value="320"/> <Line Value="320"/>
</Item2> </Item2>
</BreakPoints> </BreakPoints>
<Watches Count="1"> <Watches Count="2">
<Item1> <Item1>
<Expression Value="i"/> <Expression Value="i"/>
</Item1> </Item1>
<Item2>
<Expression Value="FPosY"/>
</Item2>
</Watches> </Watches>
</Debugging> </Debugging>
</CONFIG> </CONFIG>

View File

@ -8,25 +8,25 @@ object Form1: TForm1
ClientWidth = 1043 ClientWidth = 1043
OnClose = FormClose OnClose = FormClose
OnCreate = FormCreate OnCreate = FormCreate
LCLVersion = '1.7' LCLVersion = '1.9.0.0'
object Panel1: TPanel object Panel1: TPanel
Left = 0 Left = 0
Height = 50 Height = 37
Top = 347 Top = 360
Width = 1043 Width = 1043
Align = alBottom Align = alBottom
AutoSize = True AutoSize = True
ClientHeight = 50 ClientHeight = 37
ClientWidth = 1043 ClientWidth = 1043
TabOrder = 0 TabOrder = 0
object Button1: TButton object Button1: TButton
AnchorSideLeft.Control = Panel1 AnchorSideLeft.Control = Panel1
AnchorSideLeft.Side = asrCenter AnchorSideLeft.Side = asrCenter
AnchorSideTop.Control = Panel1 AnchorSideTop.Control = Panel1
Left = 476 Left = 481
Height = 36 Height = 23
Top = 7 Top = 7
Width = 90 Width = 81
AutoSize = True AutoSize = True
BorderSpacing.Around = 6 BorderSpacing.Around = 6
Caption = 'Create PDF' Caption = 'Create PDF'
@ -36,7 +36,7 @@ object Form1: TForm1
end end
object PageControl1: TPageControl object PageControl1: TPageControl
Left = 0 Left = 0
Height = 347 Height = 360
Top = 0 Top = 0
Width = 1043 Width = 1043
ActivePage = TabSheet1 ActivePage = TabSheet1
@ -45,13 +45,13 @@ object Form1: TForm1
TabOrder = 1 TabOrder = 1
object TabSheet1: TTabSheet object TabSheet1: TTabSheet
Caption = 'Test data' Caption = 'Test data'
ClientHeight = 313 ClientHeight = 334
ClientWidth = 1033 ClientWidth = 1035
object RxDBGrid1: TRxDBGrid object RxDBGrid1: TRxDBGrid
Left = 0 Left = 0
Height = 313 Height = 334
Top = 0 Top = 0
Width = 1033 Width = 1035
ColumnDefValues.BlobText = '(данные)' ColumnDefValues.BlobText = '(данные)'
TitleButtons = True TitleButtons = True
AutoSort = True AutoSort = True
@ -63,8 +63,11 @@ object Form1: TForm1
Width = 50 Width = 50
FieldName = 'ID' FieldName = 'ID'
EditButtons = <> EditButtons = <>
Filter.IsNull = False
Filter.IsAll = True
Filter.DropDownRows = 0 Filter.DropDownRows = 0
Filter.EmptyValue = '(Нет)' Filter.EmptyValue = '(Нет)'
Filter.AllValue = '(All values)'
Filter.EmptyFont.Style = [fsItalic] Filter.EmptyFont.Style = [fsItalic]
Filter.ItemIndex = -1 Filter.ItemIndex = -1
Footers = <> Footers = <>
@ -77,8 +80,11 @@ object Form1: TForm1
Width = 120 Width = 120
FieldName = 'PDATE' FieldName = 'PDATE'
EditButtons = <> EditButtons = <>
Filter.IsNull = False
Filter.IsAll = True
Filter.DropDownRows = 0 Filter.DropDownRows = 0
Filter.EmptyValue = '(Нет)' Filter.EmptyValue = '(Нет)'
Filter.AllValue = '(All values)'
Filter.EmptyFont.Style = [fsItalic] Filter.EmptyFont.Style = [fsItalic]
Filter.ItemIndex = -1 Filter.ItemIndex = -1
Footers = <> Footers = <>
@ -92,8 +98,11 @@ object Form1: TForm1
Width = 364 Width = 364
FieldName = 'NAME' FieldName = 'NAME'
EditButtons = <> EditButtons = <>
Filter.IsNull = False
Filter.IsAll = True
Filter.DropDownRows = 0 Filter.DropDownRows = 0
Filter.EmptyValue = '(Нет)' Filter.EmptyValue = '(Нет)'
Filter.AllValue = '(All values)'
Filter.EmptyFont.Style = [fsItalic] Filter.EmptyFont.Style = [fsItalic]
Filter.ItemIndex = -1 Filter.ItemIndex = -1
Footer.Alignment = taRightJustify Footer.Alignment = taRightJustify
@ -124,8 +133,11 @@ object Form1: TForm1
Width = 100 Width = 100
FieldName = 'SUM' FieldName = 'SUM'
EditButtons = <> EditButtons = <>
Filter.IsNull = False
Filter.IsAll = True
Filter.DropDownRows = 0 Filter.DropDownRows = 0
Filter.EmptyValue = '(Нет)' Filter.EmptyValue = '(Нет)'
Filter.AllValue = '(All values)'
Filter.EmptyFont.Style = [fsItalic] Filter.EmptyFont.Style = [fsItalic]
Filter.ItemIndex = -1 Filter.ItemIndex = -1
Footer.Alignment = taRightJustify Footer.Alignment = taRightJustify
@ -160,8 +172,11 @@ object Form1: TForm1
Width = 60 Width = 60
FieldName = 'FLAG' FieldName = 'FLAG'
EditButtons = <> EditButtons = <>
Filter.IsNull = False
Filter.IsAll = True
Filter.DropDownRows = 0 Filter.DropDownRows = 0
Filter.EmptyValue = '(Нет)' Filter.EmptyValue = '(Нет)'
Filter.AllValue = '(All values)'
Filter.EmptyFont.Style = [fsItalic] Filter.EmptyFont.Style = [fsItalic]
Filter.ItemIndex = -1 Filter.ItemIndex = -1
Footers = <> Footers = <>
@ -181,8 +196,11 @@ object Form1: TForm1
Width = 200 Width = 200
FieldName = 'Country' FieldName = 'Country'
EditButtons = <> EditButtons = <>
Filter.IsNull = False
Filter.IsAll = True
Filter.DropDownRows = 0 Filter.DropDownRows = 0
Filter.EmptyValue = '(Нет)' Filter.EmptyValue = '(Нет)'
Filter.AllValue = '(All values)'
Filter.EmptyFont.Style = [fsItalic] Filter.EmptyFont.Style = [fsItalic]
Filter.ItemIndex = -1 Filter.ItemIndex = -1
Footers = <> Footers = <>
@ -194,8 +212,11 @@ object Form1: TForm1
Width = 200 Width = 200
FieldName = 'Sity' FieldName = 'Sity'
EditButtons = <> EditButtons = <>
Filter.IsNull = False
Filter.IsAll = True
Filter.DropDownRows = 0 Filter.DropDownRows = 0
Filter.EmptyValue = '(Нет)' Filter.EmptyValue = '(Нет)'
Filter.AllValue = '(All values)'
Filter.EmptyFont.Style = [fsItalic] Filter.EmptyFont.Style = [fsItalic]
Filter.ItemIndex = -1 Filter.ItemIndex = -1
Footers = <> Footers = <>
@ -260,6 +281,8 @@ object Form1: TForm1
FooterOptions.Color = clYellow FooterOptions.Color = clYellow
FooterOptions.RowCount = 3 FooterOptions.RowCount = 3
FooterOptions.DrawFullLine = True FooterOptions.DrawFullLine = True
SearchOptions.QuickSearchOptions = [loCaseInsensitive, loPartialKey]
SearchOptions.FromStart = False
OptionsRx = [rdgAllowColumnsForm, rdgAllowDialogFind, rdgFooterRows, rdgAllowQuickFilter, rdgAllowToolMenu, rdgWordWrap] OptionsRx = [rdgAllowColumnsForm, rdgAllowDialogFind, rdgFooterRows, rdgAllowQuickFilter, rdgAllowToolMenu, rdgWordWrap]
FooterColor = clYellow FooterColor = clYellow
FooterRowCount = 3 FooterRowCount = 3
@ -334,8 +357,8 @@ object Form1: TForm1
DataType = ftInteger DataType = ftInteger
end> end>
PacketRecords = 0 PacketRecords = 0
left = 136 Left = 136
top = 88 Top = 88
object RxMemoryData1ID: TAutoIncField object RxMemoryData1ID: TAutoIncField
FieldKind = fkData FieldKind = fkData
FieldName = 'ID' FieldName = 'ID'
@ -409,8 +432,8 @@ object Form1: TForm1
end end
object DataSource1: TDataSource object DataSource1: TDataSource
DataSet = RxMemoryData1 DataSet = RxMemoryData1
left = 104 Left = 104
top = 88 Top = 88
end end
object RxDBGridExportPDF1: TRxDBGridExportPDF object RxDBGridExportPDF1: TRxDBGridExportPDF
RxDBGrid = RxDBGrid1 RxDBGrid = RxDBGrid1
@ -426,12 +449,12 @@ object Form1: TForm1
PageMargin.Top = 40 PageMargin.Top = 40
PageMargin.Right = 40 PageMargin.Right = 40
PageMargin.Bottom = 40 PageMargin.Bottom = 40
left = 112 Left = 112
top = 160 Top = 160
end end
object ImageList1: TImageList object ImageList1: TImageList
left = 112 Left = 112
top = 224 Top = 224
Bitmap = { Bitmap = {
4C6903000000100000001000000000000000000000FF000000FF000000000000 4C6903000000100000001000000000000000000000FF000000FF000000000000
0000000000FF000000FF0000000000000000000000FF000000FF000000000000 0000000000FF000000FF0000000000000000000000FF000000FF000000000000

View File

@ -122,7 +122,7 @@ var
i: Integer; i: Integer;
begin begin
Memo1.Lines.Clear; Memo1.Lines.Clear;
gTTFontCache.BuildFontFacheIgnoresErrors:=true; gTTFontCache.BuildFontCacheIgnoresErrors:=true;
gTTFontCache.SearchPath.Assign(FontDirList); gTTFontCache.SearchPath.Assign(FontDirList);
gTTFontCache.BuildFontCache; gTTFontCache.BuildFontCache;

View File

@ -409,7 +409,7 @@ var
begin begin
fX := ConvetUnits(X); fX := ConvetUnits(X);
fY := ConvetUnits(Y); fY := ConvetUnits(Y+2);
fW := ConvetUnits(W); fW := ConvetUnits(W);
fH := ConvetUnits(H); fH := ConvetUnits(H);
@ -424,26 +424,27 @@ begin
case ATextAlign of case ATextAlign of
taLeftJustify: taLeftJustify:
begin begin
Y1:=fY - FTH2; // Y1:=fY - FTH2;
X1:=fX + ConvetUnits(constCellPadding); X1:=fX + ConvetUnits(constCellPadding);
end; end;
taRightJustify: taRightJustify:
begin begin
Y1:=fY - FTH2; // Y1:=fY - FTH2;
X1:=fX + fW - FTW - ConvetUnits(constCellPadding); X1:=fX + fW - FTW - ConvetUnits(constCellPadding);
if X1 < fX then if X1 < fX then
X1:=fX; X1:=fX;
end; end;
taCenter: taCenter:
begin begin
Y1:=fY - FTH2; // Y1:=fY - FTH2;
X1:=fX + fW / 2 - FTW / 2 - ConvetUnits(constCellPadding); X1:=fX + fW / 2 - FTW / 2 - ConvetUnits(constCellPadding);
if X1 < fX then if X1 < fX then
X1:=fX; X1:=fX;
end; end;
end; end;
FCurPage.WriteText(X1, Y1 + fH, AText); Y1:=fY + FTH2;
FCurPage.WriteText(X1, Y1 {- fH}, AText);
end; end;
procedure TRxDBGridExportPDF.DrawRect(X, Y, W, H: integer; ABorderColor, procedure TRxDBGridExportPDF.DrawRect(X, Y, W, H: integer; ABorderColor,
@ -509,7 +510,7 @@ begin
end; end;
Y1:=Y1 + fW1; Y1:=Y1 + fW1;
FCurPage.DrawImage(X1, Y1, fW1, fH1, IDX); // left-bottom coordinate of image FCurPage.DrawImage(X1, Y1, fW1, fH1, IDX);
finally finally
S.Free; S.Free;
@ -791,7 +792,7 @@ begin
FPDFDocument.Infos.ApplicationName := ApplicationName; FPDFDocument.Infos.ApplicationName := ApplicationName;
FPDFDocument.Infos.CreationDate := Now; FPDFDocument.Infos.CreationDate := Now;
FPDFDocument.Options:=FPdfOptions.FOptions; FPDFDocument.Options:=FPdfOptions.FOptions + [poPageOriginAtTop];
FPDFDocument.DefaultOrientation:=FPdfOptions.PaperOrientation; FPDFDocument.DefaultOrientation:=FPdfOptions.PaperOrientation;
//calc need count pages for all columns //calc need count pages for all columns
@ -853,9 +854,9 @@ begin
FFontItems:=TExportFonts.Create(Self); FFontItems:=TExportFonts.Create(Self);
FWorkPages:=TFPList.Create; FWorkPages:=TFPList.Create;
try try
FPDFDocument.StartDocument;
DoSetupFonts; DoSetupFonts;
DoSetupDocHeader; DoSetupDocHeader;
FPDFDocument.StartDocument;
FCurSection := FPDFDocument.Sections.AddSection; // we always need at least one section FCurSection := FPDFDocument.Sections.AddSection; // we always need at least one section
FDataSet.First; FDataSet.First;
repeat repeat
@ -869,9 +870,6 @@ begin
DoExportFooter; DoExportFooter;
end; end;
//DoTest; //!!!!
DoSaveDocument; DoSaveDocument;
Result:=true; Result:=true;
finally finally
@ -895,6 +893,7 @@ end;
function TRxDBGridExportPDF.DoSetupTools: boolean; function TRxDBGridExportPDF.DoSetupTools: boolean;
begin begin
RxDBGridExportPdfSetupForm:=TRxDBGridExportPdfSetupForm.Create(Application); RxDBGridExportPdfSetupForm:=TRxDBGridExportPdfSetupForm.Create(Application);
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;

View File

@ -1,21 +1,21 @@
object RxDBGridExportPdfSetupForm: TRxDBGridExportPdfSetupForm object RxDBGridExportPdfSetupForm: TRxDBGridExportPdfSetupForm
Left = 544 Left = 544
Height = 345 Height = 416
Top = 387 Top = 316
Width = 522 Width = 522
Caption = 'Export params' Caption = 'Export params'
ClientHeight = 345 ClientHeight = 416
ClientWidth = 522 ClientWidth = 522
OnCreate = FormCreate OnCreate = FormCreate
Position = poScreenCenter Position = poScreenCenter
LCLVersion = '1.7' LCLVersion = '1.9.0.0'
object Label1: TLabel object Label1: TLabel
AnchorSideLeft.Control = Owner AnchorSideLeft.Control = Owner
AnchorSideTop.Control = Owner AnchorSideTop.Control = Owner
Left = 6 Left = 6
Height = 20 Height = 13
Top = 6 Top = 6
Width = 105 Width = 78
BorderSpacing.Around = 6 BorderSpacing.Around = 6
Caption = 'Export file name' Caption = 'Export file name'
FocusControl = FileNameEdit1 FocusControl = FileNameEdit1
@ -28,8 +28,8 @@ object RxDBGridExportPdfSetupForm: TRxDBGridExportPdfSetupForm
AnchorSideRight.Control = Owner AnchorSideRight.Control = Owner
AnchorSideRight.Side = asrBottom AnchorSideRight.Side = asrBottom
Left = 12 Left = 12
Height = 37 Height = 21
Top = 32 Top = 25
Width = 504 Width = 504
Filter = 'All files (*.*)|*.*|LibreOffice/OpenOffice (*.ods)|*.ods|Excell 97-2003|*.xls|Excell 2007-2013|*.xlxs' Filter = 'All files (*.*)|*.*|LibreOffice/OpenOffice (*.ods)|*.ods|Excell 97-2003|*.xls|Excell 2007-2013|*.xlxs'
FilterIndex = 0 FilterIndex = 0
@ -44,8 +44,8 @@ object RxDBGridExportPdfSetupForm: TRxDBGridExportPdfSetupForm
end end
object ButtonPanel1: TButtonPanel object ButtonPanel1: TButtonPanel
Left = 6 Left = 6
Height = 46 Height = 34
Top = 293 Top = 376
Width = 510 Width = 510
OKButton.Name = 'OKButton' OKButton.Name = 'OKButton'
OKButton.DefaultCaption = True OKButton.DefaultCaption = True
@ -58,147 +58,215 @@ object RxDBGridExportPdfSetupForm: TRxDBGridExportPdfSetupForm
TabOrder = 1 TabOrder = 1
ShowButtons = [pbOK, pbCancel, pbHelp] ShowButtons = [pbOK, pbCancel, pbHelp]
end end
object PageControl1: TPageControl object GroupBox1: TGroupBox
AnchorSideLeft.Control = Owner AnchorSideLeft.Control = Owner
AnchorSideTop.Control = FileNameEdit1 AnchorSideTop.Control = FileNameEdit1
AnchorSideTop.Side = asrBottom AnchorSideTop.Side = asrBottom
AnchorSideRight.Control = Owner AnchorSideRight.Control = Owner
AnchorSideRight.Side = asrBottom AnchorSideRight.Side = asrBottom
AnchorSideBottom.Control = ButtonPanel1
Left = 6 Left = 6
Height = 212 Height = 117
Top = 75 Top = 52
Width = 510 Width = 510
ActivePage = TabSheet2 Anchors = [akTop, akLeft, akRight]
Anchors = [akTop, akLeft, akRight, akBottom]
BorderSpacing.Around = 6 BorderSpacing.Around = 6
TabIndex = 1
TabOrder = 2
object TabSheet1: TTabSheet
Caption = 'Global' Caption = 'Global'
ClientHeight = 178 ClientHeight = 99
ClientWidth = 500 ClientWidth = 506
object cbOpenAfterExport: TCheckBox TabOrder = 2
AnchorSideLeft.Control = Owner object ColorBox1: TColorBox
AnchorSideTop.Control = TabSheet1 AnchorSideLeft.Control = Label5
Left = 8 AnchorSideTop.Control = Label5
Height = 24 AnchorSideTop.Side = asrBottom
Top = 6 AnchorSideRight.Control = GroupBox1
Width = 141 AnchorSideRight.Side = asrBottom
Left = 265
Height = 22
Top = 71
Width = 235
Style = [cbStandardColors, cbExtendedColors, cbSystemColors, cbIncludeDefault, cbCustomColor, cbPrettyNames, cbCustomColors]
Anchors = [akTop, akLeft, akRight]
BorderSpacing.Around = 6 BorderSpacing.Around = 6
Caption = 'Open after export' ItemHeight = 16
TabOrder = 0 TabOrder = 0
end end
object cbExportColumnHeader: TCheckBox object Label5: TLabel
AnchorSideLeft.Control = Owner AnchorSideLeft.Control = Label3
AnchorSideTop.Control = cbOpenAfterExport AnchorSideTop.Control = CheckBox6
AnchorSideTop.Side = asrBottom AnchorSideTop.Side = asrBottom
Left = 6 Left = 259
Height = 24 Height = 13
Top = 36 Top = 52
Width = 167 Width = 46
BorderSpacing.Around = 6 BorderSpacing.Around = 6
Caption = 'Export column header' Caption = 'Title color'
ParentColor = False
end
object CheckBox6: TCheckBox
AnchorSideLeft.Control = Label3
AnchorSideTop.Control = cbOverwriteExisting
AnchorSideTop.Side = asrBottom
Left = 259
Height = 17
Top = 29
Width = 86
BorderSpacing.Around = 6
Caption = 'Export images'
TabOrder = 1 TabOrder = 1
end end
object cbExportColumnFooter: TCheckBox
AnchorSideLeft.Control = Owner
AnchorSideTop.Control = cbExportColumnHeader
AnchorSideTop.Side = asrBottom
Left = 6
Height = 24
Top = 66
Width = 162
BorderSpacing.Around = 6
Caption = 'Export column footer'
TabOrder = 2
end
object cbExportCellColors: TCheckBox
AnchorSideLeft.Control = Owner
AnchorSideTop.Control = cbExportColumnFooter
AnchorSideTop.Side = asrBottom
Left = 6
Height = 24
Top = 96
Width = 138
BorderSpacing.Around = 6
Caption = 'Export cell colors'
TabOrder = 3
end
object cbOverwriteExisting: TCheckBox object cbOverwriteExisting: TCheckBox
AnchorSideLeft.Control = Label4 AnchorSideLeft.Control = Label3
AnchorSideTop.Control = TabSheet1 AnchorSideTop.Control = GroupBox1
Left = 256 Left = 259
Height = 24 Height = 17
Top = 6 Top = 6
Width = 168 Width = 123
BorderSpacing.Around = 6 BorderSpacing.Around = 6
Caption = 'Overwrite existing file' Caption = 'Overwrite existing file'
Enabled = False Enabled = False
TabOrder = 2
end
object cbOpenAfterExport: TCheckBox
AnchorSideLeft.Control = GroupBox1
AnchorSideTop.Control = GroupBox1
Left = 6
Height = 17
Top = 6
Width = 106
BorderSpacing.Around = 6
Caption = 'Open after export'
TabOrder = 3
end
object cbExportColumnHeader: TCheckBox
AnchorSideLeft.Control = GroupBox1
AnchorSideTop.Control = cbOpenAfterExport
AnchorSideTop.Side = asrBottom
Left = 6
Height = 17
Top = 29
Width = 123
BorderSpacing.Around = 6
Caption = 'Export column header'
TabOrder = 4 TabOrder = 4
end end
object Label4: TLabel object cbExportColumnFooter: TCheckBox
AnchorSideLeft.Control = TabSheet1 AnchorSideLeft.Control = GroupBox1
AnchorSideTop.Control = cbExportColumnHeader
AnchorSideTop.Side = asrBottom
Left = 6
Height = 17
Top = 52
Width = 119
BorderSpacing.Around = 6
Caption = 'Export column footer'
TabOrder = 5
end
object cbExportCellColors: TCheckBox
AnchorSideLeft.Control = GroupBox1
AnchorSideTop.Control = cbExportColumnFooter
AnchorSideTop.Side = asrBottom
Left = 6
Height = 17
Top = 75
Width = 99
BorderSpacing.Around = 6
Caption = 'Export cell colors'
TabOrder = 6
end
object Label3: TLabel
AnchorSideLeft.Control = GroupBox1
AnchorSideLeft.Side = asrCenter AnchorSideLeft.Side = asrCenter
AnchorSideTop.Control = TabSheet1 AnchorSideTop.Control = GroupBox1
Left = 250 Left = 253
Height = 1 Height = 1
Top = 0 Top = 0
Width = 1 Width = 1
ParentColor = False ParentColor = False
end end
object CheckBox6: TCheckBox
AnchorSideLeft.Control = Label4
AnchorSideTop.Control = cbOverwriteExisting
AnchorSideTop.Side = asrBottom
Left = 256
Height = 24
Top = 36
Width = 117
BorderSpacing.Around = 6
Caption = 'Export images'
TabOrder = 5
end end
object Label5: TLabel object GroupBox2: TGroupBox
AnchorSideLeft.Control = Label4 AnchorSideLeft.Control = Owner
AnchorSideTop.Control = CheckBox6 AnchorSideTop.Control = GroupBox1
AnchorSideTop.Side = asrBottom AnchorSideTop.Side = asrBottom
Left = 256 AnchorSideRight.Control = Owner
Height = 20
Top = 66
Width = 64
BorderSpacing.Around = 6
Caption = 'Title color'
ParentColor = False
end
object ColorBox1: TColorBox
AnchorSideLeft.Control = Label5
AnchorSideTop.Control = Label5
AnchorSideTop.Side = asrBottom
AnchorSideRight.Control = TabSheet1
AnchorSideRight.Side = asrBottom AnchorSideRight.Side = asrBottom
Left = 262 Left = 6
Height = 36 Height = 139
Top = 92 Top = 175
Width = 232 Width = 510
Style = [cbStandardColors, cbExtendedColors, cbSystemColors, cbIncludeDefault, cbCustomColor, cbPrettyNames, cbCustomColors]
Anchors = [akTop, akLeft, akRight] Anchors = [akTop, akLeft, akRight]
AutoSize = True
BorderSpacing.Around = 6 BorderSpacing.Around = 6
ItemHeight = 0
TabOrder = 6
end
end
object TabSheet2: TTabSheet
Caption = 'PDF Options' Caption = 'PDF Options'
ClientHeight = 178 ClientHeight = 121
ClientWidth = 500 ClientWidth = 506
object Label2: TLabel TabOrder = 3
AnchorSideLeft.Control = Label3 object CheckBox1: TCheckBox
AnchorSideTop.Control = TabSheet2 AnchorSideTop.Control = GroupBox2
Left = 256 Left = 6
Height = 20 Height = 17
Top = 6 Top = 6
Width = 70 Width = 55
BorderSpacing.Around = 6
Caption = 'Out line'
TabOrder = 0
end
object CheckBox2: TCheckBox
AnchorSideLeft.Control = GroupBox2
AnchorSideTop.Control = CheckBox1
AnchorSideTop.Side = asrBottom
Left = 6
Height = 17
Top = 29
Width = 88
BorderSpacing.Around = 6
Caption = 'Compress text'
TabOrder = 1
end
object CheckBox3: TCheckBox
AnchorSideLeft.Control = GroupBox2
AnchorSideTop.Control = CheckBox2
AnchorSideTop.Side = asrBottom
Left = 6
Height = 17
Top = 52
Width = 93
BorderSpacing.Around = 6
Caption = 'Compress fonts'
TabOrder = 2
end
object CheckBox4: TCheckBox
AnchorSideLeft.Control = GroupBox2
AnchorSideTop.Control = CheckBox3
AnchorSideTop.Side = asrBottom
Left = 6
Height = 17
Top = 75
Width = 101
BorderSpacing.Around = 6
Caption = 'Compress images'
TabOrder = 3
end
object CheckBox5: TCheckBox
AnchorSideLeft.Control = GroupBox2
AnchorSideTop.Control = CheckBox4
AnchorSideTop.Side = asrBottom
Left = 6
Height = 17
Top = 98
Width = 84
BorderSpacing.Around = 6
Caption = 'Use raw JPEG'
TabOrder = 4
end
object Label2: TLabel
AnchorSideLeft.Control = Label4
AnchorSideLeft.Side = asrBottom
AnchorSideTop.Control = GroupBox2
Left = 260
Height = 13
Top = 6
Width = 53
BorderSpacing.Around = 6 BorderSpacing.Around = 6
Caption = 'Paper type' Caption = 'Paper type'
ParentColor = False ParentColor = False
@ -207,28 +275,29 @@ object RxDBGridExportPdfSetupForm: TRxDBGridExportPdfSetupForm
AnchorSideLeft.Control = Label2 AnchorSideLeft.Control = Label2
AnchorSideTop.Control = Label2 AnchorSideTop.Control = Label2
AnchorSideTop.Side = asrBottom AnchorSideTop.Side = asrBottom
AnchorSideRight.Control = TabSheet2 AnchorSideRight.Control = GroupBox2
AnchorSideRight.Side = asrBottom AnchorSideRight.Side = asrBottom
Left = 262 Left = 266
Height = 36 Height = 21
Top = 32 Top = 25
Width = 232 Width = 234
Anchors = [akTop, akLeft, akRight] Anchors = [akTop, akLeft, akRight]
BorderSpacing.Around = 6 BorderSpacing.Around = 6
ItemHeight = 0 ItemHeight = 13
Style = csDropDownList Style = csDropDownList
TabOrder = 0 TabOrder = 5
end end
object RadioGroup1: TRadioGroup object RadioGroup1: TRadioGroup
AnchorSideLeft.Control = Label4 AnchorSideLeft.Control = Label4
AnchorSideLeft.Side = asrBottom
AnchorSideTop.Control = ComboBox1 AnchorSideTop.Control = ComboBox1
AnchorSideTop.Side = asrBottom AnchorSideTop.Side = asrBottom
AnchorSideRight.Control = TabSheet2 AnchorSideRight.Control = GroupBox2
AnchorSideRight.Side = asrBottom AnchorSideRight.Side = asrBottom
Left = 265 Left = 260
Height = 69 Height = 52
Top = 74 Top = 52
Width = 229 Width = 240
Anchors = [akTop, akLeft, akRight] Anchors = [akTop, akLeft, akRight]
AutoFill = True AutoFill = True
AutoSize = True AutoSize = True
@ -241,83 +310,23 @@ object RxDBGridExportPdfSetupForm: TRxDBGridExportPdfSetupForm
ChildSizing.ShrinkVertical = crsScaleChilds ChildSizing.ShrinkVertical = crsScaleChilds
ChildSizing.Layout = cclLeftToRightThenTopToBottom ChildSizing.Layout = cclLeftToRightThenTopToBottom
ChildSizing.ControlsPerLine = 1 ChildSizing.ControlsPerLine = 1
ClientHeight = 48 ClientHeight = 34
ClientWidth = 227 ClientWidth = 236
Items.Strings = ( Items.Strings = (
'Portrait' 'Portrait'
'Landscape' 'Landscape'
) )
TabOrder = 1 TabOrder = 6
end end
object Label3: TLabel object Label4: TLabel
AnchorSideLeft.Control = TabSheet2 AnchorSideLeft.Control = GroupBox2
AnchorSideLeft.Side = asrCenter AnchorSideLeft.Side = asrCenter
AnchorSideTop.Control = TabSheet2 AnchorSideTop.Control = GroupBox2
Left = 250 Left = 253
Height = 1 Height = 1
Top = 0 Top = 0
Width = 1 Width = 1
ParentColor = False ParentColor = False
end end
object CheckBox1: TCheckBox
AnchorSideLeft.Control = TabSheet2
AnchorSideTop.Control = TabSheet2
Left = 6
Height = 24
Top = 6
Width = 77
BorderSpacing.Around = 6
Caption = 'Out line'
TabOrder = 2
end
object CheckBox2: TCheckBox
AnchorSideLeft.Control = TabSheet2
AnchorSideTop.Control = CheckBox1
AnchorSideTop.Side = asrBottom
Left = 6
Height = 24
Top = 36
Width = 121
BorderSpacing.Around = 6
Caption = 'Compress text'
TabOrder = 3
end
object CheckBox3: TCheckBox
AnchorSideLeft.Control = TabSheet2
AnchorSideTop.Control = CheckBox2
AnchorSideTop.Side = asrBottom
Left = 6
Height = 24
Top = 66
Width = 128
BorderSpacing.Around = 6
Caption = 'Compress fonts'
TabOrder = 4
end
object CheckBox4: TCheckBox
AnchorSideLeft.Control = TabSheet2
AnchorSideTop.Control = CheckBox3
AnchorSideTop.Side = asrBottom
Left = 6
Height = 24
Top = 96
Width = 140
BorderSpacing.Around = 6
Caption = 'Compress images'
TabOrder = 5
end
object CheckBox5: TCheckBox
AnchorSideLeft.Control = TabSheet2
AnchorSideTop.Control = CheckBox4
AnchorSideTop.Side = asrBottom
Left = 6
Height = 24
Top = 126
Width = 116
BorderSpacing.Around = 6
Caption = 'Use raw JPEG'
TabOrder = 6
end
end
end end
end end

View File

@ -60,15 +60,14 @@ type
ColorBox1: TColorBox; ColorBox1: TColorBox;
ComboBox1: TComboBox; ComboBox1: TComboBox;
FileNameEdit1: TFileNameEdit; FileNameEdit1: TFileNameEdit;
GroupBox1: TGroupBox;
GroupBox2: TGroupBox;
Label1: TLabel; Label1: TLabel;
Label2: TLabel; Label2: TLabel;
Label3: TLabel; Label3: TLabel;
Label4: TLabel; Label4: TLabel;
Label5: TLabel; Label5: TLabel;
PageControl1: TPageControl;
RadioGroup1: TRadioGroup; RadioGroup1: TRadioGroup;
TabSheet1: TTabSheet;
TabSheet2: TTabSheet;
procedure FormCreate(Sender: TObject); procedure FormCreate(Sender: TObject);
private private
{ private declarations } { private declarations }
@ -97,7 +96,7 @@ const
{$ENDIF} {$ENDIF}
implementation implementation
{$IF (FPC_FULLVERSION >= 30101)} {$IF (FPC_FULLVERSION >= 30101)}
uses rxdconst; uses rxdconst, LCLIntf;
{$R *.lfm} {$R *.lfm}
@ -107,11 +106,9 @@ procedure TRxDBGridExportPdfSetupForm.FormCreate(Sender: TObject);
var var
c: TPDFPaperType; c: TPDFPaperType;
begin begin
PageControl1.ActivePageIndex:=0;
Caption:=sExportParams; Caption:=sExportParams;
TabSheet1.Caption:=sGlobal; GroupBox1.Caption:=sGlobal;
TabSheet2.Caption:=sPDFOptions; GroupBox2.Caption:=sPDFOptions;
Label1.Caption:=sExportFileName; Label1.Caption:=sExportFileName;
cbOpenAfterExport.Caption:=sOpenAfterExport; cbOpenAfterExport.Caption:=sOpenAfterExport;
cbExportColumnHeader.Caption:=sExportColumnHeader; cbExportColumnHeader.Caption:=sExportColumnHeader;