AGB  ·  Datenschutz  ·  Impressum  







Anmelden
Nützliche Links
Registrieren
Zurück Delphi-PRAXiS Programmierung allgemein GUI-Design mit VCL / FireMonkey / Common Controls Delphi mit pdf-Tool nur Teil einen Stringgrid drucken
Thema durchsuchen
Ansicht
Themen-Optionen

mit pdf-Tool nur Teil einen Stringgrid drucken

Ein Thema von tom_po · begonnen am 7. Mai 2006 · letzter Beitrag vom 10. Mai 2006
Antwort Antwort
marabu

Registriert seit: 6. Apr 2005
10.109 Beiträge
 
#1

Re: mit pdf-Tool nur Teil einen Stringgrid drucken

  Alt 7. Mai 2006, 09:17
Hallo,

wenn du deinen Code besser organisierst, dann entkommst du vielleicht dem maintenance blues:

Delphi-Quellcode:
function LabelToPage(pt: Tpoint; index: Integer): TPoint;
const
  PageLeft = 20;
  PageTop = 40;
  LabelWidth = 600;
  LabelHeight = 120;
begin
  Result := Point(
              pt.X + PageLeft + (index mod 2) * LabelWidth,
              pt.Y + PageTop + (index div 2) * LabelHeight
            );
end;

procedure TDemoForm.Button1Click(Sender: TObject);
const
  ptArtikel: TPoint = (X: 0; Y: 0);
  ptFarbe: TPoint = (X: 150; Y: 0);
  ptColumn2: TPoint = (X: 400; Y: 0);
  ptOrder: TPoint = (X: 0; Y: 50);
  ptCode: TPoint = (X: 115; Y: 32);
  ptColumn0: TPoint = (X: 260; Y: 50);
  ptColumn1: TPoint = (X: 400; Y: 50);
var
  iRow, iLabel: Integer;
  pdf: TCanvas;
  Artikel, Farbe, Order: TEdit;
begin
  deletetmppdf;
  with printpdf1 do
  begin
    FileName:=gettemppathd+'tmppdf'+Inttostr(random(5000))+'.pdf';
    PageWidth:=1224;
    PageHeight:=1725;
    BeginDoc;
    Font.Name:=poTimesBoldItalic;
    Font.Size:=24;
  end;

  iLabel := 0;
  with StringGrid1, printpdf1 do
    for iRow := 0 to 7 do
      if Trim(Cells[FixedCols, iRow]) <> 'then
      begin
        with LabelToPage(ptArtikel, iLabel) do
          TextOut(X, Y, 'Artigo: ' + Artikel.Text);
        with LabelToPage(ptFarbe, iLabel) do
          TextOut(X, Y, 'Côr: ' + Farbe.Text);
        with LabelToPage(ptColumn2, iLabel) do
          TextOut(X, Y, 'Tam.: ' + Cells[2, FixedRows + iRow]);
        with LabelToPage(ptArtikel, iLabel) do
          TextOut(20,90,'N.P.: '+order.text);
        with LabelToPage(ptArtikel, iLabel) do
          {pdfcodedrucken(X, Y, Order.Text, False)};
        with LabelToPage(ptColumn0, iLabel) do
          TextOut(X, Y, 'N°./Lo: ' + Cells[0, FixedRows + iRow]);
        with LabelToPage(ptColumn1, iLabel) do
          TextOut(X, Y, 'Peç/Lo: ' + Cells[1, FixedRows + iRow]);
        Inc(iLabel);
      end;

  with printpdf1 do
  begin
    LineWidth := 2;
    DrawLine(0, 530, 1224, 530);
    EndDoc;
  end;

  ShellExecute(Application.Handle, 'open', PChar(printpdf1.FileName), nil, nil, SW_NORMAL);
end;
Getippt und nicht getestet.

Freundliche Grüße vom marabu
  Mit Zitat antworten Zitat
Antwort Antwort


Forumregeln

Es ist dir nicht erlaubt, neue Themen zu verfassen.
Es ist dir nicht erlaubt, auf Beiträge zu antworten.
Es ist dir nicht erlaubt, Anhänge hochzuladen.
Es ist dir nicht erlaubt, deine Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks are an
Pingbacks are an
Refbacks are aus

Gehe zu:

Impressum · AGB · Datenschutz · Nach oben
Alle Zeitangaben in WEZ +1. Es ist jetzt 22:24 Uhr.
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz