Report Processing Components by Delphi

zhaozj2021-02-11  197

I am tilted, time use Delphi to develop a set of report processing components, suitable for various software systems complex report processing functions, especially those which provide report editing, print preview, and data import interfaces can quickly meet the relevant reports proposed by customers. Various needs of processing. 1. Design principles: 1.1 Manage the complexity of the report processing object by abstract to specific class hierarchy. 1.2 Report Editing, the original data is imported to the print preview integration process. 1.3 Flexible data access interface, program code is independent of report design. 2. Main features: 2.1 EXCEL design interface, provide multiple editable objects, including different attribute cells such as normal text, formula computing, data import, and graphics, images, charts, text boxes, data views, custom tables Other objects. 2.2 Customers can freely design custom reports, such as ordinary, color printing, chart integrals. 2.3 Beautiful report previews, multiple printout formats. 3. Applications: 3.1 Power Grid Monitoring System Report Processing Subsystem (Various Operation Daily, Monolf News, Annual Reports, etc.). 3.2 Hospital management information system (various statistical analysis reports). 3.3 Hotel Management Information System (Various Query Statistics). 3.4 Inspection Management System (Various Format Reports). 4. Affirming: I have all my own copyright to the component.

5. Class Tree: {Forward declarations} TGridCoordinate = class; TGridCoordinates = class; TCustomObject = class; {Abstract Class} {1} TActiveObject = class; TActiveObjectClass = class of TActiveObject; TGridCellObject = class; TGridCellGroup = class; // TDataViewParams = class TDataView = class; TDataTable = class; TTileDataView = class; TCascadeBand = class; TCascadeBands = class; TCascadeDataView = class; TPlate = class; TPlateClass = class of TPlate; TChartPlate = class; TImagePlate = class; TTextPlate = class; TActiveObjects = class ; TSelectedObjects = class; {2} TSparsePointerArray = class; TSparseList = class; TGridCellText = class; TGridCellFrame = class; TGridCell = class; TGridCellClass = class of TGridCell; TTextCell = class; TDBCell = class; TFormulaCell = class; TRowCells = class; TGRIDCELLS = Class; TGRIDCOORDIT = Class; TselectedCoord = Class; TSELECTEDCOORDS = Class; TtitleWindow = Class; TCOLUMNWINDOW = Class; TROWWINDOW = Class; TROWWINDOW = Class TclientWindow = Class; Ttool = Class; {Tspreadsheettool = class;} tcoolscrollbar = class; tcoolscrollControl = Class; TreportGrid = Class; I also hope that all of my colleagues will advise. Email: lmis@sina.com.

6. Attach:

A procedure that can be written any text, including rotating fonts.

TTextAlign = (taLeft, taRight, taHorzCenter, taTop, taBottom, taVertCenter); TTextAligns = set of TTextAlign; TTextControl = (tcNormal, tcWordBreak, tcSelfAdapt, tcCalcRect); TTextDirection = tdVertChinese..90; {Angles of text} procedure WriteText (ACanvas : TCanvas; var aRect: TRect; aText: string; Aligns: TTextAligns; Control: TTextControl; Direction: TTextDirection {; BeErase: Boolean = TRUE}); var S: String; tempStr: WideString; ColorRef: TColorRef; DitheredFlag: Boolean; LogicFont: TLogFont; Scaler: Extended; I, J, X, Y: Integer; Interval, maxExtent: Integer; TextMetric: TTextMetric; TempExtent: TSize; TempRect: TRect; procedure SetLogicFont (W: Integer = 0; H: Integer = 0 ); begin with LogicFont, ACanvas.Font do begin if H = 0 then lfHeight: = Height else lfHeight: = H; lfWidth: = W; lfEscapement: = 10 * Direction; lfOrientation: = 10 * Direction; lfWeight: = FW_NORMAL; // fw_bold; lfita lic: = BYTE (fsItalic in Style); lfUnderline: = BYTE (fsUnderline in Style); lfStrikeOut: = BYTE (fsStrikeOut in Style); lfCharSet: = Charset; lfOutPrecision: = OUT_TT_PRECIS; lfClipPrecision: = CLIP_DEFAULT_PRECIS; lfQuality: = DEFAULT_QUALITY; lfPitchAndFamily: = DEFAULT_PITCH or FF_DONTCARE; StrCopy (lfFaceName, PChar (Name)); end; ACanvas.Font.Handle: = Windows.CreateFontIndirect (LogicFont); end; procedure DrawDitheredText (BeginX, BeginY: Integer; theText: String); begin Drawbitmap.canvas.lock;

