TRxDBGridPrint - print setup form

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@3435 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
alexs75
2014-08-06 09:58:37 +00:00
parent ebf59489f2
commit 9a5b89778f
10 changed files with 870 additions and 36 deletions

View File

@@ -5,6 +5,10 @@ msgstr "Content-Type: text/plain; charset=UTF-8"
msgid "Application \"%s\"" msgid "Application \"%s\""
msgstr "Aplicación \"%s\"" msgstr "Aplicación \"%s\""
#: rxdconst.sbottomcaption
msgid "Bottom"
msgstr ""
#: rxdconst.sbrowsedata #: rxdconst.sbrowsedata
msgid "browse" msgid "browse"
msgstr "vista" msgstr "vista"
@@ -163,6 +167,14 @@ msgstr "No hay campos definido"
msgid "User name or password not valid" msgid "User name or password not valid"
msgstr "Nombre de usuario o clave no es valido" msgstr "Nombre de usuario o clave no es valido"
#: rxdconst.slandscape
msgid "Landscape"
msgstr ""
#: rxdconst.sleftcaption
msgid "Left"
msgstr ""
#: rxdconst.slocaldatabase #: rxdconst.slocaldatabase
msgid "Unable complete this operation on local dataset" msgid "Unable complete this operation on local dataset"
msgstr "No se puede completar esta operación en el conjunto de datos local" 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" msgid "Open after export"
msgstr "" msgstr ""
#: rxdconst.sorientation
msgid "Orientation"
msgstr ""
#: rxdconst.soverwriteexisting #: rxdconst.soverwriteexisting
msgid "Overwrite existing" msgid "Overwrite existing"
msgstr "" msgstr ""
#: rxdconst.spagemargins
msgid "Page margins"
msgstr ""
#: rxdconst.spagename #: rxdconst.spagename
msgid "Page name" msgid "Page name"
msgstr "" msgstr ""
@@ -227,10 +247,22 @@ msgstr "Clave no cambio"
msgid "New password and confirmation not equal" msgid "New password and confirmation not equal"
msgstr "Nueva clave y confirmacion no son iguales" msgstr "Nueva clave y confirmacion no son iguales"
#: rxdconst.sportrait
msgid "Portrait"
msgstr ""
#: rxdconst.sprevbutton #: rxdconst.sprevbutton
msgid "&Prior" msgid "&Prior"
msgstr "&Anterior" msgstr "&Anterior"
#: rxdconst.sprintgrid
msgid "Print grid"
msgstr ""
#: rxdconst.sprintoptions
msgid "Print options"
msgstr ""
#: rxdconst.spropdefbylookup #: rxdconst.spropdefbylookup
msgid "PropDefByLookup" msgid "PropDefByLookup"
msgstr "PropDefByLookup" msgstr "PropDefByLookup"
@@ -239,10 +271,18 @@ msgstr "PropDefByLookup"
msgid "Register" msgid "Register"
msgstr "Registro" msgstr "Registro"
#: rxdconst.sreporttitle
msgid "Report title"
msgstr ""
#: rxdconst.sretrylogin #: rxdconst.sretrylogin
msgid "Retry to connect with database?" msgid "Retry to connect with database?"
msgstr "Reintentar conectar con la base de dato?" msgstr "Reintentar conectar con la base de dato?"
#: rxdconst.srightcaption
msgid "Right"
msgstr ""
#: rxdconst.srxallfields #: rxdconst.srxallfields
msgid "All fields" msgid "All fields"
msgstr "" msgstr ""
@@ -475,10 +515,38 @@ msgstr "Error del Servidor"
msgid "find" msgid "find"
msgstr "buscar" 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 #: rxdconst.stoolsexportspeadsheet
msgid "Export to speadsheet" msgid "Export to speadsheet"
msgstr "" msgstr ""
#: rxdconst.stopcaption
msgid "Top"
msgstr ""
#: rxdconst.sunknownfieldtype #: rxdconst.sunknownfieldtype
msgid "SUnknownFieldType %s" msgid "SUnknownFieldType %s"
msgstr "STipoCampoDesconocido %s" msgstr "STipoCampoDesconocido %s"

View File

