خطأ في كود طباعة تقرير QuickReport انطلاقا من DBGrid
#1
لقد وجد هذا الكود في احدى المنتديات عن طباعة محتويات DBGrid الى QuickReport
ولكن عندما قمت بتجربته ضهر لي هذا الخطأ ولم اجد له حل
كود :
procedure TGridReport.Preview(Grid: TDBGrid); var i, CurrentLeft, CurrentTop : integer; BMark: TBookmark; begin GridRep.Dataset:=Grid.DataSource.DataSet; if not GridRep.Bands.HasColumnHeader then GridRep.Bands.HasColumnHeader:=true; if not GridRep.Bands.HasDetail then GridRep.Bands.HasDetail:=true; GridRep.Bands.ColumnHeaderBand.Height:=Abs(Grid.TitleFont.Height) + 10; GridRep.Bands.DetailBand.Height:=Abs(Grid.Font.Height) + 10; CurrentLeft := 12; CurrentTop := 6; {Record where the user stopped in the DBGrid} BMark:=Grid.DataSource.DataSet.GetBookmark; {Don't let the grid flicker while the report is running} Grid.DataSource.DataSet.DisableControls; try for i:=0 to Grid.FieldCount - 1 do begin if (CurrentLeft + Canvas.TextWidth(Grid.Columns[i].Title.Caption)) (GridRep.Bands.ColumnHeaderBand.Width) then begin CurrentLeft := 12; CurrentTop := CurrentTop + Canvas.TextHeight('A') + 6; GridRep.Bands.ColumnHeaderBand.Height := GridRep.Bands.ColumnHeaderBand.Height + (Canvas.TextHeight('A') + 10); GridRep.Bands.DetailBand.Height := GridRep.Bands.DetailBand.Height + (Canvas.TextHeight('A') + 10); end; {Create Header with QRLabels} with TQRLabel.Create(GridRep.Bands.ColumnHeaderBand) do begin Parent := GridRep.Bands.ColumnHeaderBand; Color := GridRep.Bands.ColumnHeaderBand.Color; Left := CurrentLeft; Top := CurrentTop; Caption:=Grid.Columns[i].Title.Caption; end; {Create Detail with QRDBText} with TQRDbText.Create(GridRep.Bands.DetailBand) do begin Parent := GridRep.Bands.DetailBand; Color := GridRep.Bands.DetailBand.Color; Left := CurrentLeft; Top := CurrentTop; Alignment:=Grid.Columns[i].Alignment; AutoSize:=false; AutoStretch:=true; Width:=Grid.Columns[i].Width; Dataset:=GridRep.Dataset; DataField:=Grid.Fields[i].FieldName; CurrentLeft:=CurrentLeft + (Grid.Columns[i].Width) + 15; end; end; lblPage.Left := bdTitle.Width - lblPage.Width - 10; lblDate.Left := bdTitle.Width - lblDate.Width - 10; {After all, call the QuickRep preview method} GridRep.PreviewModal; {or Preview if you prefer} finally with Grid.DataSource.DataSet do begin GotoBookmark(BMark); FreeBookmark(BMark); EnableControls; end; end; end;
رابط الكود :
كود :
http://delphi.cjcsoft.net/viewthread.php?tid=44018
الرد
#2
[FONT="Arial Black"]السلام عليكم - بعد محاولات تم تصحيح الكود حيث كان الخطأ في السطر 71 كاتالي
وهو عدم وجود = ولقد تم تصحيحه
if (CurrentLeft + Canvas.TextWidth(Grid.Columns[i].Title.Caption))=(GridRep.Bands.ColumnHeaderBand.Width) then
ولكن ظهر خطأ اخر وهو
[Error] File not found: 'QUICKRPT.RES'
الملف QUICKRPT.RES غير موجود
وهذا المرفق بعد تعديل الكود


الملفات المرفقة
.rar   TGridReport.rar (الحجم : 11.87 ك ب / التحميلات : 71)
الرد
#3
السلام عليكم
اخي phplibya هل انت متاكد من تثبيتك ل Quick Report مع نسخة دالفي التي تعمل عليها ؟؟
و من طلب العلوم بغير كد _________ سيدركها إذا شاب الغراب
الرد
#4
السلام عليكم
الحمدالله تم حل المشكلة في خطأ كود طباعة تقرير QuickReport انطلاقا من DBGrid سواء بعد فلترة البيانات او قبلها
واضع بين يدكم المشروع كاملا ليستفيد منه باقي الاعضاء ( المشروع في المرفقات )


الملفات المرفقة
.rar   TGridReport.rar (الحجم : 3 ك ب / التحميلات : 87)
الرد
#5
يوجد خطأ في المشروع التقرير ملخبط
الرد


التنقل السريع :


يقوم بقرائة الموضوع: بالاضافة الى ( 1 ) ضيف كريم