{Must Have it !!} Try with drawbitmap do begin //Windows.extTextOut (Handle ,0 ,0 andto_opaque ,@temprect, nil, 0, nil); Windows.extTextout (canvas.handle, Beginx - all, BeginY - ARect.Top, {ETO_OPAQUE or} ETO_CLIPPED, @TempRect, PChar (theText), Length (theText), Nil); ACanvas.CopyRect (aRect, Canvas, TempRect); end; finally DrawBitmap.Canvas.Unlock; end; End; begin {if beerase dam.style: = pscle; acanvas.rectangle: = pssaS.pen.style: = pssolid; Else Acanvas.FillRect ); //Windows.extTextOutout (Acantvas.Handle ,0 ,0 and EETO_OPAQUE ,@arect, nil, 0, nil);} if attext = '' Then EXIT; colorRef: = ColorTorgb (acanvas.brush.color); DithereEDflag : = // (ACanvas = Printer.Canvas) or (Windows.GetNearestColor (ACanvas.Handle, ColorRef) <> ColorRef); if DitheredFlag then begin with DrawBitmap, aRect do {Use offscreen bitmap to eliminate flicker and } Begin {brush origin tics in painting / scrolling.} Width: = max (width, right - left); Height: = max (Height, Bottom - TOP); canvas.font: = acanvas.font; canvas.brush: = Acanvas.brush; canvas.brush.style: = bssolid; TempRect: = Rect (0, 0, Right - Left, Bottom - TOP); Windows.Handle, 0, 0, {ETO_OPAQUE OR} Eto_Clipped, @ TempRect, Nil, 0, Nil) end; end; {Prepare parameters for below process} case Direction of tdVertChinese: begin {More special, use the equivalent width font} ACanvas.Font.Pitch: = fpFixed; Scaler: = 1; maxExtent : =

