compréhension d'impression....

compréhension d'impression.... - Delphi/Pascal - Programmation

Marsh Posté le 26-06-2002 à 14:18:58    


 
je voudrait imprimer sous delphi 6
: Date     Enseignant              Duree   Suppleant
                NAS
 
mais j'obtien seulement à l'impression:
Date     Enseignant              Duree   Supp
voici mon code
 
 Printer.BeginDoc;
 XCols[1]:=0;
 yCurr:=255;
 Printer.Canvas.Font.Size:=12;
 yCurr:=yCurr+Printer.Canvas.TextHeight('M';);
 dimPage := Rect(295,yCurr,1276,2000);
 tmp:= 'Date     Enseignant              Duree   Suppleant
 NAS        ';
 drawtext(Printer.Canvas.Handle,pchar(tmp), length(tmp),dimPage,DT_LEFT);
 Printer.Enddoc;
 
 Comment parvenir au résultat escompté?


---------------
Borland rulez: http://pages.infinit.net/borland
Reply

Marsh Posté le 26-06-2002 à 14:18:58   

Reply

Marsh Posté le 26-06-2002 à 14:50:05    

Tiré de la JVCL
 

Code :
  1. procedure TJvPrint.Print(Value: TStringList);
  2. var
  3.   I, Line, Pagenum: Integer;
  4. begin
  5.   //let's print
  6.   if Assigned(FOnBegin) then
  7.     FOnBegin(Self);
  8.   line := 0;
  9.   Printer.BeginDoc;
  10.   Pagenum := 1;
  11.   for i := 0 to Value.Count - 1 do
  12.   begin
  13.     if Assigned(FOnProgress) then
  14.       FOnProgress(Self, i + 1, Value.Count);
  15.     Line := Line + Printer.Canvas.TextHeight(Value[i]);
  16.     if Line + Printer.Canvas.TextHeight(Value[i]) > Printer.PageHeight then
  17.     begin
  18.       Line := Printer.Canvas.TextHeight(Value[i]);
  19.       Printer.NewPage;
  20.       Inc(PageNum);
  21.       if Assigned(FonNextP) then
  22.         FonNextP(Self, PageNum);
  23.     end;
  24.     Printer.Canvas.TextOut(0, Line, Value[I]);
  25.   end;
  26.   Printer.EndDoc;
  27.   if Assigned(FOnEnded) then
  28.     FOnEnded(Self);
  29. end;


 
En enlevant les events ca devrait aller pour toi  ;)


---------------
Informaticien.be - Lancez des défis à vos amis
Reply

Marsh Posté le 26-06-2002 à 23:26:40    

j'ai eu problème de largeur on dirait car ça n'imprime pas tout ce qui devait imprimer
et je me demande pourquoi

Reply

Marsh Posté le 27-06-2002 à 00:09:57    

benh fais un retour à la ligne tiens
 
TextWidth ca pue des pieds?  :sarcastic:


Message édité par zion le 27-06-2002 à 00:10:10

---------------
Informaticien.be - Lancez des défis à vos amis
Reply

Marsh Posté le 27-06-2002 à 17:32:11    

ok c'est correct maintenant
 
j'essaie d'imprimer le contenu d'un dataset en collone....
ça imprime mais rien n'est aligné
 
j'aimerais avoir un effet comme
 
jean     Thibeau  14 am
mathieu   Raymond 45 journée
julie    smith    12 pm
......
 
la ça ressemble plutôt à
 
jean Thibeau 14 am
mathieu Raymond 45 journée
julie smith 12 pm  
 
j'ai pas vraiment trouvé d'information pour le résultat que je veux
 
mon code

Code :
  1. XCols[1]:=0;
  2. Curr:=255;
  3. Printer.Canvas.Font.Size:=12;
  4. Printer.Canvas.Font.Name := 'Times New Roman';
  5. with cdsBesoin do
  6. begin
  7.   tmp := format(FieldByName('Nom').AsString +  ' ' +
  8.                 FieldByName('Nom').AsString +  ' ' +
  9.                 FieldByName('Age').AsInteger+  ' ' +
  10.                 FieldByName('Duree').AsString ,[i,i,i,i]);
  11.   TabbedTextOut(Printer.Canvas.Handle, 295, yCurr, PChar(tmp), length(tmp), 4, XCols[1], 0);
  12.   yCurr:=yCurr+Printer.Canvas.TextHeight('M');
  13.   Next;
  14. end;


---------------
Borland rulez: http://pages.infinit.net/borland
Reply

Sujets relatifs:

Leave a Replay

Make sure you enter the(*)required information where indicate.HTML code is not allowed