diff --git a/components/rx/trunk/languages/rxdconst.es.po b/components/rx/trunk/languages/rxdconst.es.po
index d1eca1851..a66cdd23f 100644
--- a/components/rx/trunk/languages/rxdconst.es.po
+++ b/components/rx/trunk/languages/rxdconst.es.po
@@ -5,6 +5,10 @@ msgstr "Content-Type: text/plain; charset=UTF-8"
msgid "Application \"%s\""
msgstr "Aplicación \"%s\""
+#: rxdconst.sbottomcaption
+msgid "Bottom"
+msgstr ""
+
#: rxdconst.sbrowsedata
msgid "browse"
msgstr "vista"
@@ -163,6 +167,14 @@ msgstr "No hay campos definido"
msgid "User name or password not valid"
msgstr "Nombre de usuario o clave no es valido"
+#: rxdconst.slandscape
+msgid "Landscape"
+msgstr ""
+
+#: rxdconst.sleftcaption
+msgid "Left"
+msgstr ""
+
#: rxdconst.slocaldatabase
msgid "Unable complete this operation on local dataset"
msgstr "No se puede completar esta operación en el conjunto de datos local"
@@ -203,10 +215,18 @@ msgstr "&Anterior clave:"
msgid "Open after export"
msgstr ""
+#: rxdconst.sorientation
+msgid "Orientation"
+msgstr ""
+
#: rxdconst.soverwriteexisting
msgid "Overwrite existing"
msgstr ""
+#: rxdconst.spagemargins
+msgid "Page margins"
+msgstr ""
+
#: rxdconst.spagename
msgid "Page name"
msgstr ""
@@ -227,10 +247,22 @@ msgstr "Clave no cambio"
msgid "New password and confirmation not equal"
msgstr "Nueva clave y confirmacion no son iguales"
+#: rxdconst.sportrait
+msgid "Portrait"
+msgstr ""
+
#: rxdconst.sprevbutton
msgid "&Prior"
msgstr "&Anterior"
+#: rxdconst.sprintgrid
+msgid "Print grid"
+msgstr ""
+
+#: rxdconst.sprintoptions
+msgid "Print options"
+msgstr ""
+
#: rxdconst.spropdefbylookup
msgid "PropDefByLookup"
msgstr "PropDefByLookup"
@@ -239,10 +271,18 @@ msgstr "PropDefByLookup"
msgid "Register"
msgstr "Registro"
+#: rxdconst.sreporttitle
+msgid "Report title"
+msgstr ""
+
#: rxdconst.sretrylogin
msgid "Retry to connect with database?"
msgstr "Reintentar conectar con la base de dato?"
+#: rxdconst.srightcaption
+msgid "Right"
+msgstr ""
+
#: rxdconst.srxallfields
msgid "All fields"
msgstr ""
@@ -475,10 +515,38 @@ msgstr "Error del Servidor"
msgid "find"
msgstr "buscar"
+#: rxdconst.sshowcolumnheaderonallpage
+msgid "Show column header on all page"
+msgstr ""
+
+#: rxdconst.sshowfooter
+msgid "Show footer"
+msgstr ""
+
+#: rxdconst.sshowfootercolor
+msgid "Show footer color"
+msgstr ""
+
+#: rxdconst.sshowgridcolor
+msgid "Show grid color"
+msgstr ""
+
+#: rxdconst.sshowreporttitle
+msgid "Show report title"
+msgstr ""
+
+#: rxdconst.sshowtitle
+msgid "Show column title"
+msgstr ""
+
#: rxdconst.stoolsexportspeadsheet
msgid "Export to speadsheet"
msgstr ""
+#: rxdconst.stopcaption
+msgid "Top"
+msgstr ""
+
#: rxdconst.sunknownfieldtype
msgid "SUnknownFieldType %s"
msgstr "STipoCampoDesconocido %s"
diff --git a/components/rx/trunk/languages/rxdconst.po b/components/rx/trunk/languages/rxdconst.po
index 83161a779..b15b1ca40 100644
--- a/components/rx/trunk/languages/rxdconst.po
+++ b/components/rx/trunk/languages/rxdconst.po
@@ -5,6 +5,10 @@ msgstr "Content-Type: text/plain; charset=UTF-8"
msgid "Application \"%s\""
msgstr ""
+#: rxdconst.sbottomcaption
+msgid "Bottom"
+msgstr ""
+
#: rxdconst.sbrowsedata
msgid "browse"
msgstr ""
@@ -161,6 +165,14 @@ msgstr ""
msgid "User name or password not valid"
msgstr ""
+#: rxdconst.slandscape
+msgid "Landscape"
+msgstr ""
+
+#: rxdconst.sleftcaption
+msgid "Left"
+msgstr ""
+
#: rxdconst.slocaldatabase
msgid "Unable complete this operation on local dataset"
msgstr ""
@@ -201,10 +213,18 @@ msgstr ""
msgid "Open after export"
msgstr ""
+#: rxdconst.sorientation
+msgid "Orientation"
+msgstr ""
+
#: rxdconst.soverwriteexisting
msgid "Overwrite existing"
msgstr ""
+#: rxdconst.spagemargins
+msgid "Page margins"
+msgstr ""
+
#: rxdconst.spagename
msgid "Page name"
msgstr ""
@@ -225,10 +245,22 @@ msgstr ""
msgid "New password and confirmation not equal"
msgstr ""
+#: rxdconst.sportrait
+msgid "Portrait"
+msgstr ""
+
#: rxdconst.sprevbutton
msgid "&Prior"
msgstr ""
+#: rxdconst.sprintgrid
+msgid "Print grid"
+msgstr ""
+
+#: rxdconst.sprintoptions
+msgid "Print options"
+msgstr ""
+
#: rxdconst.spropdefbylookup
msgid "PropDefByLookup"
msgstr ""
@@ -237,10 +269,18 @@ msgstr ""
msgid "Register"
msgstr ""
+#: rxdconst.sreporttitle
+msgid "Report title"
+msgstr ""
+
#: rxdconst.sretrylogin
msgid "Retry to connect with database?"
msgstr ""
+#: rxdconst.srightcaption
+msgid "Right"
+msgstr ""
+
#: rxdconst.srxallfields
msgid "All fields"
msgstr ""
@@ -471,10 +511,38 @@ msgstr ""
msgid "find"
msgstr ""
+#: rxdconst.sshowcolumnheaderonallpage
+msgid "Show column header on all page"
+msgstr ""
+
+#: rxdconst.sshowfooter
+msgid "Show footer"
+msgstr ""
+
+#: rxdconst.sshowfootercolor
+msgid "Show footer color"
+msgstr ""
+
+#: rxdconst.sshowgridcolor
+msgid "Show grid color"
+msgstr ""
+
+#: rxdconst.sshowreporttitle
+msgid "Show report title"
+msgstr ""
+
+#: rxdconst.sshowtitle
+msgid "Show column title"
+msgstr ""
+
#: rxdconst.stoolsexportspeadsheet
msgid "Export to speadsheet"
msgstr ""
+#: rxdconst.stopcaption
+msgid "Top"
+msgstr ""
+
#: rxdconst.sunknownfieldtype
msgid "SUnknownFieldType %s"
msgstr ""
diff --git a/components/rx/trunk/languages/rxdconst.ru.po b/components/rx/trunk/languages/rxdconst.ru.po
index 6f395b643..ebb15536b 100644
--- a/components/rx/trunk/languages/rxdconst.ru.po
+++ b/components/rx/trunk/languages/rxdconst.ru.po
@@ -5,6 +5,10 @@ msgstr "Content-Type: text/plain; charset=UTF-8"
msgid "Application \"%s\""
msgstr "Программа \"%s\""
+#: rxdconst.sbottomcaption
+msgid "Bottom"
+msgstr ""
+
#: rxdconst.sbrowsedata
msgid "browse"
msgstr "просмотр"
@@ -163,6 +167,14 @@ msgstr "Нет объявления полей"
msgid "User name or password not valid"
msgstr "Ошибка в имени пользователя или пароле"
+#: rxdconst.slandscape
+msgid "Landscape"
+msgstr ""
+
+#: rxdconst.sleftcaption
+msgid "Left"
+msgstr ""
+
#: rxdconst.slocaldatabase
msgid "Unable complete this operation on local dataset"
msgstr "Невозможно произвести эту операцию с локальной базой данных"
@@ -203,10 +215,18 @@ msgstr "&Старый пароль"
msgid "Open after export"
msgstr "Открыть после экспорта"
+#: rxdconst.sorientation
+msgid "Orientation"
+msgstr ""
+
#: rxdconst.soverwriteexisting
msgid "Overwrite existing"
msgstr "Перезаписать существующее"
+#: rxdconst.spagemargins
+msgid "Page margins"
+msgstr ""
+
#: rxdconst.spagename
msgid "Page name"
msgstr "Название страницы"
@@ -227,10 +247,22 @@ msgstr "Пароль не изменён"
msgid "New password and confirmation not equal"
msgstr "Новый пароль и подтверждение не совпадают"
+#: rxdconst.sportrait
+msgid "Portrait"
+msgstr ""
+
#: rxdconst.sprevbutton
msgid "&Prior"
msgstr "&Превыдущие"
+#: rxdconst.sprintgrid
+msgid "Print grid"
+msgstr ""
+
+#: rxdconst.sprintoptions
+msgid "Print options"
+msgstr ""
+
#: rxdconst.spropdefbylookup
msgid "PropDefByLookup"
msgstr ""
@@ -239,10 +271,18 @@ msgstr ""
msgid "Register"
msgstr "Регистрация"
+#: rxdconst.sreporttitle
+msgid "Report title"
+msgstr ""
+
#: rxdconst.sretrylogin
msgid "Retry to connect with database?"
msgstr "Вы хотите повторить попытку соединения с базой данных?"
+#: rxdconst.srightcaption
+msgid "Right"
+msgstr ""
+
#: rxdconst.srxallfields
msgid "All fields"
msgstr "Все поля"
@@ -473,10 +513,38 @@ msgstr "Ошибка сервера"
msgid "find"
msgstr "поиск"
+#: rxdconst.sshowcolumnheaderonallpage
+msgid "Show column header on all page"
+msgstr ""
+
+#: rxdconst.sshowfooter
+msgid "Show footer"
+msgstr ""
+
+#: rxdconst.sshowfootercolor
+msgid "Show footer color"
+msgstr ""
+
+#: rxdconst.sshowgridcolor
+msgid "Show grid color"
+msgstr ""
+
+#: rxdconst.sshowreporttitle
+msgid "Show report title"
+msgstr ""
+
+#: rxdconst.sshowtitle
+msgid "Show column title"
+msgstr ""
+
#: rxdconst.stoolsexportspeadsheet
msgid "Export to speadsheet"
msgstr "Экспорт в электронную таблицу"
+#: rxdconst.stopcaption
+msgid "Top"
+msgstr ""
+
#: rxdconst.sunknownfieldtype
msgid "SUnknownFieldType %s"
msgstr "Не определён тип данных для поля %s"
diff --git a/components/rx/trunk/languages/rxdconst.uk.po b/components/rx/trunk/languages/rxdconst.uk.po
index a01e22b73..a8d1cb296 100644
--- a/components/rx/trunk/languages/rxdconst.uk.po
+++ b/components/rx/trunk/languages/rxdconst.uk.po
@@ -14,6 +14,10 @@ msgstr ""
msgid "Application \"%s\""
msgstr "Програма \"%s\""
+#: rxdconst.sbottomcaption
+msgid "Bottom"
+msgstr ""
+
#: rxdconst.sbrowsedata
msgid "browse"
msgstr "перегляд"
@@ -172,6 +176,14 @@ msgstr "Немає оголошення полів"
msgid "User name or password not valid"
msgstr "Помилка в імені користувача або паролі"
+#: rxdconst.slandscape
+msgid "Landscape"
+msgstr ""
+
+#: rxdconst.sleftcaption
+msgid "Left"
+msgstr ""
+
#: rxdconst.slocaldatabase
msgid "Unable complete this operation on local dataset"
msgstr "Неможливо провести цю операцію з локальною базою даних"
@@ -212,10 +224,18 @@ msgstr "&Старий пароль"
msgid "Open after export"
msgstr ""
+#: rxdconst.sorientation
+msgid "Orientation"
+msgstr ""
+
#: rxdconst.soverwriteexisting
msgid "Overwrite existing"
msgstr ""
+#: rxdconst.spagemargins
+msgid "Page margins"
+msgstr ""
+
#: rxdconst.spagename
msgid "Page name"
msgstr ""
@@ -236,10 +256,22 @@ msgstr "Пароль не змінено"
msgid "New password and confirmation not equal"
msgstr "Новий пароль і підтвердження не співпадають"
+#: rxdconst.sportrait
+msgid "Portrait"
+msgstr ""
+
#: rxdconst.sprevbutton
msgid "&Prior"
msgstr "&Попередній"
+#: rxdconst.sprintgrid
+msgid "Print grid"
+msgstr ""
+
+#: rxdconst.sprintoptions
+msgid "Print options"
+msgstr ""
+
#: rxdconst.spropdefbylookup
msgid "PropDefByLookup"
msgstr ""
@@ -248,10 +280,18 @@ msgstr ""
msgid "Register"
msgstr "Реєстрація"
+#: rxdconst.sreporttitle
+msgid "Report title"
+msgstr ""
+
#: rxdconst.sretrylogin
msgid "Retry to connect with database?"
msgstr "Ви хочете повторити спробу з'єднання з базою даних?"
+#: rxdconst.srightcaption
+msgid "Right"
+msgstr ""
+
#: rxdconst.srxallfields
msgid "All fields"
msgstr ""
@@ -482,10 +522,38 @@ msgstr "Помилка сервера"
msgid "find"
msgstr "Пошук"
+#: rxdconst.sshowcolumnheaderonallpage
+msgid "Show column header on all page"
+msgstr ""
+
+#: rxdconst.sshowfooter
+msgid "Show footer"
+msgstr ""
+
+#: rxdconst.sshowfootercolor
+msgid "Show footer color"
+msgstr ""
+
+#: rxdconst.sshowgridcolor
+msgid "Show grid color"
+msgstr ""
+
+#: rxdconst.sshowreporttitle
+msgid "Show report title"
+msgstr ""
+
+#: rxdconst.sshowtitle
+msgid "Show column title"
+msgstr ""
+
#: rxdconst.stoolsexportspeadsheet
msgid "Export to speadsheet"
msgstr ""
+#: rxdconst.stopcaption
+msgid "Top"
+msgstr ""
+
#: rxdconst.sunknownfieldtype
msgid "SUnknownFieldType %s"
msgstr "Не визначений тип даних для поля %s"
diff --git a/components/rx/trunk/rxdbgrid_print.lpk b/components/rx/trunk/rxdbgrid_print.lpk
index d17db2471..94c8d28c2 100644
--- a/components/rx/trunk/rxdbgrid_print.lpk
+++ b/components/rx/trunk/rxdbgrid_print.lpk
@@ -5,15 +5,19 @@
-
+
-
+
+
+
+
+
diff --git a/components/rx/trunk/rxdbgrid_print.pas b/components/rx/trunk/rxdbgrid_print.pas
index f8aec33f1..63d62d2c9 100644
--- a/components/rx/trunk/rxdbgrid_print.pas
+++ b/components/rx/trunk/rxdbgrid_print.pas
@@ -7,7 +7,7 @@ unit rxdbgrid_print;
interface
uses
- RxDBGridPrintGrid, LazarusPackageIntf;
+ RxDBGridPrintGrid, RxDBGridPrintGrid_SetupUnit, LazarusPackageIntf;
implementation
diff --git a/components/rx/trunk/rxdbgridprintgrid.pas b/components/rx/trunk/rxdbgridprintgrid.pas
index af22de0a8..57f4e6297 100644
--- a/components/rx/trunk/rxdbgridprintgrid.pas
+++ b/components/rx/trunk/rxdbgridprintgrid.pas
@@ -1,4 +1,4 @@
-{ rxdbgrid unit
+{ RxDBGridPrintGrid unit
Copyright (C) 2005-2014 Lagunov Aleksey alexs@yandex.ru and Lazarus team
original conception from rx library for Delphi (c)
@@ -30,7 +30,7 @@
}
unit RxDBGridPrintGrid;
-{$mode objfpc}{$H+}
+{$I rx.inc}
interface
@@ -39,9 +39,16 @@ uses
Graphics, Printers;
type
- TRxDBGridPrintOption = (rxpoShowTitle, rxpoShowFooter, rxpoShowFooterColor);
+ TRxDBGridPrintOption =
+ (rxpoShowTitle,
+ rxpoShowFooter,
+ rxpoShowGridColor,
+ rxpoShowFooterColor,
+ rxpoShowReportTitle
+ );
TRxDBGridPrintOptions = set of TRxDBGridPrintOption;
+
{ TRxColInfo }
TRxColInfo = class
@@ -52,17 +59,39 @@ type
destructor Destroy; override;
end;
+ { TRxPageMargin }
+
+ TRxPageMargin = class(TPersistent)
+ private
+ FBottom: integer;
+ FLeft: integer;
+ FRight: integer;
+ FTop: integer;
+ protected
+ procedure AssignTo(Dest: TPersistent); override;
+ public
+ constructor Create;
+ published
+ property Left:integer read FLeft write FLeft default 20;
+ property Top:integer read FTop write FTop default 20;
+ property Right:integer read FRight write FRight default 20;
+ property Bottom:integer read FBottom write FBottom default 20;
+ end;
+
{ TRxDBGridPrint }
TRxDBGridPrint = class(TRxDBGridAbstractTools)
private
FOptions: TRxDBGridPrintOptions;
FOrientation: TPrinterOrientation;
+ FPageMargin: TRxPageMargin;
FReport : TfrReport;
FReportDataSet : TfrDBDataSet;
FColumnDataSet : TfrUserDataSet;
FDataSet : TDataset;
FPage : TfrPage;
+ FReportTitle: string;
+ FShowColumnHeaderOnAllPage: boolean;
FShowProgress : Boolean;
FTitleRowCount : integer;
@@ -70,14 +99,17 @@ type
FYPos: Integer;
FXPos: Integer;
+ procedure DoShowReportTitle;
procedure DoCreateReport;
procedure DoSetupColumns;
- procedure DoShowTitle;
+ procedure DoShowColumnsTitle;
procedure DoShowFooter;
procedure OnPrintColumn(ColNo: Integer; var Width: Integer);
procedure OnEnterRect(Memo: TStringList; View: TfrView);
+ procedure SetPageMargin(AValue: TRxPageMargin);
protected
function DoExecTools:boolean;override;
+ function DoSetupTools:boolean; override;
public
constructor Create(AOwner: TComponent); override;
destructor Destroy; override;
@@ -86,12 +118,15 @@ type
property Orientation: TPrinterOrientation read FOrientation write FOrientation default poPortrait;
property Options:TRxDBGridPrintOptions read FOptions write FOptions;
property ShowProgress : Boolean read FShowProgress write FShowProgress default false;
+ property PageMargin:TRxPageMargin read FPageMargin write SetPageMargin;
+ property ReportTitle:string read FReportTitle write FReportTitle;
+ property ShowColumnHeaderOnAllPage:boolean read FShowColumnHeaderOnAllPage write FShowColumnHeaderOnAllPage default false;
end;
procedure Register;
implementation
-uses math;
+uses math, RxDBGridPrintGrid_SetupUnit, Forms, Controls, rxdconst;
{$R rxdbgridprintgrid.res}
@@ -100,6 +135,30 @@ begin
RegisterComponents('RX DBAware',[TRxDBGridPrint]);
end;
+{ TRxPageMargin }
+
+procedure TRxPageMargin.AssignTo(Dest: TPersistent);
+begin
+ if (Dest is TRxPageMargin) then
+ begin
+ TRxPageMargin(Dest).FBottom:=FBottom;
+ TRxPageMargin(Dest).FLeft:=FLeft;
+ TRxPageMargin(Dest).FRight:=FRight;
+ TRxPageMargin(Dest).FTop:=FTop;
+ end
+ else
+ inherited AssignTo(Dest);
+end;
+
+constructor TRxPageMargin.Create;
+begin
+ inherited Create;
+ FBottom:=20;
+ FLeft:=20;
+ FRight:=20;
+ FTop:=20;
+end;
+
{ TRxColInfo }
constructor TRxColInfo.Create;
@@ -117,6 +176,31 @@ end;
{ TRxDBGridPrint }
+procedure TRxDBGridPrint.DoShowReportTitle;
+var
+ FBand: TfrBandView;
+ FView: TfrMemoView;
+begin
+ if rxpoShowReportTitle in FOptions then
+ begin
+ FBand := TfrBandView(frCreateObject(gtBand, '', FPage));
+ FBand.SetBounds(10, 20, 1000, 25);
+ FBand.BandType := btReportTitle;
+ FPage.Objects.Add(FBand);
+
+ FView := frCreateObject(gtMemo, '', FPage) as TfrMemoView;
+ FView.SetBounds(20, 20, FPage.PrnInfo.PgW - 40, 25);
+ FView.Alignment:=taCenter;
+ FView.Font.Size:=12;
+// FView.Font.Assign(FTitleFont);
+ FView.Memo.Add(FReportTitle);
+
+ FPage.Objects.Add(FView);
+
+ Inc(FYPos, 22)
+ end;
+end;
+
procedure TRxDBGridPrint.DoCreateReport;
var
FBand: TfrBandView;
@@ -127,10 +211,17 @@ begin
FPage := FReport.Pages[FReport.Pages.Count-1];
FPage.ChangePaper(FPage.pgSize, FPage.Width, FPage.Height, FOrientation);
- FYPos:=0;
- FXPos:=20;
+ FPage.Margins.Top:=FPageMargin.Top;
+ FPage.Margins.Left:=FPageMargin.Left;
+ FPage.Margins.Bottom:=FPageMargin.Bottom;
+ FPage.Margins.Right:=FPageMargin.Right;
- DoShowTitle;
+ FYPos:=FPageMargin.Top;
+ FXPos:=FPageMargin.Left;
+
+ DoShowReportTitle;
+
+ DoShowColumnsTitle;
FBand := TfrBandView(frCreateObject(gtBand, '', FPage));
FBand.BandType := btMasterData;
@@ -184,7 +275,7 @@ begin
end;
end;
-procedure TRxDBGridPrint.DoShowTitle;
+procedure TRxDBGridPrint.DoShowColumnsTitle;
var
FBand: TfrBandView;
FView: TfrMemoView;
@@ -193,10 +284,9 @@ begin
FBand := TfrBandView(frCreateObject(gtBand, '', FPage));
FBand.BandType := btMasterHeader;
-{!!
- if self.fShowHdOnAllPage then
- FBand.Flags:=FBand.Flags+flBandRepeatHeader;
-}
+ if FShowColumnHeaderOnAllPage then
+ FBand.Flags:=FBand.Flags + flBandRepeatHeader;
+
FBand.SetBounds(FXPos, FYPos, 1000, 20 * FTitleRowCount);
FBand.Flags:=FBand.Flags or flStretched;
FPage.Objects.Add(FBand);
@@ -227,18 +317,16 @@ begin
FBand := TfrBandView(frCreateObject(gtBand, '', FPage));
FBand.BandType := btMasterFooter;
-{!!
- if self.fShowHdOnAllPage then
- FBand.Flags:=FBand.Flags+flBandRepeatHeader;
-}
FBand.SetBounds(FXPos, FYPos, 1000, 20);
FBand.Flags:=FBand.Flags or flStretched;
FPage.Objects.Add(FBand);
FView := frCreateObject(gtMemo, '', FPage) as TfrMemoView;
FView.SetBounds(FXPos, FYPos, 20, 20);
- FView.Alignment:=taCenter;
- FView.FillColor := RxDBGrid.FooterOptions.Color;
+
+ if rxpoShowFooterColor in FOptions then
+ FView.FillColor := RxDBGrid.FooterOptions.Color;
+
// FView.Font.Assign(FTitleFont);
FView.Font.Size:=12;
FView.Frames:=frAllFrames;
@@ -257,10 +345,11 @@ end;
procedure TRxDBGridPrint.OnEnterRect(Memo: TStringList; View: TfrView);
var
- C: TRxColumn;
i, k: Integer;
F:TRxColInfo;
S: String;
+ C:TColor;
+ J: Integer;
begin
i := FColumnDataset.RecNo;
@@ -274,10 +363,25 @@ begin
S:=Memo[0];
if (S='[Cell]') and Assigned(F.Col.Field) then
begin
- Memo[0] := F.Col.Field.DisplayText;
+ if rxpoShowGridColor in FOptions then
+ begin
+ C:=F.Col.Color;
+ if Assigned(RxDBGrid.OnGetCellProps) then
+ RxDBGrid.OnGetCellProps(RxDBGrid, F.Col.Field, TfrMemoView(View).Font, C);
+ TfrMemoView(View).FillColor:=C;
+ end;
+
+ S:=F.Col.Field.DisplayText;
+ if Assigned(F.Col) and (F.Col.KeyList.Count > 0) and (F.Col.PickList.Count > 0) then
+ begin
+ J := F.Col.KeyList.IndexOf(S);
+ if (J >= 0) and (J < F.Col.PickList.Count) then
+ S := F.Col.PickList[j];
+ end;
+
+ Memo[0] := S;
TfrMemoView(View).Alignment:=F.Col.Alignment;
- end
- else
+ end else
if Copy(S, 1, 7) = 'Header_' then
begin
TfrMemoView(View).Alignment:=F.Col.Title.Alignment;
@@ -308,6 +412,11 @@ begin
end;
end;
+procedure TRxDBGridPrint.SetPageMargin(AValue: TRxPageMargin);
+begin
+ FPageMargin.Assign(AValue);
+end;
+
function TRxDBGridPrint.DoExecTools: boolean;
var
C:integer;
@@ -346,20 +455,79 @@ begin
end;
end;
+function TRxDBGridPrint.DoSetupTools: boolean;
+var
+ RxDBGridPrintGrid_SetupForm: TRxDBGridPrintGrid_SetupForm;
+begin
+ RxDBGridPrintGrid_SetupForm:=TRxDBGridPrintGrid_SetupForm.Create(Application);
+
+ RxDBGridPrintGrid_SetupForm.Edit1.Text:=FReportTitle;
+ RxDBGridPrintGrid_SetupForm.RadioGroup1.ItemIndex:=ord(FOrientation);
+ RxDBGridPrintGrid_SetupForm.SpinEdit1.Value:=FPageMargin.Left;
+ RxDBGridPrintGrid_SetupForm.SpinEdit2.Value:=FPageMargin.Top;
+ RxDBGridPrintGrid_SetupForm.SpinEdit3.Value:=FPageMargin.Right;
+ RxDBGridPrintGrid_SetupForm.SpinEdit4.Value:=FPageMargin.Bottom;
+ RxDBGridPrintGrid_SetupForm.CheckBox1.Checked:=FShowColumnHeaderOnAllPage;
+
+ RxDBGridPrintGrid_SetupForm.CheckGroup1.Checked[0]:=rxpoShowTitle in FOptions;
+ RxDBGridPrintGrid_SetupForm.CheckGroup1.Checked[1]:=rxpoShowFooter in FOptions;
+ RxDBGridPrintGrid_SetupForm.CheckGroup1.Checked[2]:=rxpoShowFooterColor in FOptions;
+ RxDBGridPrintGrid_SetupForm.CheckGroup1.Checked[3]:=rxpoShowGridColor in FOptions;
+ RxDBGridPrintGrid_SetupForm.CheckGroup1.Checked[4]:=rxpoShowReportTitle in FOptions;
+
+ Result:=RxDBGridPrintGrid_SetupForm.ShowModal = mrOk;
+ if Result then
+ begin
+ FReportTitle := RxDBGridPrintGrid_SetupForm.Edit1.Text;
+ FOrientation := TPrinterOrientation(RxDBGridPrintGrid_SetupForm.RadioGroup1.ItemIndex);
+ FPageMargin.Left := RxDBGridPrintGrid_SetupForm.SpinEdit1.Value;
+ FPageMargin.Top := RxDBGridPrintGrid_SetupForm.SpinEdit2.Value;
+ FPageMargin.Right := RxDBGridPrintGrid_SetupForm.SpinEdit3.Value;
+ FPageMargin.Bottom := RxDBGridPrintGrid_SetupForm.SpinEdit4.Value;
+
+ FOptions:=[];
+ if RxDBGridPrintGrid_SetupForm.CheckGroup1.Checked[0] then
+ FOptions:=FOptions + [rxpoShowTitle];
+
+ if RxDBGridPrintGrid_SetupForm.CheckGroup1.Checked[1] then
+ FOptions:=FOptions + [rxpoShowFooter];
+
+ if RxDBGridPrintGrid_SetupForm.CheckGroup1.Checked[2] then
+ FOptions:=FOptions + [rxpoShowFooterColor];
+
+ if RxDBGridPrintGrid_SetupForm.CheckGroup1.Checked[3] then
+ FOptions:=FOptions + [rxpoShowGridColor];
+
+ if RxDBGridPrintGrid_SetupForm.CheckGroup1.Checked[4] then
+ FOptions:=FOptions + [rxpoShowReportTitle];
+
+ FShowColumnHeaderOnAllPage:=RxDBGridPrintGrid_SetupForm.CheckBox1.Checked;
+ end;
+ RxDBGridPrintGrid_SetupForm.Free;
+end;
+
constructor TRxDBGridPrint.Create(AOwner: TComponent);
begin
inherited Create(AOwner);
- FCaption:='Print grid';
+ FPageMargin:=TRxPageMargin.Create;
+
+ FCaption:=sPrintGrid;
FShowProgress:=false;
FRxColInfoList:=TObjectList.Create(true);
FOrientation:=poPortrait;
ShowSetupForm:=false;
- FOptions:=[rxpoShowTitle, rxpoShowFooter, rxpoShowFooterColor];
+ FOptions:=[rxpoShowTitle,
+ rxpoShowFooter,
+ rxpoShowGridColor,
+ rxpoShowFooterColor,
+ rxpoShowReportTitle];
+ FShowColumnHeaderOnAllPage:=false;
end;
destructor TRxDBGridPrint.Destroy;
begin
FreeAndNil(FRxColInfoList);
+ FreeAndNil(FPageMargin);
inherited Destroy;
end;
@@ -370,3 +538,8 @@ end;
end.
+{ DONE -oalexs : Необходимо настраивать отступы в печатной форме}
+{ DONE -oalexs : Необходимо настроить отображение раскраски ячеек }
+{ DONE -oalexs : Необходимо правильно выгружать лукапные значение KeyList/PickList }
+{ TODO -oalexs : Необходимо реализовать настройку шрифтов }
+
diff --git a/components/rx/trunk/rxdbgridprintgrid_setupunit.lfm b/components/rx/trunk/rxdbgridprintgrid_setupunit.lfm
new file mode 100644
index 000000000..bc74e0194
--- /dev/null
+++ b/components/rx/trunk/rxdbgridprintgrid_setupunit.lfm
@@ -0,0 +1,264 @@
+object RxDBGridPrintGrid_SetupForm: TRxDBGridPrintGrid_SetupForm
+ Left = 720
+ Height = 317
+ Top = 303
+ Width = 468
+ Caption = 'Print grid setup'
+ ClientHeight = 317
+ ClientWidth = 468
+ OnCreate = FormCreate
+ Position = poScreenCenter
+ LCLVersion = '1.3'
+ object GroupBox1: TGroupBox
+ AnchorSideLeft.Control = Owner
+ AnchorSideTop.Control = Owner
+ AnchorSideRight.Control = CheckGroup1
+ AnchorSideBottom.Control = CheckGroup1
+ AnchorSideBottom.Side = asrBottom
+ Left = 6
+ Height = 150
+ Top = 6
+ Width = 294
+ Anchors = [akTop, akLeft, akRight, akBottom]
+ BorderSpacing.Left = 6
+ BorderSpacing.Top = 6
+ BorderSpacing.Right = 6
+ Caption = 'Page margins'
+ ClientHeight = 127
+ ClientWidth = 290
+ TabOrder = 0
+ object Label1: TLabel
+ AnchorSideLeft.Control = GroupBox1
+ AnchorSideBottom.Control = SpinEdit1
+ AnchorSideBottom.Side = asrBottom
+ Left = 6
+ Height = 21
+ Top = 16
+ Width = 24
+ Anchors = [akLeft, akBottom]
+ BorderSpacing.Left = 6
+ Caption = 'Top'
+ ParentColor = False
+ end
+ object SpinEdit1: TSpinEdit
+ AnchorSideTop.Control = GroupBox1
+ AnchorSideRight.Control = Label5
+ Left = 79
+ Height = 31
+ Top = 6
+ Width = 60
+ Anchors = [akTop, akRight]
+ BorderSpacing.Around = 6
+ MaxValue = 1000
+ TabOrder = 0
+ end
+ object Label2: TLabel
+ AnchorSideLeft.Control = GroupBox1
+ AnchorSideBottom.Control = SpinEdit2
+ AnchorSideBottom.Side = asrBottom
+ Left = 6
+ Height = 21
+ Top = 53
+ Width = 26
+ Anchors = [akLeft, akBottom]
+ BorderSpacing.Left = 6
+ Caption = 'Left'
+ ParentColor = False
+ end
+ object SpinEdit2: TSpinEdit
+ AnchorSideLeft.Side = asrBottom
+ AnchorSideTop.Control = SpinEdit1
+ AnchorSideTop.Side = asrBottom
+ AnchorSideRight.Control = Label5
+ Left = 79
+ Height = 31
+ Top = 43
+ Width = 60
+ Anchors = [akTop, akRight]
+ BorderSpacing.Around = 6
+ MaxValue = 1000
+ TabOrder = 1
+ end
+ object SpinEdit3: TSpinEdit
+ AnchorSideLeft.Side = asrBottom
+ AnchorSideTop.Control = GroupBox1
+ AnchorSideRight.Control = GroupBox1
+ AnchorSideRight.Side = asrBottom
+ Left = 224
+ Height = 31
+ Top = 6
+ Width = 60
+ Anchors = [akTop, akRight]
+ BorderSpacing.Around = 6
+ MaxValue = 1000
+ TabOrder = 2
+ end
+ object Label3: TLabel
+ AnchorSideLeft.Control = Label5
+ AnchorSideLeft.Side = asrBottom
+ AnchorSideBottom.Control = SpinEdit3
+ AnchorSideBottom.Side = asrBottom
+ Left = 146
+ Height = 21
+ Top = 16
+ Width = 34
+ Anchors = [akLeft, akBottom]
+ Caption = 'Right'
+ ParentColor = False
+ end
+ object Label4: TLabel
+ AnchorSideLeft.Control = Label5
+ AnchorSideLeft.Side = asrBottom
+ AnchorSideBottom.Control = SpinEdit4
+ AnchorSideBottom.Side = asrBottom
+ Left = 146
+ Height = 21
+ Top = 53
+ Width = 49
+ Anchors = [akLeft, akBottom]
+ Caption = 'Bottom'
+ ParentColor = False
+ end
+ object SpinEdit4: TSpinEdit
+ AnchorSideTop.Control = SpinEdit3
+ AnchorSideTop.Side = asrBottom
+ AnchorSideRight.Control = GroupBox1
+ AnchorSideRight.Side = asrBottom
+ Left = 224
+ Height = 31
+ Top = 43
+ Width = 60
+ Anchors = [akTop, akRight]
+ BorderSpacing.Around = 6
+ MaxValue = 1000
+ TabOrder = 3
+ end
+ object Label5: TLabel
+ AnchorSideLeft.Control = GroupBox1
+ AnchorSideLeft.Side = asrCenter
+ AnchorSideTop.Control = GroupBox1
+ Left = 145
+ Height = 1
+ Top = 0
+ Width = 1
+ ParentColor = False
+ end
+ end
+ object ButtonPanel1: TButtonPanel
+ Left = 6
+ Height = 41
+ Top = 270
+ Width = 456
+ OKButton.Name = 'OKButton'
+ OKButton.DefaultCaption = True
+ HelpButton.Name = 'HelpButton'
+ HelpButton.DefaultCaption = True
+ CloseButton.Name = 'CloseButton'
+ CloseButton.DefaultCaption = True
+ CancelButton.Name = 'CancelButton'
+ CancelButton.DefaultCaption = True
+ TabOrder = 1
+ ShowButtons = [pbOK, pbCancel, pbHelp]
+ end
+ object CheckGroup1: TCheckGroup
+ AnchorSideTop.Control = Owner
+ AnchorSideRight.Control = Owner
+ AnchorSideRight.Side = asrBottom
+ Left = 306
+ Height = 150
+ Top = 6
+ Width = 156
+ Anchors = [akTop, akRight]
+ AutoFill = True
+ AutoSize = True
+ BorderSpacing.Around = 6
+ Caption = 'Print options'
+ ChildSizing.LeftRightSpacing = 6
+ ChildSizing.TopBottomSpacing = 6
+ ChildSizing.EnlargeHorizontal = crsHomogenousChildResize
+ ChildSizing.EnlargeVertical = crsHomogenousChildResize
+ ChildSizing.ShrinkHorizontal = crsScaleChilds
+ ChildSizing.ShrinkVertical = crsScaleChilds
+ ChildSizing.Layout = cclLeftToRightThenTopToBottom
+ ChildSizing.ControlsPerLine = 1
+ ClientHeight = 127
+ ClientWidth = 152
+ Items.Strings = (
+ 'Show title'
+ 'Show footer'
+ 'Show footer color'
+ 'Show grid color'
+ 'Show report title'
+ )
+ TabOrder = 2
+ Data = {
+ 050000000202020202
+ }
+ end
+ object RadioGroup1: TRadioGroup
+ AnchorSideLeft.Control = Owner
+ AnchorSideTop.Control = GroupBox1
+ AnchorSideTop.Side = asrBottom
+ Left = 6
+ Height = 69
+ Top = 162
+ Width = 106
+ AutoFill = True
+ AutoSize = True
+ BorderSpacing.Around = 6
+ Caption = 'Orientation'
+ ChildSizing.LeftRightSpacing = 6
+ ChildSizing.EnlargeHorizontal = crsHomogenousChildResize
+ ChildSizing.EnlargeVertical = crsHomogenousChildResize
+ ChildSizing.ShrinkHorizontal = crsScaleChilds
+ ChildSizing.ShrinkVertical = crsScaleChilds
+ ChildSizing.Layout = cclLeftToRightThenTopToBottom
+ ChildSizing.ControlsPerLine = 1
+ ClientHeight = 46
+ ClientWidth = 102
+ Items.Strings = (
+ 'Portrait'
+ 'Landscape'
+ )
+ TabOrder = 3
+ end
+ object Label6: TLabel
+ AnchorSideLeft.Control = RadioGroup1
+ AnchorSideLeft.Side = asrBottom
+ AnchorSideTop.Control = GroupBox1
+ AnchorSideTop.Side = asrBottom
+ Left = 118
+ Height = 21
+ Top = 162
+ Width = 75
+ BorderSpacing.Around = 6
+ Caption = 'Report title'
+ ParentColor = False
+ end
+ object Edit1: TEdit
+ AnchorSideLeft.Control = Label6
+ AnchorSideTop.Control = Label6
+ AnchorSideTop.Side = asrBottom
+ AnchorSideRight.Control = Owner
+ AnchorSideRight.Side = asrBottom
+ Left = 124
+ Height = 31
+ Top = 189
+ Width = 338
+ Anchors = [akTop, akLeft, akRight]
+ BorderSpacing.Around = 6
+ TabOrder = 4
+ end
+ object CheckBox1: TCheckBox
+ AnchorSideLeft.Control = Owner
+ AnchorSideTop.Control = RadioGroup1
+ AnchorSideTop.Side = asrBottom
+ Left = 6
+ Height = 23
+ Top = 237
+ Width = 233
+ BorderSpacing.Around = 6
+ Caption = 'Show column header on all page'
+ TabOrder = 5
+ end
+end
diff --git a/components/rx/trunk/rxdbgridprintgrid_setupunit.pas b/components/rx/trunk/rxdbgridprintgrid_setupunit.pas
new file mode 100644
index 000000000..4fcff12a3
--- /dev/null
+++ b/components/rx/trunk/rxdbgridprintgrid_setupunit.pas
@@ -0,0 +1,102 @@
+{ RxDBGridPrintGrid unit
+
+ Copyright (C) 2005-2014 Lagunov Aleksey alexs@yandex.ru and Lazarus team
+ original conception from rx library for Delphi (c)
+
+ This library is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Library General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or (at your
+ option) any later version with the following modification:
+
+ As a special exception, the copyright holders of this library give you
+ permission to link this library with independent modules to produce an
+ executable, regardless of the license terms of these independent modules,and
+ to copy and distribute the resulting executable under terms of your choice,
+ provided that you also meet, for each linked independent module, the terms
+ and conditions of the license of that module. An independent module is a
+ module which is not derived from or based on this library. If you modify
+ this library, you may extend this exception to your version of the library,
+ but you are not obligated to do so. If you do not wish to do so, delete this
+ exception statement from your version.
+
+ This program is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License
+ for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; if not, write to the Free Software Foundation,
+ Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+}
+
+unit RxDBGridPrintGrid_SetupUnit;
+
+{$I rx.inc}
+
+interface
+
+uses
+ Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, StdCtrls,
+ Spin, ButtonPanel, ExtCtrls;
+
+type
+
+ { TRxDBGridPrintGrid_SetupForm }
+
+ TRxDBGridPrintGrid_SetupForm = class(TForm)
+ ButtonPanel1: TButtonPanel;
+ CheckBox1: TCheckBox;
+ CheckGroup1: TCheckGroup;
+ Edit1: TEdit;
+ GroupBox1: TGroupBox;
+ Label1: TLabel;
+ Label2: TLabel;
+ Label3: TLabel;
+ Label4: TLabel;
+ Label5: TLabel;
+ Label6: TLabel;
+ RadioGroup1: TRadioGroup;
+ SpinEdit1: TSpinEdit;
+ SpinEdit2: TSpinEdit;
+ SpinEdit3: TSpinEdit;
+ SpinEdit4: TSpinEdit;
+ procedure FormCreate(Sender: TObject);
+ private
+ { private declarations }
+ public
+ { public declarations }
+ end;
+
+implementation
+uses rxdconst;
+
+{$R *.lfm}
+
+{ TRxDBGridPrintGrid_SetupForm }
+
+procedure TRxDBGridPrintGrid_SetupForm.FormCreate(Sender: TObject);
+begin
+ CheckBox1.Caption:=sShowColumnHeaderOnAllPage;
+ CheckGroup1.Caption:=sPrintOptions;
+ CheckGroup1.Items[0]:=sShowTitle;
+ CheckGroup1.Items[1]:=sShowFooter;
+ CheckGroup1.Items[2]:=sShowFooterColor;
+ CheckGroup1.Items[3]:=sShowGridColor;
+ CheckGroup1.Items[4]:=sShowReportTitle;
+
+
+ GroupBox1.Caption:=sPageMargins;
+ Label1.Caption:=sTopCaption;
+ Label2.Caption:=sLeftCaption;
+ Label3.Caption:=sRightCaption;
+ Label4.Caption:=sBottomCaption;
+ Label6.Caption:=sReportTitle;
+
+ RadioGroup1.Caption:=sOrientation;
+ RadioGroup1.Items[0]:=sPortrait;
+ RadioGroup1.Items[1]:=sLandscape;
+
+end;
+
+end.
+
diff --git a/components/rx/trunk/rxdconst.pas b/components/rx/trunk/rxdconst.pas
index e6e12535d..0f6e35618 100644
--- a/components/rx/trunk/rxdconst.pas
+++ b/components/rx/trunk/rxdconst.pas
@@ -172,14 +172,33 @@ resourcestring
sUnknownXMLDatasetFormat = 'Unknown XML Dataset format';
- sToolsExportSpeadSheet = 'Export to speadsheet';
- sExportFileName = 'Export file name';
- sOpenAfterExport = 'Open after export';
- sPageName = 'Page name';
- sExportColumnHeader = 'Export column header';
- sExportColumnFooter = 'Export column footer';
- sExportCellColors = 'Export cell colors';
- sOverwriteExisting = 'Overwrite existing';
+ sToolsExportSpeadSheet = 'Export to speadsheet';
+ sExportFileName = 'Export file name';
+ sOpenAfterExport = 'Open after export';
+ sPageName = 'Page name';
+ sExportColumnHeader = 'Export column header';
+ sExportColumnFooter = 'Export column footer';
+ sExportCellColors = 'Export cell colors';
+ sOverwriteExisting = 'Overwrite existing';
+ sShowColumnHeaderOnAllPage = 'Show column header on all page';
+ sPageMargins = 'Page margins';
+ sLeftCaption = 'Left';
+ sTopCaption = 'Top';
+ sRightCaption = 'Right';
+ sBottomCaption = 'Bottom';
+ sReportTitle = 'Report title';
+ sOrientation = 'Orientation';
+ sPortrait = 'Portrait';
+ sLandscape = 'Landscape';
+ sPrintOptions = 'Print options';
+
+ sShowTitle = 'Show column title';
+ sShowFooter = 'Show footer';
+ sShowFooterColor = 'Show footer color';
+ sShowGridColor = 'Show grid color';
+ sShowReportTitle = 'Show report title';
+ sPrintGrid = 'Print grid';
+
const