All; 0: {Horizontal} begin scaler: = 1; maxextent: = all; maxextent: = all; = all; / 180); MaxExtent: = floor (all; 46..90: begin setLogicFont; scaler: = sin (Direction * Pi / 180); maxextent: = floor All; -90 ..- 46: begin setLogicFont; scaler: = sin (-direction * pi / 180); maxextent: = floor ((all a) ) / Scaler); end; -45 ..- 1: begin setLogicFont; scaler: = COS (-direction * pi / 180); maxextent: = floor (all; "; End; {Get Control text} case control of tcwordbreak: begin J: = 0; x: = 0; Tempstr: = WideString (atext); for i: = 1 to length (WideString (atext)) Do Begin s: = WideString (Atext) [i]; if (s = # 13) or (s = # 10) THEN J: = 0 else begin Windows.GetTextExtentPoint32 (ACanvas.Handle, PChar (S), Length (S), TempExtent); // TempExtent: = ACanvas.TextExtent (S); if Direction = tdVertChinese then begin Inc (J, TempExtent .Cy); if j> maxextent the begin J: = Tempextent.cy; INSERT (# 13 # 10, tempstr, i x); {Soft return} inc (x, 2); end; end; else begin inc (J , Tempextent.cx; if j> maxextent the beginning, = tempextent.cx; INSERT (# 13 # 10, tempstr, i x);

{Soft Return} INC (x, 2); end; end; end; end; texts.text: = tempstr; end; tcselfadapt: ​​begin texts.text: = atext; if Direction = TdvertChinese Then Begin // J: = 0 ; // x: = length (WideString (Texts [0])); // Tempstr: = WideString (Texts [0]); Tempstr: = '; for i: = 0 to Texts.count - 1 Do Begin IF Length (Tempstr) 0 THEN BEGIN J: = Floor (MAXEXTENT / Length (Tempstr)); for i: = acanvas.font.size-1 Downto 5 Do Begin Windows.Handle, TextMetric; if TextMetric.tmHeight j tell // versus End; Else Begin J: = 0; s: = ' '; For i: = 0 to Texts.count - 1 Do Begin Windows.GettextExtentPoint32 (Acanvas.Handle, Pchar (Texts [i]), Length (Texts [i]), Tempextent; if j

Acanvas.font.size-1 Downto 5 Do Begin Windows.gettextextentPoint32 (Acanvas.Handle, Pchar (S), Length (s), TempeXtent); if Tempextent.cx maxExtent then for I: = -ACanvas.Font.Height downto 1 do begin Windows.GetTextExtentPoint32 (ACanvas .Handle, Pchar (s); if Tempextent.cx

Tempextent.cx THEN J: = Tempextent.cx; end; all; 46..90, -90; for I: = 0 to Texts.count - 1 Do Begin Windows.gettextextentPoint32 (Acanvas.Handle, Pchar (Texts [i]), Length (Texts [i]), Tempextent; if j

TEXTMETRIC.TMEXTERNALLEDING}) / scaler; j: = interval * texts.count; x: = all left 2; if Tabottom in aligns the: = all tavertCenter in aligns the = ( Arect.bottom all Tatop - J) SHR 1 Else {if Tatop in Aligns Then} Y: = all; 46..90: Begin Windows.getTextMetrics (Acanvas.Handle, TextMetric); Interval: = Ceil ((TextMetric.tmHeight { TextMetric.tmExternalLeading}) / Scaler); J: = Interval * Texts.Count; if taRight in Aligns then X: = ARect.Right - J else if taHorzCenter in Aligns then X: = ( All - j) Shr 1 else {if Taleft in aligns} x: = all left 2; y: = all ;-90 ..- 46: Begin Windows.getTextMetrics (Interval: = CEIL ((TextMetric.tmheight { TextMetric.tmexternalLleading} / scaler); J: = Interval * texts.count; if Taleft in Aligns Then X : = Arect.Left J else if Tahorzcenter in Aligns THEN X: = (all) SHR 1 else {ift j) Shr 1 else {if Taright in aligns} x: = all ..right - 2; y: = all TOP 2; end; -45 ..- 1: begin windows.gettextMetrics (Acanvas.Handle, TextMetric); Interval: = CEIL ((TextMetric.tmHeight { TextMetric.tmexternalLleading}) / scaler); J: = Interval * Texts.count; x: = all le le i = limited.bottom - J: = all tavertCenter in aligns the = (all "=

Arect.top - J) SHR 1 else {if Tatop in aligns dam 2; end; end; // oldbrushstyle: = acuS.brush.style; //aacanvas.brush.style: = bsclear ; for I: = 0 to Texts.Count - 1 do begin case Direction of tdVertChinese: begin J: = Length (WideString (Texts [I])) * (TextMetric.tmHeight { TextMetric.tmExternalLeading}); if taBottom in Aligns THEN Y: = all tavertCenter in aligns THEN Y: = (all.bottom all tatop in aligns dam y: = all {in ==4; tempelt.top 2; tempextent. CX: = x; Tempextent.cy: = Y; for j: = 1 to length (WideSTRING (Texts [i])) DO Begin S: = WideString (Texts [i]) [J]; if Ditheredflag Then DrawDithereEDText (Tempextent .Cx, tempextent.cy, s) else begin //windows.extTextOutout (cacvas.handle ,0 ,0 keto_opaque ,@arect, nil, 0, nil); Windows.handTextout (Acanvas.Handle, Tempelt. CX, TEMPEXTENT.CY, {ETO_OPAQUE OR} ETO_CLIPPED, @arect, PCHAR (S), Length (s), nil); end; inc (Tempextent.cy, TextMexTmHeight { TextMetric.tmexternalLleading}; end; dec (X, interval); end; 0: {horizontal} Begin Windows.gettextextentPoint32 (Acanvas.Handle, Pchar (Texts [i]), Length (Texts [i]), Tempextent; if Taright in Aligns Then x: = all .Right - Tempextent.cx else if Tahorzcenter in aligns the x: = (all) shr 1 else {ift) shr 1 else {if Taleft in aligns dam x: = all {en

If Ditheredflag Then DrawDithereEDtext (x, y, texts [i]) else begin //windows.extTextout (Acacvas.Handle ,0 ,0 and EETO_OPAQUE ,@arect, nil, 0, nil); Windows.handTextout (acanvas.handle, X, Y, {ETO_OPAQUE OR} Eto_Clipped, @arect, Pchar (Texts [i]), Length (Texts [i]), NIL); End; INC (Y, Interval); end; 1..45: Begin Windows .GettextextentPoint32 (Acanvas.Handle, Pchar (Texts [i]), Length (Texts [i]), Tempextent; J: = CEIL (Tempextent.cx * scaler); if Taright in aligns the begin Tempextent.cx: = all .Right - j; Tempextent.cy: = y ceil ((x- Tempextent.cx) * Tan (Direction * Pi / 180)); Else if Tahorzcenter in aligns the beginning tempextent.cx: = (all (all (all) Arect.LEFT - J) SHR 1; Tempextent.cy: = Y CEIL (x - Tempextent.cx) * Tan (Direction * Pi / 180)); Else {if Taleft in aligns dam tempextent.cx: = Arect.Left 2; Tempext ENT.CY: = Y; End; if Ditheredflag Ten DrawDithereEDtext (Tempextent.cx, Tempextent.cy, TeMpeXtent.cy, Texts [i]) else begin //windows.extTextOutout (cacvas.handle ,0 ,0 keto_opaque ,@arect, nil, 0, NIL); Windows.extTextout (Acanvas.Handle, Tempextent.cx, Tempextent.cy, {ETO_OPAQUE OR} Eto_Clipped, @arect, Pchar (Texts [i]), Length (Texts [i]), NIL; End Inc (y, interval); end; 46..90: Begin Windows.gettextextentPoint32 (Acanvas.Handle, Pchar (Texts [i]), Length (Texts [i]), Tempextent; J: = CEIL (Tempextent. Cx * scaler; if Tatop in aligns the beginning.

Tempextent.cx: = x CEIL ((Y - Tempextent.cy) / Tan (Direction * Pi / 180)); Else if TAVENTCENTER in Aligns the beginning Tempextent.cy: = (all (all (all (all (all (all) SHR 1; Tempextent.cx: = x CEIL ((Y - Tempextent.cy) / Tan (Direction * Pi / 180)); Else {if Taleft in aligns dam tempextent.cy: = all: t 2; Tempextent.cx: = x; End; if Ditheredflag Then DrawDithereEDtext (Tempextent.cx, Tempextent.cy, Texts [i]) else begin //windows.extTextout(aVas.handle ,0 ,0 andto_opaque ,@arect, NIL, 0, NIL; Windows.extTextout (Acanvas.Handle, Tempextent.cx, Tempextent.cy, {ETO_OPAQUE OR} Eto_Clipped, @arect, Pchar (Texts [i]), Length (Texts [i]), NIL) End; INC (X, Interval); end; -90 ..- 46: Begin Windows.gettextextentPoint32 (Acanvas.Handle, Pchar (Texts [i]), Length (Texts [i]), TempeXtent; J: = CEIL (Tempextent.cx * scaler); if Tabott om in aligns dam Tempextent.cy: = all: = bPEXTENT.CX: = X CEIL ((Tempextent.cy - Y) / TAN (-direction * pi / 180)); Else if TaplaceTCenter in Aligns Tenshen Tempextent.cy: = (all (all.bottom all; tempextent.cx: = x ceil (tempextent.cy - y) / tan (-direction * pi / 180)); end Else {if Taleft in aligns dam, tempextent.cy: = all: = all: = x;

转载请注明原文地址:https://www.9cbs.com/read-4159.html

New Post(0)