@@ -5,6 +5,10 @@ msgstr "Content-Type: text/plain; charset=UTF-8"
msgid "Application \"%s\"" msgid "Application \"%s\""
msgstr "" msgstr ""
#: rxdconst.sbottomcaption
msgid "Bottom"
msgstr ""
#: rxdconst.sbrowsedata #: rxdconst.sbrowsedata
msgid "browse" msgid "browse"
msgstr "" msgstr ""
@@ -161,6 +165,14 @@ msgstr ""
msgid "User name or password not valid" msgid "User name or password not valid"
msgstr "" msgstr ""
#: rxdconst.slandscape
msgid "Landscape"
msgstr ""
#: rxdconst.sleftcaption
msgid "Left"
msgstr ""
#: rxdconst.slocaldatabase #: rxdconst.slocaldatabase
msgid "Unable complete this operation on local dataset" msgid "Unable complete this operation on local dataset"
msgstr "" msgstr ""
@@ -201,10 +213,18 @@ msgstr ""
msgid "Open after export" msgid "Open after export"
msgstr "" msgstr ""
#: rxdconst.sorientation
msgid "Orientation"
msgstr ""
#: rxdconst.soverwriteexisting #: rxdconst.soverwriteexisting
msgid "Overwrite existing" msgid "Overwrite existing"
msgstr "" msgstr ""
#: rxdconst.spagemargins
msgid "Page margins"
msgstr ""
#: rxdconst.spagename #: rxdconst.spagename
msgid "Page name" msgid "Page name"
msgstr "" msgstr ""
@@ -225,10 +245,22 @@ msgstr ""
msgid "New password and confirmation not equal" msgid "New password and confirmation not equal"
msgstr "" msgstr ""
#: rxdconst.sportrait
msgid "Portrait"
msgstr ""
#: rxdconst.sprevbutton #: rxdconst.sprevbutton
msgid "&Prior" msgid "&Prior"
msgstr "" msgstr ""
#: rxdconst.sprintgrid
msgid "Print grid"
msgstr ""
#: rxdconst.sprintoptions
msgid "Print options"
msgstr ""
#: rxdconst.spropdefbylookup #: rxdconst.spropdefbylookup
msgid "PropDefByLookup" msgid "PropDefByLookup"
msgstr "" msgstr ""
@@ -237,10 +269,18 @@ msgstr ""
msgid "Register" msgid "Register"
msgstr "" msgstr ""
#: rxdconst.sreporttitle
msgid "Report title"
msgstr ""
#: rxdconst.sretrylogin #: rxdconst.sretrylogin
msgid "Retry to connect with database?" msgid "Retry to connect with database?"
msgstr "" msgstr ""
#: rxdconst.srightcaption
msgid "Right"
msgstr ""
#: rxdconst.srxallfields #: rxdconst.srxallfields
msgid "All fields" msgid "All fields"
msgstr "" msgstr ""
@@ -471,10 +511,38 @@ msgstr ""
msgid "find" msgid "find"
msgstr "" 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 #: rxdconst.stoolsexportspeadsheet
msgid "Export to speadsheet" msgid "Export to speadsheet"
msgstr "" msgstr ""
#: rxdconst.stopcaption
msgid "Top"
msgstr ""
#: rxdconst.sunknownfieldtype #: rxdconst.sunknownfieldtype
msgid "SUnknownFieldType %s" msgid "SUnknownFieldType %s"
msgstr "" msgstr ""

View File

