我用quickreport,我想在dbgrid里随意选择记录打印,请高手指点一下我该怎么做,明天要到客户那里交货的,在线等待。
解决方案 »
- 软件开启就关闭
- udp中接收端怎么还原发送端的数据
- 有谁做过delphi与java交互的。遇到一个看似简单的问题....
- 新手调试程序这里有错误,高手帮我看一下啊
- 求助!
- 实验成功,放分啦-在两个不同代理服务器后面的局域网机器之间传递文件!
- 如果用UDP进行网络广播??
- Delphi6.0与Delphi5.0的兼容问题?
- SQL中的update如何解决多条记录更新的问题?在线等待,急急
- c/s结构程序,多人使用,如果A,B先查询数据库,C在A,B查询后更改了数据库,此时怎么样让A,B查询的结果能及时响应更新?
- TMEMO控件中的任一行得到焦点有没有什么事件发生?
- 怎么要怎么办才能响应用户点击了位于任务栏的程序窗体的事件?
var
Form1 : TForm1;
Col_Value , Top_Value , Row_Value : Integer;
GridWidth : Integer;
begin
Form1 := TForm1.Create(Application);
OnLine := True;
Top_Value := 17 ;
Top_Temp := 17;
//---------------------------------------------------------------------
if CheckBox2.Checked then
begin
GridWidth := GetGridWidth;
Top_Value := 17 ;
Row_Value := 17 ;
RowScaValue := Row_Sca;
if Not CheckBox1.Checked then
begin
OnLine := False;
Form1.CreateRowQRShape(Top_Value + 20 + Round(Row_Sca * 17), TextViewGrid.Left,
GridWidth, 1);
end;
For Col_Value := 0 to FColCount - 1 do
begin
Form1.CreateRQLabel(Top_Value + Round(Round(Row_Sca * 17)/2), SetUpHB.Sections[Col_Value].Left,
TextViewGrid.ColWidths[Col_Value], 17, Col_Value,SetUpHB.Sections[Col_Value].Text).Show;
end;
QRColHeight := Top_Value;
Inc(Row_Value);
if Not CheckBox1.Checked then
Form1.CreateColQRShape(Top_Value - 2 ,GridWidth,1,20 + Round(Row_Sca * 17));
Top_Value := Top_Value + ( 1 * 20) + Round(Row_Sca * 17);
Top_Temp := Top_Value;
end;
//---------------------------------------------------------------------
GridWidth := GetGridWidth;
Top_Value := Top_Temp ;
Row_Value := FRowMin ;
RowScaValue := Row_Sca;
While Top_Value <= 718 do
begin
if Not CheckBox1.Checked then
begin
OnLine := False;
Form1.CreateRowQRShape(Top_Value + 20 + Round(Row_Sca * 17), TextViewGrid.Left,
GridWidth, 1);
end;
For Col_Value := 0 to FColCount - 2 do
begin
Form1.CreateRQLabel(Top_Value + Round(Round(Row_Sca * 17)/2), SetUpHB.Sections[Col_Value].Left,
TextViewGrid.ColWidths[Col_Value], 17, Col_Value,TextViewGrid.Cells
[Col_Value,Row_Value]).Show;
end;
QRColHeight := Top_Value;
Inc(Row_Value);
if Not CheckBox1.Checked then
Form1.CreateColQRShape(Top_Value - 2 ,GridWidth,1,20 + Round(Row_Sca * 17));
if Row_Value >= FRowMax then
begin
Form1.QuickRep1.Preview;
Exit;
end;
Top_Value := Top_Value + ( 1 * 20) + Round(Row_Sca * 17);
end;
Form1.QuickRep1.Preview;
end;
// (支持多记录打印)我用的是DBGridEh控件
procedure TMainForm.PrintFeiMYReport;
var
i : integer;
BookMarkList : TBookMarkListEh;
BookMark : TBookMark;
strSQL, str : string;
begin
with FQueryForm do
begin
BookMark := DSShow.DataSet.GetBookMark;
strSQL := 'select * from FeiMYFKSBB where LiuSH in ('; //FeiMYFLSBB是表名
BookMarkList := dbgFeiMY.SelectedRows; // dbgFeiMY是TDBGridEh类型
with DSShow.DataSet do
for i := 0 to BookMarkList.Count - 1 do
begin
GotoBookMark(pointer(BookMarkList[i]));
if i <> BookMarkList.Count - 1 then
str := str + '''' + fieldbyname('LiuSH').asstring + '''' + ','
else
str := str + '''' + fieldbyname('LiuSH').asstring + '''';
end;
DSShow.DataSet.GotoBook(BookMark);
DSShow.DataSet.FreeBooK(BookMark);
strSQL := strSQL + str + ') ';
end;
if not assigned(FReportForm) then // FReportForm是报表窗体
FReportForm:= TFReportForm.Create(application);
with FReportForm.qryFeiMY do
begin
Connection:= Conn.AdoConn;
Close; SQL.Clear;
SQL.Add(strSQL); Open;
end;
FReportForm.qrFeiMYD.Preview;
end;