Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- type
- TForm1 = class(TForm)
- Button1: TButton;
- ADODataSet1: TADODataSet;
- DataSource1: TDataSource;
- DBGrid1: TDBGrid;
- procedure FormCreate(Sender: TObject);
- procedure Button1Click(Sender: TObject);
- private
- { Private declarations }
- public
- { Public declarations }
- end;
- var
- Form1: TForm1;
- implementation
- uses
- Printers,
- gtUtils3,
- gtCstDocEng,
- gtPDFEng,
- gtCstPDFEng,
- gtExPDFEng;
- {$R *.dfm}
- procedure TForm1.FormCreate(Sender: TObject);
- begin
- Self.BiDiMode := bdRightToLeft;
- SysLocale.MiddleEast := True;
- Self.Font.Name := 'Tahoma';
- ADODataSet1.LoadFromFile('data.xml');
- end;
- procedure TForm1.Button1Click(Sender: TObject);
- var
- FEngine: TgtPDFEngine {TgtCustomDocumentEngine};
- LColumns: TList;
- I, NoColumns: Integer;
- ds: TADODataSet;
- S: WideString;
- begin
- FEngine := TgtPDFEngine.Create(Self);
- with {IgtDocumentEngine} (FEngine) do
- begin
- FileName := ExtractFilePath(Application.ExeName) + 'AdvancedFeatures';
- // Preferences.ShowSetupDialog := False; // @@@
- FEngine.MeasurementUnit := muPixels;
- FEngine.BiDiMode := bdRightToLeft;
- Page.PaperSize := A4;
- // Page.Orientation := Printers.poLandscape; // poPortrait, poLandscape
- BeginDoc;
- if (FEngine.EngineStatus <> esStarted) then
- Exit;
- TextFormatting.Alignment := haCenter;
- TextFormatting.BeforeSpace := 125;
- Font.Name := 'Arial';
- Font.Color := clBlue;
- (*
- Font.Size := 18;
- Font.Style := [fsBold];
- BeginPara;
- TextOut('Advanced Drawing Functions');
- EndPara;
- *)
- Font.Size := 7;
- Font.Style := [];
- // TableSettings.AutoAdjustColumnWidth := True; // @@@
- with TableSettings do
- begin
- EnableTitle := True;
- ColumnWidth := 100;
- RowHeight := 40;
- TitleHeight := 10;
- InternalMargin := gtRect(5, 5, 5, 5);
- end;
- ds := ADODataSet1;
- NoColumns := ds.FieldCount;
- LColumns := BeginTable(40 {X}, 220 {Y}, NoColumns);
- for I := 0 to NoColumns - 1 do
- begin
- // TgtColumn(LColumns[I]).Width := DBGrid1.Columns[I].Width;
- TgtColumn(LColumns[I]).Width := 220; // TODO: calculate. if not specified then TableSettings.ColumnWidth is used
- TgtColumn(LColumns[I]).Title := DBGrid1.Columns[I].Title.Caption; // ???
- TgtColumn(LColumns[I]).Alignment := haRight;
- end;
- ds.First;
- while not ds.Eof do
- begin
- NewRow;
- for I := 0 to ds.FieldCount - 1 do
- begin
- S := ds.Fields[I].AsString;
- TextOut(I, S);
- end;
- ds.Next;
- end;
- EndTable;
- EndDoc;
- end;
- FEngine.Free;
- end;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement