|
@@ -149,6 +149,8 @@ type
|
|
|
procedure PrintAllSelectedReports;
|
|
|
procedure ExportAllSelectedPDFReports;
|
|
|
|
|
|
+ procedure ExportReportPage(APage: Integer; const APageFileName: string; AOrg: Boolean);
|
|
|
+
|
|
|
procedure SetProjectData(const Value: TProjectData);
|
|
|
procedure SetCurPage(const Value: Integer);
|
|
|
function GetPrintEndPage: Integer;
|
|
@@ -486,7 +488,9 @@ begin
|
|
|
PreviewComXML.Print(PreviewBox.Canvas, CurPage, 1)
|
|
|
else
|
|
|
TipMessage(GetHintStr, Handle);
|
|
|
- //PreviewBox.Picture.SaveToFile('E:\1.jpg');
|
|
|
+ //PreviewBox.Picture.SaveToFile('E:\Org.bmp');
|
|
|
+ //ExportReportPage(1, 'E:\Org.jpg', True);
|
|
|
+ //ExportReportPage(1, 'E:\Cut.jpg', False);
|
|
|
end;
|
|
|
|
|
|
procedure TReportsForm.xcbStartPageChange(Sender: TObject);
|
|
@@ -1714,4 +1718,39 @@ begin
|
|
|
extvReport.FullCollapse;
|
|
|
end;
|
|
|
|
|
|
+procedure TReportsForm.ExportReportPage(APage: Integer;
|
|
|
+ const APageFileName: string; AOrg: Boolean);
|
|
|
+var
|
|
|
+ bmp, bmpCut: TBitmap;
|
|
|
+ img: TJPEGImage;
|
|
|
+ iCutHeight, iCutWidth, iCutTop, iCutLeft, iCutRight, iCutBottom: Integer;
|
|
|
+begin
|
|
|
+ bmp := TBitmap.Create;
|
|
|
+ bmpCut := TBitmap.Create;
|
|
|
+ img := TJPEGImage.Create;
|
|
|
+ try
|
|
|
+ bmp.Height := PreviewComXML.ReportSize.Y;
|
|
|
+ bmp.Width := PreviewComXML.ReportSize.X;
|
|
|
+ PreviewComXML.PrintPreviewCanvas(APage, 0, bmp.Canvas, False);
|
|
|
+
|
|
|
+ iCutHeight := Round(PreviewComXML.ReportSize.Y / 200);
|
|
|
+ iCutWidth := Round(PreviewComXML.ReportSize.X / 200);
|
|
|
+ bmpCut.Height := PreviewComXML.ReportSize.Y - iCutHeight * 2;
|
|
|
+ bmpCut.Width := PreviewComXML.ReportSize.X - iCutWidth * 2;
|
|
|
+ bmpCut.Canvas.CopyRect(Rect(0, 0, bmpCut.Width, bmpCut.Height), bmp.Canvas, Rect(iCutWidth, iCutHeight, bmp.Width - iCutWidth, bmp.Height - iCutHeight));
|
|
|
+
|
|
|
+ if not AOrg then
|
|
|
+ img.Assign(bmpCut)
|
|
|
+ else
|
|
|
+ img.Assign(bmp);
|
|
|
+ img.CompressionQuality := 100;
|
|
|
+ img.Compress;
|
|
|
+ img.SaveToFile(APageFileName);
|
|
|
+ finally
|
|
|
+ bmpCut.Free;
|
|
|
+ bmp.Free;
|
|
|
+ img.Free;
|
|
|
+ end;
|
|
|
+end;
|
|
|
+
|
|
|
end.
|