@@ -5,6 +5,10 @@ msgstr "Content-Type: text/plain; charset=UTF-8"
msgid "Application \"%s\"" msgid "Application \"%s\""
msgstr "Программа \"%s\"" msgstr "Программа \"%s\""
#: rxdconst.sbottomcaption
msgid "Bottom"
msgstr ""
#: rxdconst.sbrowsedata #: rxdconst.sbrowsedata
msgid "browse" msgid "browse"
msgstr "просмотр" msgstr "просмотр"
@@ -163,6 +167,14 @@ msgstr "Нет объявления полей"
msgid "User name or password not valid" msgid "User name or password not valid"
msgstr "Ошибка в имени пользователя или пароле" msgstr "Ошибка в имени пользователя или пароле"
#: rxdconst.slandscape
msgid "Landscape"
msgstr ""
#: rxdconst.sleftcaption
msgid "Left"
msgstr ""
#: rxdconst.slocaldatabase #: rxdconst.slocaldatabase
msgid "Unable complete this operation on local dataset" msgid "Unable complete this operation on local dataset"
msgstr "Невозможно произвести эту операцию с локальной базой данных" msgstr "Невозможно произвести эту операцию с локальной базой данных"
@@ -203,10 +215,18 @@ msgstr "&Старый пароль"
msgid "Open after export" msgid "Open after export"
msgstr "Открыть после экспорта" msgstr "Открыть после экспорта"
#: rxdconst.sorientation
msgid "Orientation"
msgstr ""
#: rxdconst.soverwriteexisting #: rxdconst.soverwriteexisting
msgid "Overwrite existing" msgid "Overwrite existing"
msgstr "Перезаписать существующее" msgstr "Перезаписать существующее"
#: rxdconst.spagemargins
msgid "Page margins"
msgstr ""
#: rxdconst.spagename #: rxdconst.spagename
msgid "Page name" msgid "Page name"
msgstr "Название страницы" msgstr "Название страницы"
@@ -227,10 +247,22 @@ msgstr "Пароль не изменён"
msgid "New password and confirmation not equal" msgid "New password and confirmation not equal"
msgstr "Новый пароль и подтверждение не совпадают" msgstr "Новый пароль и подтверждение не совпадают"
#: rxdconst.sportrait
msgid "Portrait"
msgstr ""
#: rxdconst.sprevbutton #: rxdconst.sprevbutton
msgid "&Prior" msgid "&Prior"
msgstr "&Превыдущие" msgstr "&Превыдущие"
#: rxdconst.sprintgrid
msgid "Print grid"
msgstr ""
#: rxdconst.sprintoptions
msgid "Print options"
msgstr ""
#: rxdconst.spropdefbylookup #: rxdconst.spropdefbylookup
msgid "PropDefByLookup" msgid "PropDefByLookup"
msgstr "" msgstr ""
@@ -239,10 +271,18 @@ msgstr ""
msgid "Register" msgid "Register"
msgstr "Регистрация" msgstr "Регистрация"
#: rxdconst.sreporttitle
msgid "Report title"
msgstr ""
#: rxdconst.sretrylogin #: rxdconst.sretrylogin
msgid "Retry to connect with database?" msgid "Retry to connect with database?"
msgstr "Вы хотите повторить попытку соединения с базой данных?" msgstr "Вы хотите повторить попытку соединения с базой данных?"
#: rxdconst.srightcaption
msgid "Right"
msgstr ""
#: rxdconst.srxallfields #: rxdconst.srxallfields
msgid "All fields" msgid "All fields"
msgstr "Все поля" msgstr "Все поля"
@@ -473,10 +513,38 @@ msgstr "Ошибка сервера"
msgid "find" msgid "find"
msgstr "поиск" 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 #: rxdconst.stoolsexportspeadsheet
msgid "Export to speadsheet" msgid "Export to speadsheet"
msgstr "Экспорт в электронную таблицу" msgstr "Экспорт в электронную таблицу"
#: rxdconst.stopcaption
msgid "Top"
msgstr ""
#: rxdconst.sunknownfieldtype #: rxdconst.sunknownfieldtype
msgid "SUnknownFieldType %s" msgid "SUnknownFieldType %s"
msgstr "Не определён тип данных для поля %s" msgstr "Не определён тип данных для поля %s"

View File

