View difference between Paste ID: vQ70z1qH and 720LRLSk
SHOW: | | - or go back to the newest paste.
1
type
2
  TForm1 = class(TForm)
3
    Button1: TButton;
4-
    ADOConnection1: TADOConnection;
4+
5
    DataSource1: TDataSource;
6
    DBGrid1: TDBGrid;
7-
    TntDBGrid1: TTntDBGrid;
7+
8
    procedure Button1Click(Sender: TObject);
9
  private
10
    { Private declarations }
11
  public
12
    { Public declarations }
13
  end;
14
15
var
16
  Form1: TForm1;
17
18
implementation
19
20
uses
21
  Printers,
22-
  uDebug,
22+
23
  gtUtils3,
24-
  //TntUnicode,
24+
25-
  TntWideAdoMemoField,
25+
26
  gtCstPDFEng,
27-
  TntDB,
27+
28
29
{$R *.dfm}
30
31
procedure TForm1.FormCreate(Sender: TObject);
32
begin    
33
  Self.BiDiMode := bdRightToLeft;
34
  SysLocale.MiddleEast := True;
35
  Self.Font.Name := 'Tahoma';
36
37
  ADODataSet1.LoadFromFile('data.xml');
38-
{function WideStringIsRTL(const S: WideString): Boolean;
38+
39
40-
  I: Integer;
40+
41
var
42-
  Result := False;
42+
  FEngine: TgtPDFEngine {TgtCustomDocumentEngine};
43-
  for I := 1 to Length(S) do
43+
44-
    if UnicodeIsRTL(Word(S[I])) then
44+
45
  I, NoColumns: Integer;
46-
      Result := True;
46+
47
  S: WideString;  
48
begin
49-
end;}
49+
50
51-
function FieldGetAsText(Field: TField): WideString;
51+
  with {IgtDocumentEngine} (FEngine) do
52
  begin
53-
  if Field.IsNull then
53+
54-
    Result := '' else
54+
55-
    Result := TntDB.GetWideText(Field);
55+
56
    FEngine.BiDiMode := bdRightToLeft;
57
    Page.PaperSize := A4;
58
    // Page.Orientation := Printers.poLandscape;  // poPortrait, poLandscape
59
    BeginDoc;
60-
  ADODataSet1.Connection := nil;
60+
61-
  // ADODataSet1.LoadFromFile('data.xml');
61+
62-
  ADODataSet1.LoadFromFile('data_100.xml');
62+
63
    TextFormatting.Alignment := haCenter;
64
    TextFormatting.BeforeSpace := 125;
65-
  TntDBGrid1.BiDiMode := bdRightToLeft;
65+
66
    Font.Color := clBlue;
67
68
    (*
69
    Font.Size := 18;
70
    Font.Style := [fsBold];
71
    BeginPara;
72-
  FEngine: TgtPDFEngine{TgtCustomDocumentEngine};
72+
    TextOut('Advanced Drawing Functions');
73
    EndPara;
74
    *)
75
76
    Font.Size := 7;
77-
  F: TField;
77+
78-
  S: WideString;
78+
79
80-
  function FixGuid(S: string): WideString;
80+
81
    begin
82-
    S := StringReplace(S, '{', '{ ', []);
82+
83-
    S := StringReplace(S, '}', ' }', []);
83+
84-
    S := StringReplace(S, '-', ' - ', [rfReplaceAll]);
84+
85-
    Result := S;
85+
86
      InternalMargin := gtRect(5, 5, 5, 5);
87
    end;
88
89
    ds := ADODataSet1;
90-
  with {IgtDocumentEngine}(FEngine) do
90+
91
    LColumns := BeginTable(40 {X}, 220 {Y}, NoColumns);
92
93
    for I := 0 to NoColumns - 1 do
94
    begin
95
      // TgtColumn(LColumns[I]).Width := DBGrid1.Columns[I].Width;
96
      TgtColumn(LColumns[I]).Width := 220; // TODO: calculate. if not specified then TableSettings.ColumnWidth is used
97
      TgtColumn(LColumns[I]).Title := DBGrid1.Columns[I].Title.Caption; // ???
98
99
      TgtColumn(LColumns[I]).Alignment := haRight;
100
    end;
101
102
    ds.First;
103
    while not ds.Eof do
104
    begin
105
      NewRow;
106
      for I := 0 to ds.FieldCount - 1 do
107-
    // Alert(Page.Width);
107+
108
        S := ds.Fields[I].AsString;
109
        TextOut(I, S);
110
      end;
111
      ds.Next;
112
    end;
113-
    // TextOut('Advanced Drawing Functions');
113+
114-
    // TextOut('????, ?? ?????');
114+
115-
    // TextOut('{ 50C57EF2 - FF37 - 431F - 8E94 - 33BB33127B99 }');
115+
116-
    // TextOut('{50C57EF2-FF37-431F-8E94-33BB33127B99}');
116+
117
  end;
118
  
119
  FEngine.Free;
120
end;