Form1上有StringGrid1和Button1;如何完成点击Button1后预览StringGrid1的打印内容;
预览窗口调用FastReport设计器的那个预览窗口;
当StringGrid1内容多时实现能自动分页。请给出简单处理思路和简单示例代码。
QuickReport可以完成相同功能也可以。请各位帮帮小弟。
谢谢!
预览窗口调用FastReport设计器的那个预览窗口;
当StringGrid1内容多时实现能自动分页。请给出简单处理思路和简单示例代码。
QuickReport可以完成相同功能也可以。请各位帮帮小弟。
谢谢!
http://expert.csdn.net/Expert/topic/1105/1105886.xml?temp=.5982935
我一般也是这么做的
用office作为输出工具
他们方便
你也舒服采用OLE+VBA
可否给个FastReport的简单例子?
我用的是delphi 5.
直接打印StringGrid的控件是哪个呢?
也找不到PrnGrid这个例子。
1、OnBeforePrint
2、OnGetValue
3、OnPrintColumn我这里写了一些是我程序中用到的,你可以借鉴一下。
procedure TfrmTrack.frReport1BeforePrint(Memo: TStringList; View: TfrView);
begin
//这里设置打印的宽度以及打印的边框格式
View.dx := FWidth;
if View.Name='Memo1' then
begin
Case ColDataSet.RecNo of
0:FFrameTyp:=15;
1,2:FFrameTyp:=14;
3,4,5:FFrameTyp:=10;
6:FFrameTyp:=11;
end;
if ColDataSet.RecNo>5 then
begin
if (ColDataSet.RecNo) Mod 3 =0 then
FFrameTyp:=14;
if (ColDataSet.RecNo-1) Mod 3 =0 then
FFrameTyp:=10;
if (ColDataSet.RecNo-2) Mod 3 =0 then
FFrameTyp:=11;
end;
View.FrameTyp:=FFrameTyp;
end;
end;
procedure TfrmTrack.frReport1GetValue(const ParName: String;
var ParValue: Variant);
begin
//下面是从StringGrid取值
if AnsiCompareText(ParName, 'isClip') = 0 then
if sUpDown='1' then
ParValue := 'FCLIP'
else
ParValue := 'FCVP'; if AnsiCompareText(ParName, 'Cell') = 0 then
begin
frReport1.Dictionary.Variables['MyRow']:=RowDataset.RecNo;
frReport1.Dictionary.Variables['MyCol']:=ColDataset.RecNo;
if sUpDown='1' then
begin
ParValue := sgrdFClip.Cells[ColDataset.RecNo, RowDataset.RecNo];
end
else
begin
ParValue := sgrdMain.Cells[ColDataset.RecNo, RowDataset.RecNo];
end;
end;
end;procedure TfrmTrack.frReport1PrintColumn(ColNo: Integer; var Width: Integer);
begin
//这里控制打印宽度
if sUpDown='1' then
width:=sgrdFclip.ColWidths[colNo-1]
else
width:=sgrdMain.ColWidths[colNo-1];
fWidth:=width;
Inherited;
end;