@@ -14,6 +14,10 @@ msgstr ""
msgid "Application \"%s\"" msgid "Application \"%s\""
msgstr "Програма \"%s\"" msgstr "Програма \"%s\""
#: rxdconst.sbottomcaption
msgid "Bottom"
msgstr ""
#: rxdconst.sbrowsedata #: rxdconst.sbrowsedata
msgid "browse" msgid "browse"
msgstr "перегляд" msgstr "перегляд"
@@ -172,6 +176,14 @@ msgstr "Немає оголошення полів"
msgid "User name or password not valid" msgid "User name or password not valid"
msgstr "Помилка в імені користувача або паролі" msgstr "Помилка в імені користувача або паролі"
#: rxdconst.slandscape
msgid "Landscape"
msgstr ""
#: rxdconst.sleftcaption
msgid "Left"
msgstr ""
#: rxdconst.slocaldatabase #: rxdconst.slocaldatabase
msgid "Unable complete this operation on local dataset" msgid "Unable complete this operation on local dataset"
msgstr "Неможливо провести цю операцію з локальною базою даних" msgstr "Неможливо провести цю операцію з локальною базою даних"
@@ -212,10 +224,18 @@ msgstr "&Старий пароль"
msgid "Open after export" msgid "Open after export"
msgstr "" msgstr ""
#: rxdconst.sorientation
msgid "Orientation"
msgstr ""
#: rxdconst.soverwriteexisting #: rxdconst.soverwriteexisting
msgid "Overwrite existing" msgid "Overwrite existing"
msgstr "" msgstr ""
#: rxdconst.spagemargins
msgid "Page margins"
msgstr ""
#: rxdconst.spagename #: rxdconst.spagename
msgid "Page name" msgid "Page name"
msgstr "" msgstr ""
@@ -236,10 +256,22 @@ msgstr "Пароль не змінено"
msgid "New password and confirmation not equal" msgid "New password and confirmation not equal"
msgstr "Новий пароль і підтвердження не співпадають" msgstr "Новий пароль і підтвердження не співпадають"
#: rxdconst.sportrait
msgid "Portrait"
msgstr ""
#: rxdconst.sprevbutton #: rxdconst.sprevbutton
msgid "&Prior" msgid "&Prior"
msgstr "&Попередній" msgstr "&Попередній"
#: rxdconst.sprintgrid
msgid "Print grid"
msgstr ""
#: rxdconst.sprintoptions
msgid "Print options"
msgstr ""
#: rxdconst.spropdefbylookup #: rxdconst.spropdefbylookup
msgid "PropDefByLookup" msgid "PropDefByLookup"
msgstr "" msgstr ""
@@ -248,10 +280,18 @@ msgstr ""
msgid "Register" msgid "Register"
msgstr "Реєстрація" msgstr "Реєстрація"
#: rxdconst.sreporttitle
msgid "Report title"
msgstr ""
#: rxdconst.sretrylogin #: rxdconst.sretrylogin
msgid "Retry to connect with database?" msgid "Retry to connect with database?"
msgstr "Ви хочете повторити спробу з'єднання з базою даних?" msgstr "Ви хочете повторити спробу з'єднання з базою даних?"
#: rxdconst.srightcaption
msgid "Right"
msgstr ""
#: rxdconst.srxallfields #: rxdconst.srxallfields
msgid "All fields" msgid "All fields"
msgstr "" msgstr ""
@@ -482,10 +522,38 @@ msgstr "Помилка сервера"
msgid "find" msgid "find"
msgstr "Пошук" 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 #: rxdconst.stoolsexportspeadsheet
msgid "Export to speadsheet" msgid "Export to speadsheet"
msgstr "" msgstr ""
#: rxdconst.stopcaption
msgid "Top"
msgstr ""
#: rxdconst.sunknownfieldtype #: rxdconst.sunknownfieldtype
msgid "SUnknownFieldType %s" msgid "SUnknownFieldType %s"
msgstr "Не визначений тип даних для поля %s" msgstr "Не визначений тип даних для поля %s"

View File

@@ -5,15 +5,19 @@
<CompilerOptions> <CompilerOptions>
<Version Value="11"/> <Version Value="11"/>
<SearchPaths> <SearchPaths>
<UnitOutputDirectory Value="lib/$(TargetCPU)-$(TargetOS)/"/> <UnitOutputDirectory Value="lib/$(TargetCPU)-$(TargetOS)"/>
</SearchPaths> </SearchPaths>
</CompilerOptions> </CompilerOptions>
<Files Count="1"> <Files Count="2">
<Item1> <Item1>
<Filename Value="rxdbgridprintgrid.pas"/> <Filename Value="rxdbgridprintgrid.pas"/>
<HasRegisterProc Value="True"/> <HasRegisterProc Value="True"/>
<UnitName Value="RxDBGridPrintGrid"/> <UnitName Value="RxDBGridPrintGrid"/>
</Item1> </Item1>
<Item2>
<Filename Value="rxdbgridprintgrid_setupunit.pas"/>
<UnitName Value="rxdbgridprintgrid_setupunit"/>
</Item2>
</Files> </Files>
<Type Value="RunAndDesignTime"/> <Type Value="RunAndDesignTime"/>
<RequiredPkgs Count="3"> <RequiredPkgs Count="3">

