Rev 89 | Rev 91 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 89 | Rev 90 | ||
---|---|---|---|
Line 49... | Line 49... | ||
49 | objLine := TVtsAsciiTableLine.Create; |
49 | objLine := TVtsAsciiTableLine.Create; |
50 | objLine.SetVal(0, 'Asparagus (white)', taLeftJustify); |
50 | objLine.SetVal(0, 'Asparagus (white)', taLeftJustify); |
51 | objLine.SetVal(1, '999', taRightJustify); |
51 | objLine.SetVal(1, '999', taRightJustify); |
52 | VirtTable.Add(objLine); |
52 | VirtTable.Add(objLine); |
53 | 53 | ||
54 | // Create ASCII Table |
54 | // Create ASCII table |
55 | Memo1.Clear; |
55 | Memo1.Clear; |
56 | VirtTable.GetASCIITable(Memo1.Lines); |
56 | VirtTable.GetASCIITable(Memo1.Lines); |
57 | 57 | ||
- | 58 | // Save ASCII table |
|
- | 59 | VirtTable.SaveASCIITable('Order.txt'); |
|
- | 60 | ||
58 | // Create CSV |
61 | // Create CSV |
59 | Memo2.Clear; |
62 | Memo2.Clear; |
60 | VirtTable.GetCSV(Memo2.Lines); |
63 | VirtTable.GetCSV(Memo2.Lines); |
- | 64 | ||
- | 65 | // Save CSV |
|
61 | Memo2.Lines.SaveToFile('Order.csv'); |
66 | VirtTable.SaveCSV('Order.csv'); |
62 | 67 | ||
63 | VirtTable.Free; |
68 | VirtTable.Free; |
64 | end; |
69 | end; |
65 | 70 | ||
66 | } |
71 | } |
Line 94... | Line 99... | ||
94 | function GetItem(Index: Integer): TVtsAsciiTableLine; |
99 | function GetItem(Index: Integer): TVtsAsciiTableLine; |
95 | procedure SetItem(Index: Integer; const Value: TVtsAsciiTableLine); |
100 | procedure SetItem(Index: Integer; const Value: TVtsAsciiTableLine); |
96 | public |
101 | public |
97 | function GetAnalysis: TVtsAsciiTableAnalysis; |
102 | function GetAnalysis: TVtsAsciiTableAnalysis; |
98 | procedure GetASCIITable(sl: TStrings; spaceBetween: integer=3); |
103 | procedure GetASCIITable(sl: TStrings; spaceBetween: integer=3); |
- | 104 | procedure SaveASCIITable(filename: string; spaceBetween: integer=3); |
|
99 | procedure GetCSV(sl: TStrings); |
105 | procedure GetCSV(sl: TStrings); |
- | 106 | procedure SaveCSV(filename: string); |
|
100 | 107 | ||
101 | procedure AddSeparator; |
108 | procedure AddSeparator; |
102 | 109 | ||
103 | // Just a little bit type-safe... The rest stays TObject for now |
110 | // Just a little bit type-safe... The rest stays TObject for now |
104 | function Add(AObject: TVtsAsciiTableLine): Integer; reintroduce; |
111 | function Add(AObject: TVtsAsciiTableLine): Integer; reintroduce; |
Line 275... | Line 282... | ||
275 | procedure TVtsAsciiTable.Insert(Index: Integer; AObject: TVtsAsciiTableLine); |
282 | procedure TVtsAsciiTable.Insert(Index: Integer; AObject: TVtsAsciiTableLine); |
276 | begin |
283 | begin |
277 | Inherited Insert(Index, AObject); |
284 | Inherited Insert(Index, AObject); |
278 | end; |
285 | end; |
279 | 286 | ||
- | 287 | procedure TVtsAsciiTable.SaveASCIITable(filename: string; |
|
- | 288 | spaceBetween: integer); |
|
- | 289 | var |
|
- | 290 | sl: TStringList; |
|
- | 291 | begin |
|
- | 292 | sl := TStringList.Create; |
|
- | 293 | try |
|
- | 294 | GetASCIITable(sl, spaceBetween); |
|
- | 295 | sl.SaveToFile(filename); |
|
- | 296 | finally |
|
- | 297 | FreeAndNil(sl); |
|
- | 298 | end; |
|
- | 299 | end; |
|
- | 300 | ||
- | 301 | procedure TVtsAsciiTable.SaveCSV(filename: string); |
|
- | 302 | var |
|
- | 303 | sl: TStringList; |
|
- | 304 | begin |
|
- | 305 | sl := TStringList.Create; |
|
- | 306 | try |
|
- | 307 | GetCSV(sl); |
|
- | 308 | sl.SaveToFile(filename); |
|
- | 309 | finally |
|
- | 310 | FreeAndNil(sl); |
|
- | 311 | end; |
|
- | 312 | end; |
|
- | 313 | ||
280 | procedure TVtsAsciiTable.SetItem(Index: Integer; const Value: TVtsAsciiTableLine); |
314 | procedure TVtsAsciiTable.SetItem(Index: Integer; const Value: TVtsAsciiTableLine); |
281 | begin |
315 | begin |
282 | Inherited Items[Index] := Value; |
316 | Inherited Items[Index] := Value; |
283 | end; |
317 | end; |
284 | 318 |