mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-13 05:49:15 +02:00
LazReport, added CSV export from Petr Smolik, issue #9636
git-svn-id: trunk@11971 -
This commit is contained in:
parent
1c6719c78e
commit
a23138e402
1
.gitattributes
vendored
1
.gitattributes
vendored
@ -404,6 +404,7 @@ components/lazreport/source/lr_dset.pas svneol=native#text/pascal
|
||||
components/lazreport/source/lr_dsopt.lfm svneol=native#text/plain
|
||||
components/lazreport/source/lr_dsopt.lrs svneol=native#text/plain
|
||||
components/lazreport/source/lr_dsopt.pas svneol=native#text/pascal
|
||||
components/lazreport/source/lr_e_csv.pas svneol=native#text/pascal
|
||||
components/lazreport/source/lr_e_htm.pas svneol=native#text/pascal
|
||||
components/lazreport/source/lr_e_txt.pas svneol=native#text/pascal
|
||||
components/lazreport/source/lr_edit.lfm svneol=native#text/plain
|
||||
|
@ -1,11 +1,11 @@
|
||||
The following people contributed to LazReport :
|
||||
|
||||
Jesus Reyes (mx)
|
||||
Aleksey Lagunov (ru)
|
||||
Mattias Gaertner (de)
|
||||
Olivier Guilbaud (fr)
|
||||
Vincent Snijders (nl)
|
||||
Christian Ulrich (de)
|
||||
|
||||
|
||||
Aleksey Lagunov (ru)
|
||||
Christian Ulrich (de)
|
||||
Jesus Reyes A. (mx)
|
||||
Joerg Braun (de)
|
||||
Mattias Gaertner (de)
|
||||
Olivier Guilbaud (fr)
|
||||
Petr Smolik (cz)
|
||||
Vincent Snijders (nl)
|
||||
|
||||
|
82
components/lazreport/source/lr_e_csv.pas
Normal file
82
components/lazreport/source/lr_e_csv.pas
Normal file
@ -0,0 +1,82 @@
|
||||
|
||||
{*****************************************}
|
||||
{ }
|
||||
{ FastReport v2.3 }
|
||||
{ CSV export filter }
|
||||
{ }
|
||||
{ Copyright (c) 1998-99 by Tzyganenko A. }
|
||||
{ }
|
||||
{*****************************************}
|
||||
|
||||
unit LR_E_CSV;
|
||||
|
||||
interface
|
||||
|
||||
{$I lr_vers.inc}
|
||||
|
||||
uses
|
||||
Classes, SysUtils, LResources,
|
||||
Graphics,GraphType, Controls, Forms, Dialogs,
|
||||
StdCtrls,LR_E_TXT,
|
||||
|
||||
LCLType,LCLIntf,LR_Class;
|
||||
|
||||
type
|
||||
|
||||
TfrCSVExport = class(TComponent)
|
||||
public
|
||||
Constructor Create(aOwner : TComponent); override;
|
||||
end;
|
||||
|
||||
TfrCSVExportFilter = class(TfrTextExportFilter)
|
||||
public
|
||||
procedure OnEndPage; override;
|
||||
end;
|
||||
|
||||
|
||||
implementation
|
||||
|
||||
uses LR_Const;
|
||||
|
||||
|
||||
procedure TfrCSVExportFilter.OnEndPage;
|
||||
var
|
||||
i, j, n, tc1, tc2: Integer;
|
||||
p: PfrTextRec;
|
||||
s: String;
|
||||
begin
|
||||
n := Lines.Count - 1;
|
||||
while n >= 0 do
|
||||
begin
|
||||
if Lines[n] <> nil then break;
|
||||
Dec(n);
|
||||
end;
|
||||
|
||||
for i := 0 to n do
|
||||
begin
|
||||
s := '';
|
||||
tc1 := 0;
|
||||
p := PfrTextRec(Lines[i]);
|
||||
while p <> nil do
|
||||
begin
|
||||
tc2 := p^.X div 64;
|
||||
for j := 0 to tc2 - tc1 - 1 do
|
||||
s := s + ';';
|
||||
s := s + p^.Text;
|
||||
tc1 := tc2;
|
||||
p := p^.Next;
|
||||
end;
|
||||
s := s + #13#10;
|
||||
Stream.Write(s[1], Length(s));
|
||||
end;
|
||||
end;
|
||||
|
||||
constructor TfrCSVExport.Create(aOwner: TComponent);
|
||||
begin
|
||||
inherited Create(aOwner);
|
||||
|
||||
frRegisterExportFilter(TfrCSVExportFilter, sCSVFile + ' (*.csv)', '*.csv');
|
||||
end;
|
||||
|
||||
end.
|
||||
|
@ -161,3 +161,18 @@ LazarusResources.Add('tfruserdataset','BMP',[
|
||||
+'wtGwww'#135#255#247'ptDDDwwww'#136#136#136#128'wwwwwwww'#135#255#255'pwwwww'
|
||||
+'www'#136#255#255#128'wwwwwwwwx'#136#136#135'wwwwwwwwwwwwwwwwwww'
|
||||
]);
|
||||
LazarusResources.Add('tfrcsvexport','BMP',[
|
||||
'BM'#150#1#0#0#0#0#0#0'v'#0#0#0'('#0#0#0#24#0#0#0#24#0#0#0#1#0#4#0#0#0#0#0' '
|
||||
+#1#0#0#0#0#0#0#0#0#0#0#16#0#0#0#0#0#0#0#0#0#0#0#0#0#128#0#0#128#0#0#0#128#128
|
||||
+#0#128#0#0#0#128#0#128#0#128#128#0#0#192#192#192#0#128#128#128#0#0#0#255#0#0
|
||||
+#255#0#0#0#255#255#0#255#0#0#0#255#0#255#0#255#255#0#0#255#255#255#0'wwwwwww'
|
||||
+'ww'#0#0#7'wwwp'#0#0#0#0#0'ff'#7'wwwp'#136#136#136#136#6#238#240'wwwww'#14'f'
|
||||
+'f`n'#239#7'wwwwwp'#230'f'#6#238#240'`wwwwww'#14'`n'#239#0#0'wwwwwwp'#6#238
|
||||
+#240'wwwwwwwwpn'#239#0'wwww'#0#0#0#0#6#238#240'h'#7'ww'#255#255#255#240'n'
|
||||
+#239#14'f'#128'ww'#255#255#255#6#238#240'p'#230'h'#7'w'#255#255#240#255#255
|
||||
+#7'w'#14#238#224'wDO'#128#0#0#7'wp'#0#0'w'#255#255#255#255#255#7'wwwww'
|
||||
+#136#136#136#136#143#7'wwwww'#255#255#255#255#255#7'wwwGw'#136#136#136#136
|
||||
+#143#7'wwtDw'#255#255#255#255#255#7'wwDDGDDDDO'#7'wwwGw'#255#255#255#255
|
||||
+#255#7'wwtGw'#255#244'DDO'#4'DDDww'#255#255#255#255#255#7'wwwww'#255#255
|
||||
+#255#255#255'wwwwwwwwwwwwwwwwww'
|
||||
]);
|
||||
|
@ -17,6 +17,7 @@ uses
|
||||
|
||||
LR_E_TXT,
|
||||
LR_E_HTM,
|
||||
LR_E_CSV,
|
||||
|
||||
LR_PGrid,
|
||||
|
||||
@ -45,7 +46,7 @@ begin
|
||||
RegisterComponents('LazReport', [TfrReport,TfrDBDataSet,
|
||||
TfrBarCodeObject,TfrRoundRectObject,TfrShapeObject,
|
||||
TfrCheckBoxObject,TfrCompositeReport,TfrUserDataset,
|
||||
TfrTextExport,TfrHTMExport,
|
||||
TfrTextExport,TfrHTMExport,TfrCSVExport,
|
||||
TfrPrintGrid]);
|
||||
RegisterComponentEditor(TfrReport, TfrRepEditor);
|
||||
end;
|
||||
|
Loading…
Reference in New Issue
Block a user