有个报表,要横向罗列查询几十个字段,页面因此根本就排不下
例如就像下面的格式:
员工编号 员工姓名 生产产品 产生废品1 产生废品2 产生废品70
。
因此,要有选择性地从这70个废品中选择几个关键的,否则横向排不下,也没有必要把所有的废品都打出来。不知道怎么处理了?
例如就像下面的格式:
员工编号 员工姓名 生产产品 产生废品1 产生废品2 产生废品70
。
因此,要有选择性地从这70个废品中选择几个关键的,否则横向排不下,也没有必要把所有的废品都打出来。不知道怎么处理了?
解决方案 »
- 通讯后,如何获取PSafeArray的值?
- 如何从3个相关表格中分别查询数据并放入到一个DBGrid中显示?
- 如何画矢量线?并且这个或者这些矢量线是可以编辑的。
- 如何把以个日期时间插入数据库中啊?
- 关于DBExpress 不知道是不是DELPHI的问题,真心求教
- 关于状态栏的问题?
- 有上海工作的么,说说delphi在上海的前景?
- 请问mainmenu控件中的菜单项右边的那个热键(不是快捷键)是如何修改的?
- 我现在作vod,但是有几个数据库问题不能解决,请大虾帮忙
- 如何监视用户在windows中删除过那些文件
- idhttp多线程访问问题,请各位高人帮忙看看
- 做数据库工程中,会遇到很多窗体的问题,现在不用贴控件的方式,全用继承,好不好?
老大,帮帮忙吧,我想不出办法来了
我用BCB
你这不是捉弄人么?你说你做出来了,到这里说了一下,然后就是不告诉我。唉
打印函数如下(delphi的,其实在此之前还有一个界面用收集用户的打印参数,传进去一个记录集,一个Fields数组,在这个数组里面设置是不是显示各字段,你可以看一下):procedure PreviewB(FDataSet:TDataSet; Fields:Array of TRptField; SettingInfo:TPrintSetInfo);
var Report:TPrintDBGridReport; i:integer;
begin
if FDataSet.IsEmpty then exit;
Report:=TPrintDBGridReport.Create(Application.MainForm);
with Report do
begin
Tag:=0;
AutoFitPrint(SettingInfo);
InitPrintInfoB(FDataSet, Fields, SettingInfo);
Preview;
free;
end;
end;procedure TPrintDBGridReport.AutoFitPrint(SettingInfo:TPrintSetInfo);
var i:integer;
begin
self.ReportTitle:=SettingInfo.Title;
self.PrinterSettings.PrinterIndex:=SettingInfo.PrinterIndex;
self.Page.TopMargin:=SettingInfo.TopMargin;
self.Page.BottomMargin:=SettingInfo.BottomMargin;
self.Page.LeftMargin:=SettingInfo.LeftMargin;
self.Page.RightMargin:=SettingInfo.RightMargin;
self.Page.PaperSize:=TQRPaperSize(SettingInfo.PaperSizeIndex);
self.Page.Orientation:=SettingInfo.Orientation;
self.Zoom:=SettingInfo.Zoom;
end;procedure TPrintDBGridReport.InitPrintInfoB(FDataSet: TDataSet;
Fields: array of TRptField; SettingInfo:TPrintSetInfo);
var ColText:TQRLabel;DBText:TQRDBText;Shape:TQRShape;
i:integer; FLeft:integer; FirstLine:boolean;
begin
FLeft:=0;
self.DataSet:=FDataSet;
PageHeaderBand1.Height:=SettingInfo.TitleHeight;
self.ColumnHeaderBand1.Height:=SettingInfo.HeaderHeight;
self.DetailBand1.Height:=SettingInfo.BodyHeight;
FirstLine:=True;
for i:=0 to high(Fields) do
begin
if not Fields[i].Visible then continue;
ColText:=TQRLabel.Create(self);
ColText.Parent:=self.ColumnHeaderBand1;
ColText.Left:=FLeft+4;
ColText.Top:=4;
ColText.AutoSize:=false;
if Fields[i].Width>6 then ColText.Width:=Fields[i].Width-6 else ColText.Width:=Fields[i].Width;
ColText.Caption:=Fields[i].DispName;
ColText.Alignment:=taCenter;
ColText.Font:=SettingInfo.HeaderFont; if SettingInfo.BodyLineShow then
begin
Shape:=TQRShape.Create(self);
Shape.Parent:=self.ColumnHeaderBand1;
Shape.Left:=FLeft;
Shape.Shape:=qrsVertLine;
Shape.Pen.Color:=SettingInfo.HeaderLineColor;
if FirstLine then Shape.Pen.Width:=SettingInfo.HeaderLineWidth else Shape.Pen.Width:=1;
Shape.Width:=Shape.Pen.Width;
Shape.Top:=0;
Shape.Height:=self.ColumnHeaderBand1.Height;
end; DBText:=TQRDBText.Create(self);
DBText.Parent:=self.DetailBand1;
DBText.Left:=FLeft+4;
if FirstLine then DBText.Left:=DBText.Left+SettingInfo.HeaderLineWidth-1;
DBText.Top:=2;
DBText.AutoSize:=false;
if Fields[i].Width>6 then DBText.Width:=Fields[i].Width-6 else DBText.Width:=Fields[i].Width;
DBText.DataSet:=DataSet;
DBText.DataField:=Fields[i].DispName;
DBText.Font:=SettingInfo.BodyFont;
case Fields[i].Alignment of
1: DBText.Alignment:=taRightJustify;
2: DBText.Alignment:=taCenter;
else DBText.Alignment:=taLeftJustify;
end; if SettingInfo.BodyLineShow then
begin
Shape:=TQRShape.Create(self);
Shape.Parent:=self.DetailBand1;
Shape.Left:=FLeft;
Shape.Shape:=qrsVertLine;
Shape.Pen.Color:=SettingInfo.BodyLineColor;
if FirstLine then Shape.Pen.Width:=SettingInfo.HeaderLineWidth else Shape.Pen.Width:=SettingInfo.BodyLineWidth;
Shape.Width:=Shape.Pen.Width;
Shape.Top:=0;
Shape.Height:=self.DetailBand1.Height;
end; FLeft:=FLeft+Fields[i].Width;
FirstLine:=false;
end;
//标题
lbl_Title.Caption:=SettingInfo.Title;
lbl_Title.Font:=SettingInfo.TitleFont;
i:=(FLeft-lbl_Title.Width) div 2;
if i<self.ColumnHeaderBand1.Left then i:=self.ColumnHeaderBand1.Left;
lbl_Title.Left:=i; if SettingInfo.BodyLineShow then
begin
Shape:=TQRShape.Create(self);
Shape.Parent:=self.ColumnHeaderBand1;
Shape.Left:=FLeft;
Shape.Shape:=qrsVertLine;
Shape.Pen.Color:=SettingInfo.HeaderLineColor;
Shape.Pen.Width:=SettingInfo.HeaderLineWidth;
Shape.Width:=Shape.Pen.Width;
Shape.Top:=0;
Shape.Height:=self.ColumnHeaderBand1.Height; Shape:=TQRShape.Create(self);
Shape.Parent:=self.DetailBand1;
Shape.Left:=FLeft;
Shape.Shape:=qrsVertLine;
Shape.Pen.Color:=SettingInfo.BodyLineColor;
Shape.Pen.Width:=SettingInfo.HeaderLineWidth;
Shape.Width:=Shape.Pen.Width;
Shape.Top:=0;
Shape.Height:=self.DetailBand1.Height; Shape:=TQRShape.Create(self);
Shape.Parent:=self.DetailBand1;
Shape.Shape:=qrsHorLine;
Shape.Left:=SettingInfo.BodyLineWidth;
Shape.Top:=DetailBand1.Height-2;
Shape.Width:=FLeft-SettingInfo.BodyLineWidth;
Shape.Pen.Width:=SettingInfo.BodyLineWidth;
Shape.Pen.Color:=SettingInfo.BodyLineColor;
Shape.Height:=Shape.Pen.Width;
end; if SettingInfo.HeaderLineShow then
begin
Shape:=TQRShape.Create(self);
Shape.Parent:=self.ColumnHeaderBand1;
Shape.Shape:=qrsHorLine;
Shape.Left:=SettingInfo.HeaderLineWidth;
Shape.Top:=-1;
Shape.Width:=FLeft-SettingInfo.HeaderLineWidth;
Shape.Pen.Width:=SettingInfo.HeaderLineWidth;
Shape.Pen.Color:=SettingInfo.HeaderLineColor;
Shape.Height:=Shape.Pen.Width; Shape:=TQRShape.Create(self);
Shape.Parent:=self.ColumnHeaderBand1;
Shape.Shape:=qrsHorLine;
Shape.Left:=SettingInfo.HeaderLineWidth;
Shape.Top:=ColumnHeaderBand1.Height-3;
Shape.Width:=FLeft-SettingInfo.HeaderLineWidth;
Shape.Pen.Width:=SettingInfo.HeaderLineWidth;
Shape.Pen.Color:=SettingInfo.HeaderLineColor;
Shape.Height:=Shape.Pen.Width; Shape:=TQRShape.Create(self);
Shape.Parent:=self.QRBand1;
Shape.Shape:=qrsHorLine;
Shape.Left:=SettingInfo.HeaderLineWidth;
Shape.Top:=-2;
Shape.Width:=FLeft-SettingInfo.HeaderLineWidth;
Shape.Pen.Width:=SettingInfo.HeaderLineWidth;
Shape.Pen.Color:=SettingInfo.HeaderLineColor;
Shape.Height:=Shape.Pen.Width;
end;
end;