print a selected part of a memo by QuickReport
Posted: Sun Jun 15, 2008 12:01 pm
Hello,
I want to print a selected part of a memo by QuickReport (look at "DuenneTabLinien(an/aus)").
All runs fine until I have put a table into the memo. Now the whole memo is shown in the quickReport.preview.
What's to do ?
I want to print a selected part of a memo by QuickReport (look at "DuenneTabLinien(an/aus)").
All runs fine until I have put a table into the memo. Now the whole memo is shown in the quickReport.preview.
What's to do ?
Code: Select all
procedure TForm1.MemoDruckenClick(Sender: TObject);
var MemoText: TMemoryStream;
colorMode: integer;
begin
//colorMode aus INI-Datei
try
fQr:= TfQr.Create(Application);
with fQr do begin
[color=red][b]DuenneTabLinien('an'); [/b][/color] <--- this procedure is the reason
MemoText := TMemoryStream.Create;
if Memo.SelectionExists=true then Memo.SaveRVFToStream(MemoText, True)
else Memo.SaveRVFToStream(MemoText, False);
[color=red][b]DuenneTabLinien('aus'); [/b][/color] <-----
MemoText.Position := 0;
memo.Deselect;
memo.Format;
rpt.height:= 1175;
QRRichView1.width:= memo.width;
case ColorMode of
0 : QRRichView1.ColorMode := rvcmColor;
1 : QRRichView1.ColorMode := rvcmPrinterColor;
2 : QRRichView1.ColorMode := rvcmGrayScale;
3 : QRRichView1.ColorMode := rvcmBlackAndWhite;
4 : QRRichView1.ColorMode := rvcmBlackOnWhite;
end;
QRRichView1.LoadRVFStream(MemoText);
Rpt.preview;
end; // of fQr
finally
fQR.release;
MemoText.Free;
Screen.Cursor :=crDefault;
lockWindowUpdate(0);
end;
end; //of rpt_QuickReport
procedure TForm1.[color=red][b]DuenneTabLinien[/b][/color](const an_aus: string);
var anzTab,j,itemNo,data: integer;
begin
//exit; //zu Testzwecken übersprungen
try
if an_aus='an' then lockWindowUpdate(Form1.handle);
anzTab:=0;
for j := 0 to Memo.ItemCount-1 do
if Memo.GetItemStyle(j)=rvsTable then inc(anzTab);
if anzTab>0 then begin
for j := 1 to anzTab do begin
storedRveTabNo:=j;
setRveTabNo;
if (not memo.CanChange) then break;
try
ItemNo := rveTable.GetMyItemNo;
memo.BeginUndoGroup(rvutModifyItem);
memo.SetUndoGroupMode(True);
memo.BeginItemModify(ItemNo, Data);
if an_aus='an' then begin
rvetable.CellHSpacing:= -2; rvetable.CellVSpacing:= -2;
end else begin
rvetable.CellHSpacing:= -1; rvetable.CellVSpacing:= -1;
end;
finally
memo.EndItemModify(ItemNo, Data);
memo.SetUndoGroupMode(False);
memo.Change;
if query1.state in [dsEdit, dsInsert] then query1.post;
end;
end;
end;
finally
if an_aus='aus' then lockWindowUpdate(0);
end;
end;