Newsgroup: it.comp.lang.delphi
Titolo: Problemi con un nuovo componente per quickreport [lungo + sorgente]

Ciao a tutto il newsgroup,
sto creando (sto CERCANDO di creare) un componente per quickreport che 
mi stampi testi e elementi grafici (rettangoli) usando come modello un 
file in formato xml appositamente formattato.
Sono riuscito a farlo quasi completamente, mi resta da risolvere 1 
grosso problema:
quando il componente passa alla pagina successiva gli elementi grafici 
vengono stampati nella posizione corretta, mentre le prime lettere di 
tutti i testi mi vengono tagliate e non riesco a capire il motivo; 
infatti per disegnare il rettangolo uso la procedura
   RoundRect(R.Left,R.Top,R.Right,R.Bottom,
		Cells[Nc].BRound,Cells[Nc].BRound));
mentre per disegnare sul canvas il testo uso la funzione
   DrawTextEx(Canvas.Handle,PChar(Cells[Nc].Caption),
                Length(Cells[Nc].Caption),R,Twp,nil);
dove R è la stessa variabile di tipo TRect usata per entrambe le 
funzioni con gli stessi valori.
Altra cosa strana è che nell'anteprima di stampa il contenuto viene 
disegnato correttamente, ma quando do la stampa solo la prima pagina mi 
viene stampata bene mentre nelle successive i testi sono tutti sfasati 
verso sinistra.
Qualcuno sa come posso risolvere, oppure mi basterebbe anche il sorgente 
di un componente per QuickReport da usare come esempio, o anche un 
qualche link a un help un pò più esauriente di quello di QuickReport (ho 
già provato a guardare sul sito della QSoft ma non c'è nulla di così 
specifico.
Uso Delphi 7 e quickReport 3.09 standard (quello fornito con delphi per 
intenderci), Win XP Home.
Includo nel messaggio i sorgenti del mio componente allo stato attuale 
di sviluppo e il file in formato XML che uso per i test.
Ciao e Buone Feste a tutti
Michele Rossa
{unit con i tipi di base usati dal componente}
unit XmlTypes;
interface
uses Windows, Graphics;
type TCellRec = record
               Width  : Byte;
               BkColor: TColor;
               Color  : TColor;
               FSize  : Integer;
               FStyle : Byte;
               Align  : Byte;
               VAlign : Byte;
               Wrap   : Boolean;
               BWeight: Byte;
               BColor : TColor;
               BRound : Byte;
               Field  : String;
               Caption: String;
            end;
      TLineRec = record
               Space     : Byte;
               VSpace    : Byte;
               LineColor : TColor;
               LineWeight: Byte;
               Tag       : Integer;
               Cells     : array of TCellRec;
            end;
   TCalcLineEvent = procedure (var DCell: TCellRec) of object;
   TDrawLineEvent = procedure (Canvas: TCanvas; DLine: TLineRec;
                                   XYPos: TPoint; LineHeight: Integer) 
of object;
implementation
end.
{unit con il componente, le procedure che secondo me sono responsabili 
del malfunzionamento sono:
     Print(Ofsx, Ofsy: Integer);
     DrawLinePrint(DLine: TLineRec; YOffset, HLine: Longint; Pr: TRect);
}
unit QRXmlPanel;
interface
uses SysUtils, Classes, Graphics, Controls, Windows, QuickRpt, Math, xmldom,
       XMLIntf, msxmldom, XMLDoc, Variants, oxmldom, xercesxmldom, XmlTypes;
type
   TQrXmlPanel = class(TQRPrintable)
   private
     { Private declarations }
     FAutoStretch: Boolean;
     FDefaultLineColor: TColor;
     FDefaultLineWeight: Byte;
     FDefaultSpace: Byte;
     FDefaultVSpace: Byte;
     FDefaultAlign: Byte;
     FDefaultVAlign: Byte;
     FDefaultWrap: Boolean;
     FDefaultBWeight: Byte;
     FDefaultBColor: TColor;
     FDefaultBRound: Byte;
     FLines: array of TLineRec;
     FOnCalcLine: TCalcLineEvent;
     FOnBeforeDrawLine: TDrawLineEvent;
     FOnAfterDrawLine: TDrawLineEvent;
     FParsed: Boolean;
     FXMLData: TStrings;
     function  CalcLineDesign(DLine: TLineRec): Integer;
     procedure DrawLineDesign(DLine: TLineRec; YOffset, HLine: Longint);
     function  CalcLinePrint(DLine: TLineRec; Pr: TRect): Integer;
     procedure DrawLinePrint(DLine: TLineRec; YOffset, HLine: Longint; 
Pr: TRect);
     procedure SetAutoStretch(Value: Boolean);
     procedure SetXMLData(Value: TStrings);
     function  GetFont: TFont;
     procedure SetFont(Value: TFont);
     function  GetColor: TColor;
     procedure SetColor(Value: TColor);
   protected
     { Protected declarations }
     function TestForNewColumn: Boolean;
     procedure ParseXML;
   public
     { Public declarations }
     constructor Create(AOwner: TComponent); override;
     destructor  Destroy; override;
     procedure Paint; override;
     procedure Print(Ofsx, Ofsy: Integer); override;
     procedure LoadFromFile(FileName: String);
     procedure LoadFromStream(DStream: TStream);
     function Xf(Value: Longint): Longint;
     function Yf(Value: Longint): Longint;
   published
     { Published declarations }
     property AutoStretch: Boolean read FAutoStretch write SetAutoStretch;
     property DefaultLineColor: TColor read FDefaultLineColor write 
FDefaultLineColor;
     property DefaultLineWeight: Byte read FDefaultLineWeight write 
FDefaultLineWeight;
     property DefaultVSpace: Byte read FDefaultVSpace write FDefaultVSpace;
     property DefaultSpace: Byte read FDefaultSpace write FDefaultSpace;
     property DefaultAlign: Byte read FDefaultAlign write FDefaultAlign;
     property DefaultVAlign: Byte read FDefaultVAlign write FDefaultVAlign;
     property DefaultWrap: Boolean read FDefaultWrap write FDefaultWrap;
     property DefaultBWeight: Byte read FDefaultBWeight write 
FDefaultBWeight;
     property DefaultBColor: TColor read FDefaultBColor write 
FDefaultBColor;
     property DefaultBRound: Byte read FDefaultBRound write FDefaultBRound;
     property OnCalcLine: TCalcLineEvent read FOnCalcLine write FOnCalcLine;
     property OnBeforeDrawLine: TDrawLineEvent read FOnBeforeDrawLine
                                                        write 
FOnBeforeDrawLine;
     property OnAfterDrawLine: TDrawLineEvent read FOnAfterDrawLine
                                                        write 
FOnAfterDrawLine;
     property Parsed: Boolean read FParsed;
     property XMLData: TStrings read FXMLData write SetXMLData;
     property Font: TFont read GetFont write SetFont;
     property Color: TColor read GetColor write SetColor;
     property Action;
     property Align;
     property Anchors;
     property Visible;
   end;
procedure Register;
implementation
{descrizione tipi:
   Width  = % sulla lunghezza della linea;
   Align  = 0: Sinistra; 1: Centro; 2: Destra;
   VAlign = 0: Alto; 1: Centro; 2: Basso;
   FStyle = 0: Normale; 1: Grassetto; 2: Corsivo; 3: Sottolineato;
            4: Grassetto+Corsivo; 5: Grassetto+Sottolineato;
            6: Corsivo+Sottolineato; 7: Grassetto+Corsivo+Sottolineato;}
const HSpace = 2;
procedure Register;
begin
   RegisterComponents('QReport', [TQrXmlPanel]);
end;
constructor TQRXmlPanel.Create(AOwner: TComponent);
begin
      inherited Create(AOwner);
      FXMLData := nil;
      FAutoStretch := True;
      FDefaultLineColor := clBlack;
      FDefaultLineWeight := 0;
      FDefaultVSpace := 2;
      FDefaultSpace := 2;
      FDefaultAlign := 0;
      FDefaultVAlign := 0;
      FDefaultWrap := False;
      FDefaultBWeight := 0;
      FDefaultBColor := clBlack;
      FDefaultBRound := 0;
      SetLength(FLines,0);
      FOnCalcLine := nil;
      FOnBeforeDrawLine := nil;
      FOnAfterDrawLine := nil;
      FParsed := False;
      FXMLData := TStringList.Create;
end;
destructor TQRXMLPanel.Destroy;
begin
      if Assigned(FXMLData) then FXMLData.Free;
      inherited Destroy;
end;
{----- Inizio procedure Private -----}
function TQRXmlPanel.Xf(Value: Longint):Longint;
begin Result := Round(ParentReport.QRPrinter.XFactor*Value*2.54); end;
function TQRXmlPanel.Yf(Value: Longint): Longint;
begin Result := Round(ParentReport.QRPrinter.YFactor*Value*2.54); end;
function TQRXmlPanel.TestForNewColumn: Boolean;
var Yws: Double;
begin
      { da verificare lunghezza non corrisponde}
      Yws := ParentReport.Page.Length-ParentReport.Page.BottomMargin;
      if ParentReport.Bands.HasPageFooter then
        Yws := Yws-Yf(ParentReport.Bands.PageFooterBand.Height);
      Result := (Size.Height>Yws);
      { da cestinare }
      {Yws := Yf(ParentReport.Height)-ParentReport.Page.BottomMargin;
      Yws := Yws-Yf(ParentReport.Bands.PageFooterBand.Height);
      Result := Size.Top+Size.Height>Yws;}
end;
function TQRXMLPanel.CalcLineDesign(DLine: TLineRec): Integer;
var I: array of Integer;
     Nc, Fs, Cw, Mb: Integer;
     Twp: Word;
     R: TRect;
begin
      Result := 0;
      if Length(DLine.Cells)=0 then Result := DLine.Space*2+DLine.LineWeight
       else begin
                 SetLength(I,Length(DLine.Cells));
                 Fs := Canvas.Font.Size; Mb := 0;
                 Cw := Width-HSpace*2;
                 for Nc := 0 to Length(DLine.Cells)-1 do
                   try
                      if Assigned(FOnCalcLine) then 
FOnCalcLine(DLine.Cells[Nc]);
                      I[Nc] := Round(Cw/100*DLine.Cells[Nc].Width);
                      Mb := 
Max(Mb,(DLine.VSpace+DLine.Cells[Nc].BWeight)*2);
                      Canvas.Font.Size := 
Canvas.Font.Size+DLine.Cells[Nc].FSize;
                      case DLine.Cells[Nc].FStyle of
                       0 : Canvas.Font.Style := [];
                       1 : Canvas.Font.Style := [fsBold];
                       2 : Canvas.Font.Style := [fsItalic];
                       3 : Canvas.Font.Style := [fsUnderline];
                       4 : Canvas.Font.Style := [fsBold,fsItalic];
                       5 : Canvas.Font.Style := [fsBold,fsUnderline];
                       6 : Canvas.Font.Style := [fsItalic,fsUnderline];
                       7 : Canvas.Font.Style := 
[fsBold,fsItalic,fsUnderline];
                      end;
                      if DLine.Cells[Nc].Wrap then Twp := 
DT_CALCRECT+DT_WORDBREAK
                        else Twp := DT_CALCRECT;
                      R := 
Rect(0,0,I[Nc]-(DLine.Space+DLine.Cells[Nc].BWeight)*2,1);
                      Twp := 
DrawTextEx(Canvas.Handle,PChar(DLine.Cells[Nc].Caption),
 
Length(DLine.Cells[Nc].Caption),R,Twp,nil);
                      Result := Max(Result,Twp);
                   finally
                          Canvas.Font.Size := Fs;
                   end;
                 Inc(Result,Mb);
            end;
end;
procedure TQRXMLPanel.DrawLineDesign(DLine: TLineRec; YOffset, HLine: 
Longint);
var I: array of Integer;
     Nc, Fs: Integer;
     Twp: Word;
     R: TRect;
     Bc, Fc: TColor;
begin
      if (Length(DLine.Cells)=0) then
        begin
             if (DLine.LineWeight>0) then
               begin
                    Canvas.Pen.Color := DLine.LineColor;
                    Canvas.Pen.Width := DLine.LineWeight;
                    Canvas.MoveTo(HSpace+DLine.Space,YOffSet+DLine.VSpace);
 
Canvas.LineTo(Width-HSpace-DLine.Space,YOffSet+DLine.VSpace);
               end;
        end
       else begin
                 SetLength(I,Length(DLine.Cells)+2);
                 I[0] := HSpace;
                 I[Length(I)-1] := Width-HSpace*2;
                 Fs := Canvas.Font.Size;
                 Canvas.Pen.Width := 1;
                 Bc := Canvas.Brush.Color;
                 Fc := Canvas.Font.Color;
                 for Nc := 0 to Length(DLine.Cells)-1 do
                   try
                      Twp := 0;
                      I[Nc+1] := 
I[Nc]+Round(I[Length(I)-1]/100*DLine.Cells[Nc].Width);
                      R := Rect(I[Nc],YOffSet,I[Nc+1],YOffSet+HLine);
                      {imposta font e allineamento}
                      Canvas.Font.Size := 
Canvas.Font.Size+DLine.Cells[Nc].FSize;
                      case DLine.Cells[Nc].FStyle of
                       0 : Canvas.Font.Style := [];
                       1 : Canvas.Font.Style := [fsBold];
                       2 : Canvas.Font.Style := [fsItalic];
                       3 : Canvas.Font.Style := [fsUnderline];
                       4 : Canvas.Font.Style := [fsBold,fsItalic];
                       5 : Canvas.Font.Style := [fsBold,fsUnderline];
                       6 : Canvas.Font.Style := [fsItalic,fsUnderline];
                       7 : Canvas.Font.Style := 
[fsBold,fsItalic,fsUnderline];
                      end;
                      Canvas.Font.Color := DLine.Cells[Nc].Color;
                      case DLine.Cells[Nc].Align of
                       1 : Twp := DT_CENTER;
                       2 : Twp := DT_RIGHT;
                       else Twp := DT_LEFT;
                      end;
                      if DLine.Cells[Nc].Wrap then Twp := Twp+DT_WORDBREAK
                        else case DLine.Cells[Nc].VAlign of
                              1 : Twp := Twp+DT_SINGLELINE+DT_VCENTER;
                              2 : Twp := Twp+DT_SINGLELINE+DT_BOTTOM;
                              else Twp := Twp+DT_SINGLELINE+DT_TOP;
                             end;
                      Canvas.Brush.Color := DLine.Cells[Nc].BkColor;
                      {imposta e disegna rettangolo}
                      if (DLine.Cells[Nc].BWeight>0) then
                        begin
                             Canvas.Pen.Color := DLine.Cells[Nc].BColor;
                             Canvas.RoundRect(R.Left,R.Top,R.Right,R.Bottom,
 
DLine.Cells[Nc].BRound,DLine.Cells[Nc].BRound);
                        end
                       else Canvas.FillRect(R);
                       {scrivi il testo della cella}
                       InflateRect(R,-(DLine.Space+DLine.Cells[Nc].BWeight),
 
-(DLine.VSpace+DLine.Cells[Nc].BWeight));
 
DrawTextEx(Canvas.Handle,PChar(DLine.Cells[Nc].Caption),
 
Length(DLine.Cells[Nc].Caption),R,Twp,nil);
                   finally
                       Canvas.Font.Style := [];
                       Canvas.Font.Color := Fc;
                       Canvas.Font.Size := Fs;
                       Canvas.Brush.Color := Bc;
                   end;
            end;
end;
{  calcola e disegna l'intero contenuto sul canvas di qrprinter }
function TQRXMLPanel.CalcLinePrint(DLine: TLineRec; Pr: TRect): Integer;
var I: array of Integer;
     Nc, Cw, Mb: Integer;
     Twp: Word;
     R: TRect;
begin
     Result := 0;
     with ParentReport.QRPrinter do
      if Length(DLine.Cells)=0 then Result := 
Yf(DLine.VSpace*2+DLine.LineWeight)
       else begin
               SetLength(I,Length(DLine.Cells));
               Mb := 0;
               Cw := Pr.Right-Xf(HSpace*2);
               for Nc := 0 to Length(DLine.Cells)-1 do
                 try
                    if Assigned(FOnCalcLine) then 
FOnCalcLine(DLine.Cells[Nc]);
                      { da eliminare nella versione finale}
                    if DLine.Cells[Nc].Caption='' then
                      DLine.Cells[Nc].Caption := DLine.Cells[Nc].Field;
                      { **********************************}
                    I[Nc] := Round(Cw/100*DLine.Cells[Nc].Width);
                    Mb := 
Max(Mb,Yf((DLine.VSpace+DLine.Cells[Nc].BWeight)*2));
                    Canvas.Font.Size := 
Canvas.Font.Size+DLine.Cells[Nc].FSize;
                    case DLine.Cells[Nc].FStyle of
                      0 : Canvas.Font.Style := [];
                      1 : Canvas.Font.Style := [fsBold];
                      2 : Canvas.Font.Style := [fsItalic];
                      3 : Canvas.Font.Style := [fsUnderline];
                      4 : Canvas.Font.Style := [fsBold,fsItalic];
                      5 : Canvas.Font.Style := [fsBold,fsUnderline];
                      6 : Canvas.Font.Style := [fsItalic,fsUnderline];
                      7 : Canvas.Font.Style := 
[fsBold,fsItalic,fsUnderline];
                    end;
                    if DLine.Cells[Nc].Wrap then Twp := 
DT_CALCRECT+DT_WORDBREAK
                      else Twp := DT_CALCRECT;
                    R := Rect(0,0,
 
I[Nc]-Xf((DLine.Space+DLine.Cells[Nc].BWeight)*2),1);
                    Twp := 
DrawTextEx(Canvas.Handle,PChar(DLine.Cells[Nc].Caption),
 
Length(DLine.Cells[Nc].Caption),R,Twp,nil);
                    Result := Max(Result,Twp);
                 finally
                       Canvas.Font.Size := Self.Canvas.Font.Size;
                 end;
                 Inc(Result,Mb);
            end;
end;
procedure TQRXMLPanel.DrawLinePrint(DLine: TLineRec; YOffset, HLine: 
Longint; Pr: TRect);
var I: array of Integer;
     Nc, Fs: Integer;
     Twp: Word;
     R: TRect;
     Bc, Fc: TColor;
begin
     with ParentReport.QRPrinter do
      if (Length(DLine.Cells)=0) then
        begin
             if (DLine.LineWeight>0) then
               begin
                    Canvas.Pen.Color := DLine.LineColor;
                    Canvas.Pen.Width := Yf(DLine.LineWeight);
 
Canvas.MoveTo(Pr.Left+Xf(HSpace),YOffSet+Yf(DLine.VSpace));
 
Canvas.LineTo(Pr.Left+Pr.Right-Xf(HSpace),YOffSet+Yf(DLine.VSpace));
               end;
        end
       else begin
               SetLength(I,Length(DLine.Cells)+2);
               I[0] := Pr.Left+Xf(HSpace);
               I[Length(I)-1] := Pr.Right-Xf(HSpace*2);
               Fs := Canvas.Font.Size;
               Canvas.Pen.Width := 1;
               Bc := Canvas.Brush.Color;
               for Nc := 0 to Length(DLine.Cells)-1 do
                 try
                    Twp := 0;
                    I[Nc+1] := 
I[Nc]+Round(I[Length(I)-1]/100*DLine.Cells[Nc].Width);
                    R := Rect(I[Nc],YOffSet+2,I[Nc+1],YOffSet+HLine-2);
                    {imposta font e allineamento}
                    Canvas.Font.Size := 
Canvas.Font.Size+DLine.Cells[Nc].FSize;
                    case DLine.Cells[Nc].FStyle of
                      0 : Canvas.Font.Style := [];
                      1 : Canvas.Font.Style := [fsBold];
                      2 : Canvas.Font.Style := [fsItalic];
                      3 : Canvas.Font.Style := [fsUnderline];
                      4 : Canvas.Font.Style := [fsBold,fsItalic];
                      5 : Canvas.Font.Style := [fsBold,fsUnderline];
                      6 : Canvas.Font.Style := [fsItalic,fsUnderline];
                      7 : Canvas.Font.Style := 
[fsBold,fsItalic,fsUnderline];
                    end;
                    Canvas.Font.Color := DLine.Cells[Nc].Color;
                    case DLine.Cells[Nc].Align of
                      1 : Twp := DT_CENTER;
                      2 : Twp := DT_RIGHT;
                      else Twp := DT_LEFT;
                    end;
                    if DLine.Cells[Nc].Wrap then Twp := Twp+DT_WORDBREAK
                      else case DLine.Cells[Nc].VAlign of
                             1 : Twp := Twp+DT_SINGLELINE+DT_VCENTER;
                             2 : Twp := Twp+DT_SINGLELINE+DT_BOTTOM;
                             else Twp := Twp+DT_SINGLELINE+DT_TOP;
                           end;
                    Canvas.Brush.Color := DLine.Cells[Nc].BkColor;
                    {imposta e disegna rettangolo}
                    if (DLine.Cells[Nc].BWeight>0) then
                      begin
                           Canvas.Pen.Color := DLine.Cells[Nc].BColor;
                           Canvas.Pen.Width := Yf(DLine.Cells[Nc].BWeight);
 
Canvas.RoundRect(R.Left,R.Top,R.Right-Xf(1),R.Bottom,
                                             Xf(DLine.Cells[Nc].BRound),
                                             Yf(DLine.Cells[Nc].BRound));
                      end
                     else begin
                               Canvas.FillRect(R);
                               Canvas.Pen.Width := 1;
                          end;
                     {scrivi il testo della cella}
                    InflateRect(R,-Xf(DLine.Space+DLine.Cells[Nc].BWeight),
 
-Yf(DLine.VSpace+DLine.Cells[Nc].BWeight));
                    {OffsetRect(R,R.Left,0);
                    Canvas.Brush.Color := clLime;
                    Canvas.TextRect(R,R.Left,R.Top,
                                     DLine.Cells[Nc].Caption);}
                    { solo per test da eliminare successivamente }
                    {Canvas.Pen.Color := clTeal;
                    Canvas.Brush.Color := clBlue;
                    Canvas.Rectangle(R);
                    Canvas.Brush.Color := clLime;}
                    { scrivi testo cella }
                    DrawTextEx(Canvas.Handle,PChar(DLine.Cells[Nc].Caption),
 
Length(DLine.Cells[Nc].Caption),R,Twp,nil);
                 finally
                       Canvas.Brush.Color := Bc;
                 end;
            end;
end;
procedure TQRXMLPanel.SetAutoStretch(Value: Boolean);
begin
      if (Value<>FAutoStretch) then
        begin
             FAutoStretch := Value;
             Invalidate;
        end;
end;
procedure TQRXMLPanel.SetXMLData(Value: TStrings);
begin
      if (Assigned(Value) and Assigned(FXMLData)) then
        begin
             FXMLData.Assign(Value);
             FParsed := False;
             Invalidate;
        end;
end;
function TQRXMLPanel.GetFont: TFont;
begin
      Result := Canvas.Font;
end;
procedure TQRXMLPanel.SetFont(Value: TFont);
begin
      Canvas.Font.Assign(Value);
      Invalidate;
end;
function TQRXMLPanel.GetColor: TColor;
begin
      Result := Canvas.Brush.Color;
end;
procedure TQRXMLPanel.SetColor(Value: TColor);
begin
      if (Value<>Canvas.Brush.Color) then
        begin
             Canvas.Brush.Color := Value;
             Invalidate;
        end;
end;
{----- Inizio procedure Protected -----}
procedure TQRXMLPanel.ParseXML;
var Xd          : TXMLDocument;
     Nd, Ndl, Ndc: IXMLNode;
     Nl, Nc      : Integer;
function VarToInt(V: Variant; Def: Integer): Integer;
begin if VarIsNull(V) then Result := Def else Result := V; end;
function VarToColor(V: Variant; Def: TColor): TColor;
begin if VarIsNull(V) then Result := Def else Result := V; end;
function VarToBool(V: Variant; Def: Boolean): Boolean;
begin if VarIsNull(V) then Result := Def else Result := V; end;
begin
     SetLength(FLines,0); Xd := nil; FParsed := False;
     if Assigned(FXMLData) and (FXMLData.Count>0) then
      try
         Xd := TXMLDocument.Create(Self);
         Xd.XML.Assign(FXMLData);
         Xd.Active := True;
         if Xd.Node.HasChildNodes then Nd := Xd.Node.ChildNodes[0];
         if Nd.HasChildNodes then
          begin
             SetLength(FLines,Nd.ChildNodes.Count);
             for Nl := 0 to Nd.ChildNodes.Count-1 do
               begin
                    Ndl := Nd.ChildNodes[Nl];
                    FLines[Nl].Tag := VarToInt(Ndl.Attributes['tag'],0);
                    FLines[Nl].Space := 
VarToInt(Ndl.Attributes['space'],FDefaultSpace);
                    FLines[Nl].VSpace := 
VarToInt(Ndl.Attributes['vspace'],FDefaultVSpace);
                    FLines[Nl].LineColor := 
VarToColor(Ndl.Attributes['linecol'],FDefaultLineColor);
                    FLines[Nl].LineWeight := 
VarToInt(Ndl.Attributes['lineweight'],FDefaultLineWeight);
                    if Ndl.HasChildNodes then
                      begin
                           SetLength(FLines[Nl].Cells,Ndl.ChildNodes.Count);
                           for Nc := 0 to Ndl.ChildNodes.Count-1 do
                             begin
                                  Ndc := Ndl.ChildNodes[Nc];
                                  FLines[Nl].Cells[Nc].Width := 
VarToInt(Ndc.Attributes['width'],0);
                                  FLines[Nl].Cells[Nc].BkColor := 
VarToColor(Ndc.Attributes['bkcolor'],Canvas.Brush.Color);
                                  FLines[Nl].Cells[Nc].Color := 
VarToColor(Ndc.Attributes['color'],Canvas.Font.Color);
                                  FLines[Nl].Cells[Nc].FSize := 
VarToInt(Ndc.Attributes['fsize'],0);
                                  FLines[Nl].Cells[Nc].FStyle := 
VarToInt(Ndc.Attributes['fstyle'],0);
                                  FLines[Nl].Cells[Nc].Align := 
VarToInt(Ndc.Attributes['align'],FDefaultAlign);
                                  FLines[Nl].Cells[Nc].VAlign := 
VarToInt(Ndc.Attributes['valign'],FDefaultVAlign);
                                  FLines[Nl].Cells[Nc].Wrap := 
VarToBool(Ndc.Attributes['wrap'],FDefaultWrap);
                                  FLines[Nl].Cells[Nc].BWeight := 
VarToInt(Ndc.Attributes['bweight'],FDefaultBWeight);
                                  FLines[Nl].Cells[Nc].BColor := 
VarToColor(Ndc.Attributes['bcolor'],FDefaultBColor);
                                  FLines[Nl].Cells[Nc].BRound := 
VarToInt(Ndc.Attributes['bround'],FDefaultBRound);
                                  FLines[Nl].Cells[Nc].Field := 
VarToStr(Ndc.Attributes['field']);
                                  FLines[Nl].Cells[Nc].Caption := 
VarToStr(Ndc.Attributes['caption']);
                             end;
                      end;
               end;
          end;
          FParsed := True;
      finally
             if Assigned(Xd) then Xd.Free;
      end;
end;
{----- Inizio procedure Public -----}
procedure TQRXMLPanel.Paint;
var Nl, Hl: Integer;
     Yp: Longint;
begin
      Yp := HSpace;
      if not FParsed then ParseXML;
      Canvas.FillRect(Canvas.ClipRect);
      if (Length(FLines)>0) then
       begin
         for Nl := 0 to Length(FLines)-1 do
           try
             Hl := CalcLineDesign(FLines[Nl]);
             if Assigned(FOnBeforeDrawLine) then
 
FOnBeforeDrawLine(Canvas,FLines[Nl],Point(0,Yp),Hl);
             if (Self.Height<Yp+Hl) then Break;
             DrawLineDesign(FLines[Nl],Yp,Hl);
             Inc(Yp,Hl+FLines[Nl].VSpace);
             if Assigned(FOnAfterDrawLine) then
 
FOnAfterDrawLine(Canvas,FLines[Nl],Point(0,Yp),Hl);
           finally
           end;
       end;
end;
procedure TQRXMLPanel.Print(Ofsx, Ofsy: Integer);
var Rp: TRect;
     Nl, Hl: Integer;
     Yp, YHl: Longint;
     OldPf : TFont;
begin
     with ParentReport.QRPrinter do
      try
         OldPf := TFont.Create;
         OldPf.Assign(Canvas.Font);
         Canvas.Font := Self.Canvas.Font;
         Rp := Rect(XPos(Ofsx+Size.Left),YPos(Ofsy+Size.Top),
                     XSize(Size.Width),YSize(Size.Height));
         Yp := Rp.Top; Yhl := 0;
         if not FParsed then ParseXML;
         if (Length(FLines)>0) then
           begin
              for Nl := 0 to Length(FLines)-1 do
                begin
                   Hl := CalcLinePrint(FLines[Nl],Rp);
                   if Assigned(FOnBeforeDrawLine) then
 
FOnBeforeDrawLine(Canvas,FLines[Nl],Point(Rp.Left,Yp),Hl);
                   if (YSize(Size.Height)<YHl+Hl) then
                     if (FAutoStretch and
                           (Align in[alBottom,alCustom,alNone,alTop])) then
                       begin
                            Size.Height := 
Round((YHl+Hl+Yf(FLines[Nl].VSpace))/YFactor);
                            if TestForNewColumn then
                              begin
                                   {ParentReport.NewColumn;}
                                   ParentReport.NewPage;
                                   Canvas.Font.Assign(Self.Canvas.Font);
                                   Yhl := 0;
                                   Size.Height := 
Round((YHl+Hl+Yf(FLines[Nl].VSpace))/YFactor);
                                   Yp := YPos(ParentReport.Page.TopMargin);
                              end;
                            TQRCustomBand(Parent).Size.Height := 
Size.Top+Size.Height;
                       end
                      else Break;
                   DrawLinePrint(FLines[Nl],Yp,Hl,Rp);
                   Inc(Yp,Hl+Yf(FLines[Nl].VSpace));
                   Inc(Yhl,Hl+Yf(FLines[Nl].VSpace));
                   if Assigned(FOnAfterDrawLine) then
 
FOnAfterDrawLine(Canvas,FLines[Nl],Point(Rp.Left,Yp),Hl);
                 end;
              if (FAutoStretch and
                  (Align in[alBottom,alCustom,alNone,alTop])) then
                if Size.Height>Yp then Size.Height := Yp+Yf(HSpace);
           end;
      finally
             if Assigned(OldPf) then
               begin
                    Canvas.Font.Assign(OldPf);
                    OldPf.Free;
               end;
      end;
     inherited Print(Ofsx,Ofsy);
end;
procedure TQRXMLPanel.LoadFromFile(FileName: String);
begin
      if (FileName<>'') and (FileExists(FileName))
           and Assigned(FXMLData) then
        begin
             FXMLData.LoadFromFile(FileName);
             FParsed := False;
             Invalidate;
        end;
end;
procedure TQRXMLPanel.LoadFromStream(DStream: TStream);
begin
      if Assigned(DStream) and Assigned(FXMLData) then
        begin
             FXMLData.LoadFromStream(DStream);
             FParsed := False;
             Invalidate;
        end;
end;
end.
{ file xml utilizzato come test e che carico nella variabile
  FXMLData (TStrings) del componente}
<root version="1.0">
	<tr space="4">
		<td width="100" bkcolor="5131854" color="16777215" fsize="3" 
fstyle="1" align="1" valign="1" bweight="1" caption="Linea 1 cella 1" />
	</tr>
	<tr>
		<td width="17" fstyle="1" caption="Linea 2 cella 1" />
		<td width="50" bkcolor="16777215" bweight="1" field="FIELD1" />
		<td width="15" fstyle="1" caption=" Linea 2 cella 3" />
		<td width="15" bkcolor="16777215" bweight="1" field="FIELD2" />
	</tr>
	<tr space="4">
		<td width="100" bkcolor="5131854" color="16777215" fstyle="1" 
bweight="1" caption="Linea 3 cella UNICA" />
	</tr>
	<tr>
		<td width="17" fstyle="1" caption="Linea 4 cella 1" />
		<td width="37" bkcolor="16777215" bweight="1" field="FIELD3" />
		<td width="6" fstyle="1" caption=" Linea 4 cella 3" />
		<td width="8" bkcolor="16777215" bweight="1" field="FIELD4" />
		<td width="7" fstyle="1" caption=" Linea 4 cella 5" />
		<td width="8" bkcolor="16777215" bweight="1" field="FIELD5" />
         <td width="9" fstyle="1" caption=" Linea 4 cella 7" />
         <td width="8" bkcolor="16777215" bweight="1" field="FIELD6" />
	</tr>
	<tr>
		<td width="17" fstyle="1" caption="Linea 5 cella 1" />
		<td width="83" bkcolor="16777215" wrap="1" bweight="1" field="FIELD7" />
	</tr>
	<tr space="4">
		<td width="100" bkcolor="5131854" color="16777215" fstyle="1" 
bweight="1" caption="Linea 6 cella unica" />
	</tr>
	<tr>
		<td width="33" fstyle="1" caption="Linea 6 cella 1" />
         <td width="15" fstyle="1" caption="Linea 6 cella 2" />
         <td width="18" bkcolor="16777215" bweight="1" field="FIELD8" />
         <td width="15" fstyle="1" caption="Linea 6 cella 4" />
		<td width="19" bkcolor="16777215" bweight="1" field="FIELD9" />
     </tr>
     <tr>
		<td width="33" fstyle="1" caption="Linea 7 cella 1" />
         <td width="15" fstyle="1" caption="Linea 7 cella 2" />
         <td width="18" bkcolor="16777215" bweight="1" field="FIELD10" />
         <td width="15" fstyle="1" caption="Linea 7 cella 4" />
		<td width="19" bkcolor="16777215" bweight="1" field="FIELD11" />
     </tr>
     <tr>
		<td width="15" fstyle="1" caption="Linea 8 cella 1" />
		<td width="18" bkcolor="16777215" bweight="1" field="FIELD12" />
		<td width="15" fstyle="1" caption="Linea 8 cella 3" />
		<td width="18" bkcolor="16777215" bweight="1" field="FIELD13" />
	</tr>
	<tr>
		<td width="15" fstyle="1" caption="Linea 9 cella 1" />
		<td width="18" bkcolor="16777215" bweight="1" field="FIELD14" />
		<td width="15" fstyle="1" caption="Linea 9 cella 3" />
		<td width="18" bkcolor="16777215" bweight="1" field="FIELD15" />
		<td width="15" fstyle="1" caption="Linea 9 cella 5" />
		<td width="19" bkcolor="16777215" bweight="1" field="FIELD16" />
	</tr>
	<tr>
		<td width="15" fstyle="1" caption="Linea 10 cella 1" />
		<td width="18" bkcolor="16777215" bweight="1" field="FIELD17" />
		<td width="15" fstyle="1" caption="Linea 10 cella 3" />
		<td width="18" bkcolor="16777215" bweight="1" field="FIELD18" />
		<td width="15" fstyle="1" caption="Linea 10 cella 5" />
		<td width="19" bkcolor="16777215" bweight="1" field="FIELD19" />
	</tr>
	<tr>
		<td width="15" fstyle="1" wrap="1" caption="Linea 11 cella 1" />
		<td width="18" bkcolor="16777215" bweight="1" field="FIELD20" />
		<td width="15" fstyle="1" wrap="1" caption="Linea 11 cella 3" />
		<td width="18" bkcolor="16777215" bweight="1" field="FIELD21" />
		<td width="15" fstyle="1" caption="Linea 11 cella 5" />
		<td width="19" bkcolor="16777215" bweight="1" field="FIELD22" />
	</tr>
	<tr>
		<td width="15" fstyle="1" caption="Linea 12 cella 1" />
		<td width="18" bkcolor="16777215" bweight="1" field="FIELD23" />
		<td width="15" fstyle="1" caption="Linea 12 cella 3" />
		<td width="18" bkcolor="16777215" bweight="1" field="FIELD24" />
     </tr>
     <tr>
		<td width="15" fstyle="1" caption="Linea 13 cella 1" />
		<td width="18" bkcolor="16777215" bweight="1" field="FIELD25" />
         <td width="15" fstyle="1" caption="Linea 13 cella 3" />
		<td width="18" bkcolor="16777215" bweight="1" field="FIELD26" />
		<td width="15" fstyle="1" caption="Linea 13 cella 5" />
		<td width="18" bkcolor="16777215" bweight="1" field="FIELD27" />
	</tr>
     <tr>
		<td width="15" fstyle="1" wrap="1" caption="Linea 14 cella 1" />
		<td width="18" bkcolor="16777215" bweight="1" field="FIELD28" />
         <td width="15" fstyle="1" wrap="1" caption="Linea 14 cella 3" />
		<td width="18" bkcolor="16777215" bweight="1" field="FIELD29" />
		<td width="15" fstyle="1" wrap="1" caption="Linea 14 cella 5" />
		<td width="18" bkcolor="16777215" bweight="1" field="FIELD30" />
	</tr>
     <tr>
		<td width="25" fstyle="1" caption="Linea 15 cella 1" />
		<td width="18" bkcolor="16777215" bweight="1" field="FIELD31" />
		<td width="25" fstyle="1" caption="Linea 15 cella 3" />
		<td width="18" bkcolor="16777215" bweight="1" field="FIELD32" />
	</tr>
	<tr space="4">
		<td width="100" bkcolor="5131854" color="16777215" fstyle="1" 
bweight="1" field="" caption="Linea 16 cella 1" />
	</tr>
	<tr>
		<td width="48" fstyle="1" caption="Linea 17 cella 1" />
		<td width="18" bkcolor="16777215" bweight="1" field="FIELD33" />
	</tr>
	<tr space="4" linecol="12632256" lineweight="2" />
	<tr>
		<td width="33" fstyle="1" caption="Linea 18 cella 1" />
		<td width="15" fstyle="1" caption="Linea 18 cella 2" />
		<td width="18" bkcolor="16777215" bweight="1" field="FIELD34" />
		<td width="15" fstyle="1" caption="Linea 18 cella 4" />
		<td width="19" bkcolor="16777215" bweight="1" field="FIELD35" />
	</tr>
	<tr>
		<td width="33" fstyle="1" />
		<td width="15" fstyle="1" caption="Linea 19 cella 1" />
		<td width="18" bkcolor="16777215" bweight="1" field="FIELD36" />
		<td width="15" fstyle="1" caption="Linea 19 cella 3" />
		<td width="19" bkcolor="16777215" bweight="1" field="FIELD37" />
	</tr>
	<tr space="4" linecol="12632256" lineweight="2" />
	<tr>
		<td width="33" fstyle="1" caption="Linea 20 cella 1" />
		<td width="15" fstyle="1" caption="Linea 20 cella 2" />
		<td width="18" bkcolor="16777215" bweight="1" field="FIELD38" />
		<td width="15" fstyle="1" caption="Linea 20 cella 4" />
		<td width="19" bkcolor="16777215" bweight="1" field="FIELD39" />
	</tr>
	<tr>
		<td width="33" fstyle="1" />
		<td width="15" fstyle="1" caption="Linea 21 cella 1" />
		<td width="18" bkcolor="16777215" bweight="1" field="FIELD40" />
		<td width="15" fstyle="1" caption="Linea 21 cella 3" />
		<td width="19" bkcolor="16777215" bweight="1" field="FIELD41" />
	</tr>
     <tr>
		<td width="33" fstyle="1" />
		<td width="15" fstyle="1" caption="Linea 22 cella 2" />
		<td width="18" bkcolor="16777215" bweight="1" field="FIELD42" />
	</tr>
     <tr space="4" linecol="12632256" lineweight="2" />
	<tr>
		<td width="33" fstyle="1" caption="Linea 23 cella 1" />
		<td width="15" fstyle="1" caption="Linea 23 cella 2" />
		<td width="18" bkcolor="16777215" bweight="1" field="FIELD43" />
		<td width="15" fstyle="1" caption="Linea 23 cella 4" />
		<td width="19" bkcolor="16777215" bweight="1" field="FIELD44" />
	</tr>
	<tr space="4" linecol="12632256" lineweight="2" />
	<tr>
		<td width="100" fstyle="1" caption="Linea 24 cella 1" />
	</tr>
	<tr>
		<td width="15" fstyle="1" caption="Linea 25 cella 1" />
		<td width="18" bkcolor="16777215" bweight="1" field="FIELD45" />
		<td width="15" fstyle="1" caption="Linea 25 cella 3" />
		<td width="18" bkcolor="16777215" bweight="1" field="FIELD46" />
		<td width="15" fstyle="1" caption="Linea 25 cella 5" />
		<td width="19" bkcolor="16777215" bweight="1" field="FIELD47" />
	</tr>
	<tr>
		<td width="15" fstyle="1" caption="Linea 26 cella 1" />
		<td width="18" bkcolor="16777215" bweight="1" field="FIELD48" />
		<td width="15" fstyle="1" caption="Linea 26 cella 3" />
		<td width="18" bkcolor="16777215" bweight="1" field="FIELD49" />
		<td width="15" fstyle="1" caption="Linea 26 cella 5" />
		<td width="19" bkcolor="16777215" bweight="1" field="FIELD50" />
	</tr>
	<tr>
		<td width="15" fstyle="1" caption="Linea 26 cella 1" />
		<td width="18" bkcolor="16777215" bweight="1" field="FIELD51" />
		<td width="15" fstyle="1" caption="Linea 26 cella 3" />
		<td width="18" bkcolor="16777215" bweight="1" field="FIELD52" />
		<td width="15" fstyle="1" caption="Linea 26 cella 5" />
		<td width="19" bkcolor="16777215" bweight="1" field="FIELD53" />
	</tr>
	<tr space="4">
		<td width="100" bkcolor="5131854" color="16777215" fstyle="1" 
bweight="1" caption="Linea 27 cella 1" />
	</tr>
	<tr>
		<td width="20" fstyle="1" caption="Linea 28 cella 1" />
		<td width="80" bkcolor="16777215" wrap="1" bweight="1" field="FIELD54" />
	</tr>
	<tr>
		<td width="20" fstyle="1" caption="Linea 29 cella 1" />
		<td width="80" bkcolor="16777215" wrap="1" bweight="1" field="FIELD55" />
	</tr>
	<tr>
		<td width="15" fstyle="1" wrap="1" caption="Linea 30 cella 1" />
		<td width="18" bkcolor="16777215" bweight="1" field="FIELD56" />
		<td width="15" fstyle="1" caption="Linea 30 cella 3" />
		<td width="18" bkcolor="16777215" bweight="1" field="FIELD57" />
		<td width="15" fstyle="1" wrap="1" caption="Linea 30 cella 5" />
		<td width="19" bkcolor="16777215" bweight="1" field="FIELD58" />
	</tr>
	<tr>
		<td width="15" fstyle="1" wrap="1" caption="Linea 31 cella 1" />
		<td width="18" bkcolor="16777215" bweight="1" field="FIELD59" />
	</tr>
	<tr>
		<td width="15" fstyle="1" wrap="1" caption="Linea 32 cella 1" />
		<td width="18" bkcolor="16777215" bweight="1" field="FIELD60" />
		<td width="15" fstyle="1" wrap="1" caption="Linea 32 cella 3" />
		<td width="18" bkcolor="16777215" bweight="1" field="FIELD61" />
		<td width="15" fstyle="1" caption="Linea 32 cella 5" />
		<td width="19" bkcolor="16777215" bweight="1" field="FIELD62" />
	</tr>
	<tr>
		<td width="15" fstyle="1" caption="Linea 33 cella 1" />
		<td width="18" bkcolor="16777215" bweight="1" field="FIELD63" />
		<td width="15" fstyle="1" wrap="1" caption="Linea 33 cella 3" />
		<td width="18" bkcolor="16777215" bweight="1" field="FIELD64" />
		<td width="15" fstyle="1" wrap="1" caption="Linea 33 cella 5" />
		<td width="19" bkcolor="16777215" bweight="1" field="FIELD65" />
	</tr>
	<tr>
		<td width="29" fstyle="1" caption="Linea 34 cella 1" />
		<td width="20" bkcolor="16777215" bweight="1" field="FIELD66" />
         <td width="1" />
		<td width="30" fstyle="1" caption="Linea 34 cella 4" />
		<td width="20" bkcolor="16777215" bweight="1" field="FIELD67" />
	</tr>
	<tr>
		<td width="29" fstyle="1" wrap="1" caption="Linea 35 cella 1" />
		<td width="20" bkcolor="16777215" bweight="1" field="FIELD68" />
         <td width="1" />
		<td width="30" fstyle="1" wrap="1" caption="Linea 35 cella 4" />
		<td width="20" bkcolor="16777215" bweight="1" field="FIELD69" />
	</tr>
     <tr>
         <td width="29" fstyle="1" caption="Linea 36 cella 1" />
		<td width="20" bkcolor="16777215" bweight="1" field="FIELD70" />
         <td width="1" />
		<td width="30" fstyle="1" wrap="1" caption="Linea 36 cella 4" />
		<td width="20" bkcolor="16777215" bweight="1" field="FIELD71" />
     </tr>
     <tr>
         <td width="29" fstyle="1" caption="Linea 37 cella 1" />
		<td width="20" bkcolor="16777215" bweight="1" field="FIELD72" />
         <td width="1" />
         <td width="30" fstyle="1" caption="Linea 37 cella 4" />
		<td width="20" bkcolor="16777215" bweight="1" field="FIELD73" />
     </tr>
	<tr>
		<td width="15" fstyle="1" wrap="1" caption="Linea 38 cella 1" />
		<td width="18" bkcolor="16777215" bweight="1" field="FIELD74" />
		<td width="15" fstyle="1" wrap="1" caption="Linea 38 cella 3" />
		<td width="18" bkcolor="16777215" bweight="1" field="FIELD75" />
         <td width="15" fstyle="1" wrap="1" caption="Linea 38 cella 5" />
		<td width="19" bkcolor="16777215" bweight="1" field="FIELD76" />
	</tr>
	<tr space="4">
		<td width="100" bkcolor="5131854" color="16777215" fstyle="1" 
bweight="1" caption="Linea 39 cella 1" />
	</tr>
	<tr>
		<td width="20" fstyle="1" wrap="1" caption="Linea 40 cella 1" />
		<td width="30" bkcolor="16777215" bweight="1" field="FIELD77" />
	</tr>
	<tr>
		<td width="20" fstyle="1" wrap="1" caption="Linea 41 cella 1" />
		<td width="25" fstyle="1" wrap="1" caption="Linea 41 cella 2" />
		<td width="15" bkcolor="16777215" bweight="1" field="FIELD78" />
		<td width="25" fstyle="1" wrap="1" caption="Linea 41 cella 4" />
		<td width="15" bkcolor="16777215" bweight="1" field="FIELD79" />
	</tr>
	<tr>
		<td width="20" fstyle="1" wrap="1" caption="Linea 42 cella 1" />
		<td width="25" fstyle="1" wrap="1" caption="Linea 42 cella 2" />
		<td width="15" bkcolor="16777215" bweight="1" field="FIELD80" />
		<td width="25" fstyle="1" wrap="1" caption="Linea 42 cella 4" />
		<td width="15" bkcolor="16777215" bweight="1" field="FIELD81" />
	</tr>
	<tr space="4">
		<td width="100" bkcolor="5131854" color="16777215" fstyle="1" 
bweight="1" caption="Linea 43 cella 1" />
	</tr>
	<tr>
		<td width="15" fstyle="1" caption="Linea 44 cella 1" />
		<td width="18" bkcolor="16777215" bweight="1" field="FIELD82" />
		<td width="15" fstyle="1" caption="Linea 44 cella 3" />
		<td width="18" bkcolor="16777215" bweight="1" field="FIELD83" />
		<td width="15" fstyle="1" caption="Linea 44 cella 5" />
		<td width="19" bkcolor="16777215" bweight="1" field="FIELD84" />
	</tr>
	<tr>
		<td width="15" fstyle="1" caption="Linea 45 cella 1" />
		<td width="18" bkcolor="16777215" bweight="1" field="FIELD85" />
		<td width="15" fstyle="1" caption="Linea 45 cella 3" />
		<td width="18" bkcolor="16777215" bweight="1" field="FIELD86" />
		<td width="15" fstyle="1" caption="Linea 45 cella 5" />
		<td width="19" bkcolor="16777215" bweight="1" field="FIELD87" />
	</tr>
	<tr space="4">
		<td width="100" bkcolor="12632256" fstyle="1" bweight="1" 
caption="Linea 46 cella 1" />
	</tr>
	<tr tag="20">
		<td width="33" />
		<td width="15" fstyle="1" caption="Linea 47 cella 2" />
		<td width="18" bkcolor="9486007" bweight="1" field="FIELD88" />
         <td width="1" />
		<td width="15" fstyle="1" caption="Linea 47 cella 5" />
		<td width="18" bkcolor="9486007" bweight="1" field="FIELD89" />
	</tr>
	<tr>
		<td width="33" />
		<td width="15" fstyle="1" caption="Linea 48 cella 2" />
		<td width="18" bkcolor="9486007" bweight="1" field="FIELD90" />
         <td width="1" />
		<td width="15" fstyle="1" caption="Linea 48 cella 5" />
		<td width="18" bkcolor="9486007" bweight="1" field="FIELD91" />
	</tr>
	<tr>
		<td width="33" />
		<td width="15" fstyle="1" caption="Linea 49 cella 2" />
		<td width="18" bkcolor="9486007" bweight="1" field="FIELD92" />
         <td width="1" />
		<td width="15" fstyle="1" caption="Linea 49 cella 5" />
		<td width="18" bkcolor="9486007" bweight="1" field="FIELD93" />
	</tr>
	<tr>
		<td width="33" />
		<td width="15" fstyle="1" caption="Linea 50 cella 2" />
		<td width="18" bkcolor="9486007" bweight="1" field="FIELD94" />
         <td width="1" />
		<td width="15" fstyle="1" caption="Linea 50 cella 5" />
		<td width="18" bkcolor="9486007" bweight="1" field="FIELD95" />
	</tr>
	<tr>
		<td width="33" />
		<td width="15" fstyle="1" caption="Linea 51 cella 2" />
		<td width="18" bkcolor="9486007" bweight="1" field="FIELD96" />
         <td width="1" />
		<td width="15" fstyle="1" caption="Linea 51 cella 5" />
		<td width="18" bkcolor="9486007" bweight="1" field="FIELD97" />
	</tr>
	<tr>
		<td width="33" />
		<td width="15" fstyle="1" caption="Linea 52 cella 2" />
		<td width="18" bkcolor="9486007" bweight="1" field="FIELD98" />
         <td width="1" />
		<td width="15" fstyle="1" caption="Linea 52 cella 5" />
		<td width="18" bkcolor="3892432" bweight="1" field="FIELD99" />
	</tr>
	<tr>
		<td width="33" />
		<td width="15" fstyle="1" caption="Linea 53 cella 2" />
		<td width="18" bkcolor="3892432" bweight="1" field="FIELD100" />
         <td width="1" />
		<td width="15" fstyle="1" caption="Linea 53 cella 5" />
		<td width="18" bkcolor="3892432" bweight="1" field="FIELD101" />
	</tr>
	<tr>
		<td width="33" />
		<td width="15" fstyle="1" caption="Linea 54 cella 2" />
		<td width="18" bkcolor="3892432" bweight="1" field="FIELD102" />
         <td width="1" />
		<td width="15" fstyle="1" caption="Linea 54 cella 5" />
		<td width="18" bkcolor="3892432" bweight="1" field="FIELD103" />
	</tr>
	<tr tag="21">
		<td width="33" />
		<td width="15" fstyle="1" caption="Linea 55 cella 2" />
		<td width="18" bkcolor="10713968" bweight="1" field="FIELD104" />
	</tr>
     <tr space="4">
		<td width="100" bkcolor="5131854" color="16777215" align="1" 
fstyle="1" bweight="1" caption="*****" />
	</tr>
</root>


Salve a tutto il newsgroup,
dopo averci passato su notti intere, sono riuscito a risolvere il 
problema che avevo con il QuickReport e posto la soluzione che ho trovato.
In sostanza creo un TMetaFile temporaneo con relalivo Canvas, disegno
ciò che devo disegnare nel Canvas del MetaFile e poi uso StretchDraw per 
portare il contenuto del MetaFile sul Canvas del QRPrinter.
{- crea metafile per dati temporanei -}
MetaFile := TMetaFile.Create;
MetaFile.Width := Self.Width;
MetaFile.Height := Self.Height;
MetaCanvas := TMetaFileCanvas.Create(MetaFile,0);
MetaCanvas.Font.Assign(Canvas.Font);
MetaCanvas.Brush.Color := Canvas.Brush.Color;
...
Hl := CalcLine(MetaCanvas,FLines[FIndexLine],Width);
{- reimposta altezza e disegna linea -}
MetaFile.Height := Hl;
DrawLine(MetaCanvas,FLines[FIndexLine],Width,0,Hl);
...
MetaCanvas.Free;
QRPrinter.Canvas.StretchDraw(Dest,MetaFile);
...
Non sarà elegante come soluzione, ma funziona per cui mi accontento.
Ciao Michele Rossa

 Non sarà elegante come soluzione, ma funziona per cui mi accontento.
Ottima pensata :)
Grazie per il feedback.
-- 
Morde