View File

@@ -7,7 +7,7 @@ unit rxdbgrid_print;
interface interface
uses uses
RxDBGridPrintGrid, LazarusPackageIntf; RxDBGridPrintGrid, RxDBGridPrintGrid_SetupUnit, LazarusPackageIntf;
implementation implementation

View File

@@ -1,4 +1,4 @@
{ rxdbgrid unit { RxDBGridPrintGrid unit
Copyright (C) 2005-2014 Lagunov Aleksey alexs@yandex.ru and Lazarus team Copyright (C) 2005-2014 Lagunov Aleksey alexs@yandex.ru and Lazarus team
original conception from rx library for Delphi (c) original conception from rx library for Delphi (c)
@@ -30,7 +30,7 @@
} }
unit RxDBGridPrintGrid; unit RxDBGridPrintGrid;
{$mode objfpc}{$H+} {$I rx.inc}
interface interface
@@ -39,9 +39,16 @@ uses
Graphics, Printers; Graphics, Printers;
type type
TRxDBGridPrintOption = (rxpoShowTitle, rxpoShowFooter, rxpoShowFooterColor); TRxDBGridPrintOption =
(rxpoShowTitle,
rxpoShowFooter,
rxpoShowGridColor,
rxpoShowFooterColor,
rxpoShowReportTitle
);
TRxDBGridPrintOptions = set of TRxDBGridPrintOption; TRxDBGridPrintOptions = set of TRxDBGridPrintOption;
{ TRxColInfo } { TRxColInfo }
TRxColInfo = class TRxColInfo = class
@@ -52,17 +59,39 @@ type
destructor Destroy; override; destructor Destroy; override;
end; 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 }
TRxDBGridPrint = class(TRxDBGridAbstractTools) TRxDBGridPrint = class(TRxDBGridAbstractTools)
private private
FOptions: TRxDBGridPrintOptions; FOptions: TRxDBGridPrintOptions;
FOrientation: TPrinterOrientation; FOrientation: TPrinterOrientation;
FPageMargin: TRxPageMargin;
FReport : TfrReport; FReport : TfrReport;
FReportDataSet : TfrDBDataSet; FReportDataSet : TfrDBDataSet;
FColumnDataSet : TfrUserDataSet; FColumnDataSet : TfrUserDataSet;
FDataSet : TDataset; FDataSet : TDataset;
FPage : TfrPage; FPage : TfrPage;
FReportTitle: string;
FShowColumnHeaderOnAllPage: boolean;
FShowProgress : Boolean; FShowProgress : Boolean;
FTitleRowCount : integer; FTitleRowCount : integer;
@@ -70,14 +99,17 @@ type
FYPos: Integer; FYPos: Integer;
FXPos: Integer; FXPos: Integer;
procedure DoShowReportTitle;
procedure DoCreateReport; procedure DoCreateReport;
procedure DoSetupColumns; procedure DoSetupColumns;
procedure DoShowTitle; procedure DoShowColumnsTitle;
procedure DoShowFooter; procedure DoShowFooter;
procedure OnPrintColumn(ColNo: Integer; var Width: Integer); procedure OnPrintColumn(ColNo: Integer; var Width: Integer);
procedure OnEnterRect(Memo: TStringList; View: TfrView); procedure OnEnterRect(Memo: TStringList; View: TfrView);
procedure SetPageMargin(AValue: TRxPageMargin);
protected protected
function DoExecTools:boolean;override; function DoExecTools:boolean;override;
function DoSetupTools:boolean; override;
public public
constructor Create(AOwner: TComponent); override; constructor Create(AOwner: TComponent); override;
destructor Destroy; override; destructor Destroy; override;
@@ -86,12 +118,15 @@ type
property Orientation: TPrinterOrientation read FOrientation write FOrientation default poPortrait; property Orientation: TPrinterOrientation read FOrientation write FOrientation default poPortrait;
property Options:TRxDBGridPrintOptions read FOptions write FOptions; property Options:TRxDBGridPrintOptions read FOptions write FOptions;
property ShowProgress : Boolean read FShowProgress write FShowProgress default false; 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; end;
procedure Register; procedure Register;
implementation implementation
uses math; uses math, RxDBGridPrintGrid_SetupUnit, Forms, Controls, rxdconst;
{$R rxdbgridprintgrid.res} {$R rxdbgridprintgrid.res}
@@ -100,6 +135,30 @@ begin
RegisterComponents('RX DBAware',[TRxDBGridPrint]); RegisterComponents('RX DBAware',[TRxDBGridPrint]);
end; 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 } { TRxColInfo }
constructor TRxColInfo.Create; constructor TRxColInfo.Create;
@@ -117,6 +176,31 @@ end;
{ TRxDBGridPrint } { 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; procedure TRxDBGridPrint.DoCreateReport;
var var
FBand: TfrBandView; FBand: TfrBandView;
@@ -127,10 +211,17 @@ begin
FPage := FReport.Pages[FReport.Pages.Count-1]; FPage := FReport.Pages[FReport.Pages.Count-1];
FPage.ChangePaper(FPage.pgSize, FPage.Width, FPage.Height, FOrientation); FPage.ChangePaper(FPage.pgSize, FPage.Width, FPage.Height, FOrientation);
FYPos:=0; FPage.Margins.Top:=FPageMargin.Top;
FXPos:=20; 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 := TfrBandView(frCreateObject(gtBand, '', FPage));
FBand.BandType := btMasterData; FBand.BandType := btMasterData;
@@ -184,7 +275,7 @@ begin
end; end;
end; end;
procedure TRxDBGridPrint.DoShowTitle; procedure TRxDBGridPrint.DoShowColumnsTitle;
var var
FBand: TfrBandView; FBand: TfrBandView;
FView: TfrMemoView; FView: TfrMemoView;
@@ -193,10 +284,9 @@ begin
FBand := TfrBandView(frCreateObject(gtBand, '', FPage)); FBand := TfrBandView(frCreateObject(gtBand, '', FPage));
FBand.BandType := btMasterHeader; FBand.BandType := btMasterHeader;
{!! if FShowColumnHeaderOnAllPage then
if self.fShowHdOnAllPage then FBand.Flags:=FBand.Flags + flBandRepeatHeader;
FBand.Flags:=FBand.Flags+flBandRepeatHeader;
}
FBand.SetBounds(FXPos, FYPos, 1000, 20 * FTitleRowCount); FBand.SetBounds(FXPos, FYPos, 1000, 20 * FTitleRowCount);
FBand.Flags:=FBand.Flags or flStretched; FBand.Flags:=FBand.Flags or flStretched;
FPage.Objects.Add(FBand); FPage.Objects.Add(FBand);
@@ -227,18 +317,16 @@ begin
FBand := TfrBandView(frCreateObject(gtBand, '', FPage)); FBand := TfrBandView(frCreateObject(gtBand, '', FPage));
FBand.BandType := btMasterFooter; FBand.BandType := btMasterFooter;
{!!
if self.fShowHdOnAllPage then
FBand.Flags:=FBand.Flags+flBandRepeatHeader;
}
FBand.SetBounds(FXPos, FYPos, 1000, 20); FBand.SetBounds(FXPos, FYPos, 1000, 20);
FBand.Flags:=FBand.Flags or flStretched; FBand.Flags:=FBand.Flags or flStretched;
FPage.Objects.Add(FBand); FPage.Objects.Add(FBand);
FView := frCreateObject(gtMemo, '', FPage) as TfrMemoView; FView := frCreateObject(gtMemo, '', FPage) as TfrMemoView;
FView.SetBounds(FXPos, FYPos, 20, 20); 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.Assign(FTitleFont);
FView.Font.Size:=12; FView.Font.Size:=12;
FView.Frames:=frAllFrames; FView.Frames:=frAllFrames;
@@ -257,10 +345,11 @@ end;
procedure TRxDBGridPrint.OnEnterRect(Memo: TStringList; View: TfrView); procedure TRxDBGridPrint.OnEnterRect(Memo: TStringList; View: TfrView);
var var
C: TRxColumn;
i, k: Integer; i, k: Integer;
F:TRxColInfo; F:TRxColInfo;
S: String; S: String;
C:TColor;
J: Integer;
begin begin
i := FColumnDataset.RecNo; i := FColumnDataset.RecNo;
@@ -274,10 +363,25 @@ begin
S:=Memo[0]; S:=Memo[0];
if (S='[Cell]') and Assigned(F.Col.Field) then if (S='[Cell]') and Assigned(F.Col.Field) then
begin 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; TfrMemoView(View).Alignment:=F.Col.Alignment;
end end else
else
if Copy(S, 1, 7) = 'Header_' then if Copy(S, 1, 7) = 'Header_' then
begin begin
TfrMemoView(View).Alignment:=F.Col.Title.Alignment; TfrMemoView(View).Alignment:=F.Col.Title.Alignment;
@@ -308,6 +412,11 @@ begin
end; end;
end; end;
procedure TRxDBGridPrint.SetPageMargin(AValue: TRxPageMargin);
begin
FPageMargin.Assign(AValue);
end;
function TRxDBGridPrint.DoExecTools: boolean; function TRxDBGridPrint.DoExecTools: boolean;
var var
C:integer; C:integer;
@@ -346,20 +455,79 @@ begin
end; end;
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); constructor TRxDBGridPrint.Create(AOwner: TComponent);
begin begin
inherited Create(AOwner); inherited Create(AOwner);
FCaption:='Print grid'; FPageMargin:=TRxPageMargin.Create;
FCaption:=sPrintGrid;
FShowProgress:=false; FShowProgress:=false;
FRxColInfoList:=TObjectList.Create(true); FRxColInfoList:=TObjectList.Create(true);
FOrientation:=poPortrait; FOrientation:=poPortrait;
ShowSetupForm:=false; ShowSetupForm:=false;
FOptions:=[rxpoShowTitle, rxpoShowFooter, rxpoShowFooterColor]; FOptions:=[rxpoShowTitle,
rxpoShowFooter,
rxpoShowGridColor,
rxpoShowFooterColor,
rxpoShowReportTitle];
FShowColumnHeaderOnAllPage:=false;
end; end;
destructor TRxDBGridPrint.Destroy; destructor TRxDBGridPrint.Destroy;
begin begin
FreeAndNil(FRxColInfoList); FreeAndNil(FRxColInfoList);
FreeAndNil(FPageMargin);
inherited Destroy; inherited Destroy;
end; end;
@@ -370,3 +538,8 @@ end;
end. end.
{ DONE -oalexs : Необходимо настраивать отступы в печатной форме}
{ DONE -oalexs : Необходимо настроить отображение раскраски ячеек }
{ DONE -oalexs : Необходимо правильно выгружать лукапные значение KeyList/PickList }
{ TODO -oalexs : Необходимо реализовать настройку шрифтов }

View File

@@ -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

View File

@@ -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.

View File

@@ -172,14 +172,33 @@ resourcestring
sUnknownXMLDatasetFormat = 'Unknown XML Dataset format'; sUnknownXMLDatasetFormat = 'Unknown XML Dataset format';
sToolsExportSpeadSheet = 'Export to speadsheet'; sToolsExportSpeadSheet = 'Export to speadsheet';
sExportFileName = 'Export file name'; sExportFileName = 'Export file name';
sOpenAfterExport = 'Open after export'; sOpenAfterExport = 'Open after export';
sPageName = 'Page name'; sPageName = 'Page name';
sExportColumnHeader = 'Export column header'; sExportColumnHeader = 'Export column header';
sExportColumnFooter = 'Export column footer'; sExportColumnFooter = 'Export column footer';
sExportCellColors = 'Export cell colors'; sExportCellColors = 'Export cell colors';
sOverwriteExisting = 'Overwrite existing'; 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 const